Develop 20.08

This commit is contained in:
刘学利
2020-08-24 13:57:54 +08:00
parent 40fa047be1
commit 4e7788bf4c
5 changed files with 26 additions and 18 deletions

View File

@@ -12,6 +12,7 @@
1 GROUP_COMPILE_RELATION group2compile --
2 GROUP_GROUP_RELATION group2group --
3 TSG_OBJ_IP_ADDR ip_plus UTF8 UTF8 no 0
3 TSG_OBJ_IP_LEARNING_ADDR ip_plus UTF8 UTF8 no 0
4 TSG_OBJ_SUBSCRIBER_ID expr UTF8 UTF8 yes 0
5 TSG_OBJ_ACCOUNT expr UTF8 UTF8 yes 0
6 TSG_OBJ_URL expr UTF8 UTF8/GBK yes 0
@@ -57,3 +58,9 @@
45 TSG_SECURITY_DESTINATION_ASN virtual TSG_OBJ_AS_NUMBER --
46 TSG_SECURITY_SOURCE_LOCATION virtual TSG_OBJ_GEO_LOCATION --
47 TSG_SECURITY_DESTINATION_LOCATION virtual TSG_OBJ_GEO_LOCATION --
48 PXY_TCP_OPTION_COMPILE compile escape --
49 PXY_TCP_OPTION_SOURCE_ADDR virtual TSG_OBJ_IP_ADDR --
50 PXY_TCP_OPTION_DESTINATION_ADDR virtual TSG_OBJ_IP_ADDR --
51 PXY_TCP_OPTION_SERVER_FQDN virtual TSG_OBJ_FQDN --
52 PXY_TCP_OPTION_ADDR composition {"source":"PXY_TCP_OPTION_SOURCE_ADDR","destination":"PXY_TCP_OPTION_DESTINATION_ADDR"}

View File

@@ -18,6 +18,7 @@ typedef enum _tld_type
TLD_TYPE_STRING,
TLD_TYPE_FILE,
TLD_TYPE_TOPIC,
TLD_TYPE_CJSON, // cJSON *object
TLD_TYPE_MAX
}TLD_TYPE;

View File

@@ -42,7 +42,7 @@ static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
#endif
char TSG_MASTER_VERSION_20200724=0;
char TSG_MASTER_VERSION_20200805=0;
const char *tsg_conffile="tsgconf/main.conf";
g_tsg_para_t g_tsg_para;
@@ -425,19 +425,19 @@ static int identify_application_protocol(struct streaminfo *a_stream, struct _id
identify_info->proto = PROTO_UNKONWN;
//http
char *host=NULL;
ret=http_host_parser((char *)a_stream->ptcpdetail->pdata, (unsigned int)a_stream->ptcpdetail->datalen, DIR_C2S, &host);
ret=http_host_parser((char *)a_stream->ptcpdetail->pdata, (unsigned int)a_stream->ptcpdetail->datalen, a_stream->curdir, &host);
if(ret>=0)
{
identify_info->proto=PROTO_HTTP;
if(ret==0)
{
identify_info->domain_len=0;
}
else
if(ret>0 && host!=NULL)
{
identify_info->domain_len=MIN(ret, (int)sizeof(identify_info->domain) - 1);
strncpy(identify_info->domain, host, identify_info->domain_len);
}
else
{
identify_info->domain_len=0;
}
return 1;
}

View File

@@ -19,7 +19,7 @@
#include "tsg_send_log.h"
#include "tsg_send_log_internal.h"
char TSG_SEND_LOG_VERSION_20200724=0;
char TSG_SEND_LOG_VERSION_20200729=0;
struct tsg_log_instance_t *g_tsg_log_instance;
@@ -113,6 +113,9 @@ int TLD_append(struct TLD_handle_t *handle, char *key, void *value, TLD_TYPE typ
case TLD_TYPE_STRING:
cJSON_AddStringToObject(_handle->object, key, (char *)value);
break;
case TLD_TYPE_CJSON:
cJSON_AddItemToObject(_handle->object, key, (cJSON *)value);
break;
default:
return -1;
break;
@@ -206,9 +209,9 @@ int set_common_field_from_label(struct tsg_log_instance_t *_instance, struct TLD
if(internal_label->client_location!=NULL)
{
location=internal_label->client_location;
snprintf(buff, sizeof(buff), "%s,%s,%s", (memcmp(location->city_full, "null", 4) ? "" : location->city_full),
(memcmp(location->province_full, "null", 4) ? "" : location->province_full),
(memcmp(location->country_full, "null", 4) ? "" : location->country_full)
snprintf(buff, sizeof(buff), "%s,%s,%s", (!(memcmp(location->city_full, "null", 4)) ? "" : location->city_full),
(!(memcmp(location->province_full, "null", 4)) ? "" : location->province_full),
(!(memcmp(location->country_full, "null", 4)) ? "" : location->country_full)
);
TLD_append(_handle, _instance->id2field[LOG_COMMON_CLINET_LOCATION].name, (void *)buff, TLD_TYPE_STRING);
}
@@ -216,9 +219,9 @@ int set_common_field_from_label(struct tsg_log_instance_t *_instance, struct TLD
if(internal_label->server_location!=NULL)
{
location=internal_label->server_location;
snprintf(buff, sizeof(buff), "%s,%s,%s", (memcmp(location->city_full, "null", 4) ? "" : location->city_full),
(memcmp(location->province_full, "null", 4) ? "" : location->province_full),
(memcmp(location->country_full, "null", 4) ? "" : location->country_full)
snprintf(buff, sizeof(buff), "%s,%s,%s", (!(memcmp(location->city_full, "null", 4)) ? "" : location->city_full),
(!(memcmp(location->province_full, "null", 4)) ? "" : location->province_full),
(!(memcmp(location->country_full, "null", 4)) ? "" : location->country_full)
);
TLD_append(_handle, _instance->id2field[LOG_COMMON_SERVER_LOCATION].name, (void *)buff, TLD_TYPE_STRING);
}

View File

@@ -2,10 +2,7 @@ VERS_2.4{
global:
extern "C++" {
g_*;
*TSG_MASTER_INIT*;
*TSG_MASTER_TCP_ENTRY*;
*TSG_MASTER_UDP_ENTRY*;
*TSG_MASTER_UNLOAD*;
*TSG_MASTER*;
*tsg_scan_nesting_addr*;
*tsg_pull_policy_result*;
*tsg_*;