bugfix:TSG-6638根据拦截成功的第一个数据包矫正kni传输给tfe的timestamp相关数值

This commit is contained in:
fumingwei
2021-08-27 14:54:07 +08:00
parent 534a9de16d
commit 5718d879f3
3 changed files with 18 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ struct kni_tcpopt_info{
uint8_t ts_set;
uint8_t sack;
uint32_t ts_value;
uint32_t ts_ecr;
};
//field_stat

View File

@@ -206,6 +206,7 @@ void kni_get_tcpopt(struct kni_tcpopt_info *tcpopt, struct tcphdr* tcphdr,int tc
if ((opsize == TCPOLEN_TIMESTAMP)){
tcpopt->ts_set = 1;
tcpopt->ts_value = *(uint32_t*)ptr;
tcpopt->ts_ecr = *(uint32_t*)(ptr + 4);
}
break;
case TCPOPT_SACK_PERMITTED:

View File

@@ -1185,6 +1185,20 @@ static int tsg_diagnose_judge_streamshunt(int maat_rule_config_id,struct pme_inf
}
return ret;
}
static void set_timestamp_depend_first_data(struct streaminfo *stream, struct pme_info *pmeinfo, struct pkt_info *pktinfo){
struct kni_tcpopt_info tcpopt_first_data;
if(pmeinfo->client_tcpopt.ts_set != 1 || pmeinfo->server_tcpopt.ts_set != 1)
return;
kni_get_tcpopt(&tcpopt_first_data,pktinfo->tcphdr,pktinfo->tcphdr_len);
if(stream->curdir == 1){
pmeinfo->client_tcpopt.ts_value = tcpopt_first_data.ts_value;
pmeinfo->server_tcpopt.ts_value = tcpopt_first_data.ts_ecr;
}
if(stream->curdir == 2){
pmeinfo->client_tcpopt.ts_value = tcpopt_first_data.ts_ecr;
pmeinfo->server_tcpopt.ts_value = tcpopt_first_data.ts_value;
}
}
static int first_data_intercept(struct streaminfo *stream, struct pme_info *pmeinfo, struct pkt_info *pktinfo, int thread_seq){
FS_operate(g_kni_fs_handle->handle, g_kni_fs_handle->fields[KNI_FIELD_INTCP_READY_STM], 0, FS_OP_ADD, 1);
@@ -1370,6 +1384,8 @@ static int first_data_intercept(struct streaminfo *stream, struct pme_info *pmei
}
}
//get intercept success first data timestamps send to tfe
set_timestamp_depend_first_data(stream, pmeinfo, pktinfo);
//add cmsg
len = 0;
buff = add_cmsg_to_packet(pmeinfo, stream, pktinfo, &len);