From 408a5f52ffbb689dca72965544eccd1f94d55407 Mon Sep 17 00:00:00 2001 From: 刘学利 Date: Tue, 15 Sep 2020 09:29:26 +0800 Subject: 修正返回插件管理的返回值 修复安装和卸载时报错 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/preInstall.sh | 1 + cmake/preUninstall.sh | 7 +++++-- include/dns.h | 23 ++++++++++++----------- src/dns.cpp | 22 +++------------------- 4 files changed, 21 insertions(+), 32 deletions(-) diff --git a/cmake/preInstall.sh b/cmake/preInstall.sh index 3519753..53609fe 100644 --- a/cmake/preInstall.sh +++ b/cmake/preInstall.sh @@ -4,6 +4,7 @@ mkdir -p ${DST}/plug/protocol/ mkdir -p ${DST}/etc/ touch ${DST}/plug/conflist.inf touch ${DST}/etc/entrylist.conf + if [[ -z `grep -rn 'dns.inf' ${DST}/plug/conflist.inf` ]];then sed -i '/\[protocol\]/a\./plug/protocol/dns/dns.inf' ${DST}/plug/conflist.inf fi diff --git a/cmake/preUninstall.sh b/cmake/preUninstall.sh index 94ddb0d..5271e06 100644 --- a/cmake/preUninstall.sh +++ b/cmake/preUninstall.sh @@ -1,9 +1,12 @@ #!/bin/sh if [ $1 == 0 ]; then DST=${RPM_INSTALL_PREFIX} - - mkdir -p ${DST}/plug/business/ + + mkdir -p ${DST}/plug/protocol/ touch ${DST}/plug/conflist.inf + + mkdir -p ${DST}/etc/ + touch ${DST}/etc/entrylist.conf sed -i '/dns.inf/d' ${DST}/plug/conflist.inf sed -i '/DNS/d' ${DST}etc/entrylist.conf diff --git a/include/dns.h b/include/dns.h index ed7512e..ed46f81 100644 --- a/include/dns.h +++ b/include/dns.h @@ -303,17 +303,18 @@ enum flag_id { /* ֶʱԶͷϢ */ DNS_UNKOWN =0, - DNS_ALL = 1<<0, /* ȫ */ - DNS_REQ_ALL = 1<<1, /* ȫ */ - DNS_RES_ALL = 1<<2, /* Ӧȫ */ - DNS_REQ_HDR = 1<<3, /* ͷ */ - DNS_RES_HDR = 1<<4, /* Ӧͷ */ - //DNS_REQ_QUERY = 1<<5, /* ӦеϢ(ѯϢԶͷΪDNS_REQ_ALL_FLAG_IDûҪһֵ) */ - DNS_RES_QUERY = 1<<6, /* ӦеϢ */ - DNS_RES_RRS = 1<<7, /* ӦԴ¼ */ - DNS_RES_ANSWER = 1<<8, /* answerӦ¼ */ - DNS_RES_AUTH = 1<<9, /* ȨԴ¼ */ - DNS_RES_ADD = 1<<10, /* ⸽Դ¼ */ + ALL = 1<<0, /* ȫ */ + DNS_ALL = 1<<1, /* ȫ */ + DNS_REQ_ALL = 1<<2, /* ȫ */ + DNS_RES_ALL = 1<<3, /* Ӧȫ */ + DNS_REQ_HDR = 1<<4, /* ͷ */ + DNS_RES_HDR = 1<<5, /* Ӧͷ */ + //DNS_REQ_QUERY = 1<<6, /* ӦеϢ(ѯϢԶͷΪDNS_REQ_ALL_FLAG_IDûҪһֵ) */ + DNS_RES_QUERY = 1<<7, /* ӦеϢ */ + DNS_RES_RRS = 1<<8, /* ӦԴ¼ */ + DNS_RES_ANSWER = 1<<9, /* answerӦ¼ */ + DNS_RES_AUTH = 1<<10, /* ȨԴ¼ */ + DNS_RES_ADD = 1<<11, /* ⸽Դ¼ */ }; diff --git a/src/dns.cpp b/src/dns.cpp index 5cb4f38..f38b53c 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -68,6 +68,7 @@ g_dns_proto_info_t g_dns_proto_info; static dns_str_contrast_id_t DNS_FLAG_ID[] = { + {"ALL", DNS_ALL}, {"DNS_ALL", DNS_ALL}, {"DNS_REQ_ALL", DNS_REQ_ALL}, {"DNS_RES_ALL", DNS_RES_ALL}, @@ -1263,23 +1264,6 @@ int callback_dns_business_plug(struct streaminfo *a_stream, void **pme, void *in { app_state=APP_STATE_DROPPKT; } - - if(state&PROT_STATE_DROPME) - { - if(app_state&APP_STATE_DROPPKT) - { - app_state|=APP_STATE_DROPME; - } - else - { - app_state=APP_STATE_DROPME; - } - } - - if(state&PROT_STATE_GIVEME) - { - app_state=APP_STATE_GIVEME; - } return app_state; } @@ -1740,7 +1724,7 @@ int parse_dns_protocol(struct streaminfo *a_stream, unsigned char opstate, char } ret=callback_dns_business_plug(a_stream, pme, (void *)&dns_info, DNS_ALL, session_state, thread_seq, a_packet); - if(ret&APP_STATE_DROPME || ret&APP_STATE_DROPPKT) + if(ret&APP_STATE_DROPPKT) { return ret; } @@ -2030,7 +2014,7 @@ int DNS_INIT() *****************************************************************************/ void DNS_DESTROY() { - printf("Hello! This is dns.so PROT_DESTORY, but i am not complete!!!\n"); + return ; } -- cgit v1.2.3