diff --git a/kni_entry.c b/kni_entry.c index e413825..beb3a06 100644 --- a/kni_entry.c +++ b/kni_entry.c @@ -897,7 +897,8 @@ char kni_data_opstate(const struct streaminfo* pstream,struct kni_pme_info* pmei { kni_scan_ip((struct ipaddr*)&(pstream->addr),thread_seq,protocol,pmeinfo); } - else if((pmeinfo->ipsscan_action != KNI_ACTION_REPLACE) && (pmeinfo->ipsscan_action != KNI_ACTION_RATELIMIT)) + + if((pmeinfo->ipsscan_action != KNI_ACTION_REPLACE) && (pmeinfo->ipsscan_action != KNI_ACTION_RATELIMIT)) { kni_scan_pktbin((char*)(pstream->pudpdetail->pdata),pstream->pudpdetail->datalen,thread_seq,pmeinfo); } diff --git a/kni_replace.c b/kni_replace.c index 14c0136..eea8cdb 100644 --- a/kni_replace.c +++ b/kni_replace.c @@ -113,6 +113,10 @@ int kni_build_send_ipv4(unsigned char dir,int thread_seq,struct ip* a_packet,str free(sendbuf); sendbuf = NULL; } + else + { + ret = APP_STATE_FAWPKT | APP_STATE_GIVEME; + } return ret; @@ -183,6 +187,11 @@ int kni_build_send_ipv6(unsigned char dir,int thread_seq,struct kni_ipv6_hdr* ip free(sendbuf); sendbuf = NULL; } + else + { + ret = APP_STATE_FAWPKT | APP_STATE_GIVEME; + } + return ret; @@ -230,8 +239,6 @@ char kni_process_replace(unsigned char dir,int thread_seq,const struct streaminf return APP_STATE_DROPME; } - kni_log_debug(RLOG_LV_FATAL,(char*)"REPLACE",a_packet,(char*)"config id:%d,original:%s,replace:%s",pmeinfo->cfg_id,replace_info.find,replace_info.replace); - replace_sendlog(pstream, pmeinfo, replace_info.find,replace_info.replace); if(*(char*)a_packet == 0x45) { @@ -242,6 +249,14 @@ char kni_process_replace(unsigned char dir,int thread_seq,const struct streaminf ret = kni_build_send_ipv6(dir,thread_seq,(struct kni_ipv6_hdr*)a_packet,pmeinfo,&replace_info); } + + if(ret & APP_STATE_DROPPKT) + { + kni_log_debug(RLOG_LV_FATAL,(char*)"REPLACE",a_packet,(char*)"config id:%d,original:%s,replace:%s",pmeinfo->cfg_id,replace_info.find,replace_info.replace); + replace_sendlog(pstream, pmeinfo, replace_info.find,replace_info.replace); + } + + //20181030 modify for muti replace Maat_clean_status(&(pmeinfo->mid)); pmeinfo->ipsscan_action = KNI_ACTION_NONE;