保证pinnig链接计数时间与intecept的链接计数时间保持一致统计tntercept动作放入kni,修改tsg_entry代码
This commit is contained in:
@@ -28,6 +28,7 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
#include "kni_tun.h"
|
||||
#include "tsg/tsg_statistic.h"
|
||||
|
||||
struct kni_handle *g_kni_handle = NULL;
|
||||
struct kni_field_stat_handle *g_kni_fs_handle = NULL;
|
||||
@@ -122,6 +123,7 @@ struct pme_info{
|
||||
int has_dup_syn_ack;
|
||||
struct dup_traffic_dabloom_key *syn_packet;
|
||||
struct dup_traffic_dabloom_key *syn_ack_packet;
|
||||
struct _traffic_info traffic_info;
|
||||
};
|
||||
|
||||
struct wrapped_packet{
|
||||
@@ -344,6 +346,7 @@ static int log_generate(struct pme_info *pmeinfo){
|
||||
ret, pmeinfo->stream_traceid);
|
||||
goto error_out;
|
||||
}
|
||||
tsg_set_intercept_flow(&pmeinfo->maat_result, &pmeinfo->traffic_info,0);
|
||||
FS_operate(g_kni_fs_handle->handle, g_kni_fs_handle->fields[KNI_FIELD_SENDLOG_SUCC], 0, FS_OP_ADD, 1);
|
||||
return 0;
|
||||
|
||||
@@ -1265,12 +1268,31 @@ static char data_opstate(struct streaminfo *stream, struct pme_info *pmeinfo, co
|
||||
return APP_STATE_FAWPKT | APP_STATE_GIVEME;
|
||||
}
|
||||
|
||||
static int kni_set_policy_into_pem_info(const struct streaminfo *a_stream, struct pme_info *pmeinfo)
|
||||
{
|
||||
struct _traffic_info *traffic_info = &(pmeinfo->traffic_info);
|
||||
int value_len=sizeof(unsigned long long);
|
||||
if(a_stream == NULL || pmeinfo == NULL)
|
||||
return -1;
|
||||
traffic_info->con_num = 1;
|
||||
|
||||
MESA_get_stream_opt(a_stream, MSO_TOTAL_INBOUND_BYTE, (void *)&traffic_info->in_bytes, &value_len);
|
||||
|
||||
MESA_get_stream_opt(a_stream, MSO_TOTAL_INBOUND_PKT, (void *)&traffic_info->in_packets, &value_len);
|
||||
|
||||
MESA_get_stream_opt(a_stream, MSO_TOTAL_OUTBOUND_BYTE, (void *)&traffic_info->out_bytes, &value_len);
|
||||
|
||||
MESA_get_stream_opt(a_stream, MSO_TOTAL_OUTBOUND_PKT, (void *)&traffic_info->out_packets, &value_len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char close_opstate(const struct streaminfo *stream, struct pme_info *pmeinfo, int thread_seq){
|
||||
//close: because of timeout, return value has no meaning
|
||||
switch(pmeinfo->action){
|
||||
case KNI_ACTION_INTERCEPT:
|
||||
TLD_append_streaminfo(g_tsg_log_instance, pmeinfo->tld_handle, (struct streaminfo*)pmeinfo->stream);
|
||||
kni_set_policy_into_pem_info(stream,pmeinfo);
|
||||
//reset clock: when sapp end, start clock
|
||||
MESA_htable_search(g_kni_handle->traceid2pme_htable, (const unsigned char*)pmeinfo->stream_traceid,
|
||||
strnlen(pmeinfo->stream_traceid, sizeof(pmeinfo->stream_traceid)));
|
||||
|
||||
Reference in New Issue
Block a user