更改句柄发送计时

This commit is contained in:
liuyang
2018-11-28 17:29:43 +08:00
parent 202d909d7a
commit 890f12f7a7
4 changed files with 41 additions and 41 deletions

View File

@@ -38,27 +38,27 @@ const char *g_kni_fs2_name[FS2_COLUMN_NUM] =
"D_NOT_IPV4/6",
"D_E_ADDHTABLE",
"D_OTHER",
"FD_TOTAL",
"FD_SOCKET_ERR",
"FD_ERROR",
"FD_JOINLQ_ERR",
"FD_GETLQ_ERR",
"FD_SEND_SUCC",
"FD_SEND_ERR",
"PKT_ADDLQ_SUC",
"PKT_ADDLQ_ERR",
"PKT_GETLQ_SUCC",
"PKT_GETLQ_ERR",
"PKT_WRITE_SUCC",
"PKT_WRITE_ERR",
"PENDING",
"CLOSE_TIMEOUT",
"CLOSE_FIN",
"CLOSE_DROPME",
"PEM_NUM",
"REPLAY_WIN",
"HTABLE_ADD_NUM",
"HTABLE_DEL_NUM"
"REPR_TOTAL",
"REPR_E_SOCK",
"REPR_E_SET",
"REPR_E_QIN",
"REPR_E_QOUT",
"REPR_SND",
"REPR_E_SND",
"PKT_QIN",
"PKT_E_QIN",
"PKT_QOUT",
"PKT_E_QOUT",
"PKT_WR",
"PKT_E_WR",
"LINK_OPENED",
"LINK_CLS_TO",
"LINK_CLS_FIN",
"LINK_CLS_DROPME",
"PME_NUM",
"WINPROB_REPLY",
"HTABLE_ADD",
"HTABLE_DEL"
};
@@ -160,10 +160,10 @@ int kni_log_info(char* module,const struct layer_addr* addr,unsigned short proto
//TODO:LEVEL
int kni_log_debug(int level,char* module,const void* a_packet,const char* format,...)
{
if(a_packet == NULL)
// if((a_packet == NULL))
{
return 0;
}
@@ -473,7 +473,7 @@ char* kni_get_payload(const struct streaminfo* pstream,int* datalen)
int kni_filestate2_set(int thread_seq,int colum_index,int bytes,int pktnum)
int kni_filestate2_set(int thread_seq,enum kni_FS_COLUME colum_index,int bytes,int pktnum)
{
g_kni_fs2_info.column_value_pkt[thread_seq][colum_index]+=pktnum;
g_kni_fs2_info.column_value_bytes[thread_seq][colum_index]+=bytes;
@@ -520,6 +520,8 @@ int kni_filestate2_init()
g_kni_fs2_info.metric_tcprepair=FS_register_histogram(g_kni_fs2_info.handler, FS_CALC_CURRENT, "tcprepair(us)" ,1,1000000,2);
g_kni_fs2_info.metric_tun_write=FS_register_histogram(g_kni_fs2_info.handler, FS_CALC_CURRENT, "tun_write(us)" ,1,1000000,2);
g_kni_fs2_info.metric_sendfd=FS_register_histogram(g_kni_fs2_info.handler, FS_CALC_CURRENT, "send_fds(us)" ,1,1000000,2);
g_kni_fs2_info.metric_qout_fd=FS_register_histogram(g_kni_fs2_info.handler, FS_CALC_CURRENT, "q_out_fds(us)" ,1,1000000,2);
g_kni_fs2_info.metric_qout_pkt=FS_register_histogram(g_kni_fs2_info.handler, FS_CALC_CURRENT, "q_out_pkts(us)" ,1,1000000,2);
FS_start(g_kni_fs2_info.handler);

View File

@@ -72,6 +72,8 @@ struct kni_fs2_info
int metric_tcprepair;
int metric_tun_write;
int metric_sendfd;
int metric_qout_fd;
int metric_qout_pkt;
};
@@ -85,7 +87,7 @@ int kni_get_tcpinfo(struct kni_wndpro_reply_info* lastpkt_info,struct kni_tcp_hd
int kni_get_tcpopt(struct kni_tcp_hdr* tcphdr,int tcp_hdr_len,unsigned short* mss,unsigned char* winscale,unsigned char* scak,unsigned char* timestamps);
char* kni_get_payload(const struct streaminfo* pstream,int* datalen);
int kni_filestate2_set(int thread_seq,int colum_index,int bytes,int pktnum);
int kni_filestate2_set(int thread_seq,enum kni_FS_COLUME colum_index,int bytes,int pktnum);
void* kni_filestat2(void* arg);
int kni_order_action(int old_action,int new_action);

View File

@@ -492,10 +492,9 @@ int kni_protocol_identify(const struct streaminfo* pstream,const void* a_packet,
kni_filestate2_set(pstream->threadnum,COLUME_SSL,0,1);
return KNI_FLAG_SSL;
}
//modify by liuyang 20180911 for client_hello but no sni
else if((clienthello_flag == 1)&&(sni_flag == 0))
{
kni_log_debug(RLOG_LV_INFO,(char*)"SSL_IDENTIFY",(void*)a_packet,(char*)"this ssl has client_hello,but no sni!");
kni_log_debug(RLOG_LV_DEBUG,(char*)"SSL_IDENTIFY",(void*)a_packet,(char*)"this ssl has client_hello,but no sni!");
return KNI_FLAG_SSL;
}
@@ -584,12 +583,11 @@ char kni_first_tcpdata(const struct streaminfo* pstream,const void* a_packet,str
else
{
pmeinfo->action = KNI_ACTION_MONITOR;
break;
}
break;
default:
pmeinfo->action = KNI_ACTION_MONITOR;
break;
pmeinfo->action = KNI_ACTION_MONITOR;
break;
}
@@ -692,9 +690,7 @@ char kni_pending_opstate(const struct streaminfo* pstream,struct kni_pme_info* p
kni_get_tcpopt(tcphdr,tcphdr_len,&(pmeinfo->tcpopt_info[pstream->curdir-1].mss),&(pmeinfo->tcpopt_info[pstream->curdir-1].wnscal),&(pmeinfo->tcpopt_info[pstream->curdir-1].sack),&(pmeinfo->tcpopt_info[pstream->curdir-1].timestamps));
kni_get_tcpinfo(&(pmeinfo->lastpkt_info[pstream->curdir-1]),tcphdr,datalen);
#ifndef KNI_DEBUG_TCPREPAIR
if(datalen>0)
#endif
if(datalen>0)//TODO:get link create mode from sapp
{
ret=kni_first_tcpdata(pstream,a_packet,pmeinfo,data,datalen);
if((pmeinfo->action == KNI_ACTION_MONITOR) && (pmeinfo->protocol==KNI_FLAG_HTTP) ||(pmeinfo->protocol==KNI_FLAG_SSL))
@@ -710,12 +706,10 @@ char kni_pending_opstate(const struct streaminfo* pstream,struct kni_pme_info* p
}
}
#ifndef KNI_DEBUG_TCPREPAIR
else
{
ret=APP_STATE_FAWPKT|APP_STATE_GIVEME;
}
#endif
}
else
{

View File

@@ -1,7 +1,7 @@
#ifndef KNI_PROCESS_H
#define KNI_PROCESS_H
#include <time.h>
#include "stream.h"
#include "MESA_prof_load.h"
#include "MESA_handle_logger.h"
@@ -201,7 +201,7 @@ struct kni_tlv_info
};
struct kni_lqueue_datainfo
struct kni_repaired_fds
{
int client_fd;
int server_fd;
@@ -209,10 +209,12 @@ struct kni_lqueue_datainfo
int keyring;
};
struct kni_lqueue_writetun
//TODO
struct kni_inject_pkt
{
int addr_type;
int buflen;
struct timespec start;
char* buf;
};
@@ -355,11 +357,11 @@ struct kni_pme_info
struct kni_htable_datainfo
{
//for sendpkt
int route_dir;
int route_dir; //TODO:CHAR
unsigned char smac[KNI_MACADDR_LEN];
unsigned char dmac[KNI_MACADDR_LEN];
//send wnd pro reply
int wndpro_flag[KNI_DIR_DOUBLE];
int wndprob_flag[KNI_DIR_DOUBLE];
struct kni_wndpro_reply_info lastpkt_info[KNI_DIR_DOUBLE];
};