阻断方式由总控提供函数接口实现

This commit is contained in:
liuxueli
2019-12-20 11:09:56 +08:00
parent 2c249d6716
commit f4a4fff3c1
3 changed files with 6 additions and 34 deletions

View File

@@ -11,40 +11,12 @@
#include "tsg_rule.h"
#include "tsg_send_log.h"
#include "fw_dns_plug.h"
#include "tsg_statistic.h"
char *g_fw_dns_conffile=(char *)"tsgconf/main.conf";
char FW_DNS_PLUG_VERSION_20191209=0;
char FW_DNS_PLUG_VERSION_20191220=0;
struct _fw_dns_plug g_fw_dns_plug_info;
enum TSG_ETHOD_TYPE
{
TSG_METHOD_TYPE_UNKNOWN=0,
TSG_METHOD_TYPE_DROP,
TSG_METHOD_TYPE_REDIRECTION,
TSG_METHOD_TYPE_MAX
};
const struct _str2index method2index[TSG_METHOD_TYPE_MAX]={ {TSG_METHOD_TYPE_UNKNOWN, 7, (char *)"unknown"},
{TSG_METHOD_TYPE_DROP, 4, (char *)"drop"},
{TSG_METHOD_TYPE_REDIRECTION, 8, (char *)"redirect"}
};
int tsg_get_method_id(char *method)
{
int i=0;
for(i=0; i<TSG_METHOD_TYPE_MAX; i++)
{
if(method2index[i].len==(int)strlen(method) && (strncasecmp(method2index[i].type, method, method2index[i].len))==0)
{
return method2index[i].index;
}
}
return -1;
}
static int get_answer_ttl(cJSON *object)
{
int min=0;
@@ -354,7 +326,7 @@ static int fw_dns_send_log(struct streaminfo *a_stream, dns_info_t *dns_info, st
log_msg.result_num=result_num;
tsg_send_log(g_tsg_log_instance, handle, &log_msg, thread_seq);
tsg_set_policy_flow(a_stream, result, a_stream->threadnum);
return 0;
}

View File

@@ -15,7 +15,7 @@
fw_dns_rule_t g_fw_dns_rule_info;
char FW_DNS_RULE_VERSION_20191201=0;
struct _str2index str2index[]={{DNS_TYPE_CNAME, 5, (char *)"CNAME"},
struct _dns_str2idx str2index[]={{DNS_TYPE_CNAME, 5, (char *)"CNAME"},
{DNS_TYPE_MX, 2, (char *)"MX"},
{DNS_TYPE_A, 1, (char *)"A"},
{DNS_TYPE_NS, 2, (char *)"NS"},
@@ -28,7 +28,7 @@ int fw_dns_type2index(char *type)
{
int i=0;
for(i=0; i<(int)(sizeof(str2index)/sizeof(struct _str2index)); i++)
for(i=0; i<(int)(sizeof(str2index)/sizeof(struct _dns_str2idx)); i++)
{
if(str2index[i].len==(int)strlen(type) && (strncasecmp(str2index[i].type, type, str2index[i].len))==0)
{

View File

@@ -5,7 +5,7 @@
#define MAX_TABLE_NAME_LEN 32
struct _str2index
struct _dns_str2idx
{
int index;
int len;