summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2019-12-24 14:39:28 +0800
committerliuxueli <[email protected]>2019-12-24 14:39:28 +0800
commit5feb1c790d46ef09230dd0cbe88a9f8e0b80fc9d (patch)
tree2783982dc887d67d00f21c21f73de15916192260 /src/dns.cpp
parentd65b4f2d02bb4c6789f6788f1ae2f9126968d805 (diff)
修复对上层业务返回值判断逻辑错误,在串联环境下上层业务返回PROT_STATE_DROPPKT|PORT_STATE_DROPME时,解析层仅返回APP_STATE_DROPPKT,已修复
使用git自动打版本号
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 5b4dc15..ac1eea7 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -31,7 +31,28 @@
#include "dns.h"
#include "dns_internal.h"
-int DNS_PROTOCOL_VERSION_20191204;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define GIT_VERSION_CATTER(v) __attribute__((__used__)) const char * GIT_VERSION_##v = NULL
+#define GIT_VERSION_EXPEND(v) GIT_VERSION_CATTER(v)
+
+/* VERSION TAG */
+#ifdef GIT_VERSION
+GIT_VERSION_EXPEND(GIT_VERSION);
+#else
+static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
+#endif
+#undef GIT_VERSION_CATTER
+#undef GIT_VERSION_EXPEND
+
+#ifdef __cplusplus
+}
+#endif
+
+int DNS_PROTOCOL_VERSION_20191224;
unsigned long long dns_register_flag = 0;
unsigned short dns_plugid = 0;
static pthread_mutex_t dns_lock;
@@ -1230,7 +1251,8 @@ int get_rr_common_field(char *msg, char **ptr, dns_rr_t *rr, char *end)
int callback_dns_business_plug(struct streaminfo *a_stream, void **pme, void *info, int prot_flag, int session_state, int thread_seq, void *a_packet)
{
- char state=APP_STATE_GIVEME;
+ char state=PROT_STATE_GIVEME;
+ char app_state=APP_STATE_GIVEME;
stSessionInfo sessionInfo;
save_dns_business_info_t *apme = (save_dns_business_info_t *)*pme;
@@ -1244,27 +1266,27 @@ int callback_dns_business_plug(struct streaminfo *a_stream, void **pme, void *in
if(state&PROT_STATE_DROPPKT)
{
- state=APP_STATE_DROPPKT;
+ app_state=APP_STATE_DROPPKT;
}
if(state&PROT_STATE_DROPME)
{
- if(state&APP_STATE_DROPPKT)
+ if(app_state&APP_STATE_DROPPKT)
{
- state|=APP_STATE_DROPME;
+ app_state|=APP_STATE_DROPME;
}
else
{
- state=APP_STATE_DROPME;
+ app_state=APP_STATE_DROPME;
}
}
if(state&PROT_STATE_GIVEME)
{
- state=APP_STATE_GIVEME;
+ app_state=APP_STATE_GIVEME;
}
- return state;
+ return app_state;
}
int get_dns_query_question(char *msg, char **ptr, dns_query_question_t *q, char *end)