feature:TSG-9539:kni新增cmsg字段支持4级或以上定位库

This commit is contained in:
fumingwei
2022-02-08 16:14:10 +08:00
parent cc234d4a1c
commit d1df1bd8a6
3 changed files with 20 additions and 0 deletions

View File

@@ -76,6 +76,8 @@ enum tfe_cmsg_tlv_type
TFE_CMSG_DST_IP_LOCATION_PROVINE, // string max size 256
TFE_CMSG_SRC_IP_LOCATION_CITY, // string max size 256
TFE_CMSG_DST_IP_LOCATION_CITY, // string max size 256
TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION,
TFE_CMSG_DST_IP_LOCATION_SUBDIVISION,
//ja3 fingerprint
TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT,
//fqdn cat id

View File

@@ -248,6 +248,8 @@ void tfe_cmsg_enum_to_string()
tfe_cmsg_tlv_type_to_string[TFE_CMSG_DST_IP_LOCATION_PROVINE] = "TFE_CMSG_DST_IP_LOCATION_PROVINE";
tfe_cmsg_tlv_type_to_string[TFE_CMSG_SRC_IP_LOCATION_CITY] = "TFE_CMSG_SRC_IP_LOCATION_CITY";
tfe_cmsg_tlv_type_to_string[TFE_CMSG_DST_IP_LOCATION_CITY] = "TFE_CMSG_DST_IP_LOCATION_CITY";
tfe_cmsg_tlv_type_to_string[TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION] = "TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION";
tfe_cmsg_tlv_type_to_string[TFE_CMSG_DST_IP_LOCATION_SUBDIVISION] = "TFE_CMSG_DST_IP_LOCATION_SUBDIVISION";
tfe_cmsg_tlv_type_to_string[TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT] = "TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT";
tfe_cmsg_tlv_type_to_string[TFE_CMSG_FQDN_CAT_ID_NUM] = "TFE_CMSG_FQDN_CAT_ID_NUM";

View File

@@ -378,6 +378,8 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
if(ret < 0) break;
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SRC_IP_LOCATION_CITY, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
if(ret < 0) break;
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
if(ret < 0) break;
}
else
{
@@ -399,6 +401,12 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SRC_IP_LOCATION_CITY, (const unsigned char*)session_attribute->client_location->city_full, strlen(session_attribute->client_location->city_full), pmeinfo);
}
if(ret < 0) break;
if(session_attribute->client_location->subdivision_addr == NULL){
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
}else{
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION, (const unsigned char*)session_attribute->client_location->subdivision_addr, strlen(session_attribute->client_location->subdivision_addr), pmeinfo);
}
if(ret < 0) break;
}
if(session_attribute->server_location == NULL)
@@ -409,6 +417,8 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
if(ret < 0) break;
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_DST_IP_LOCATION_CITY, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
if(ret < 0) break;
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_DST_IP_LOCATION_SUBDIVISION, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
if(ret < 0) break;
}
else
{
@@ -430,6 +440,12 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_DST_IP_LOCATION_CITY, (const unsigned char*)session_attribute->server_location->city_full, strlen(session_attribute->server_location->city_full), pmeinfo);
}
if(ret < 0) break;
if(session_attribute->server_location->subdivision_addr == NULL){
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_DST_IP_LOCATION_SUBDIVISION, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
}else{
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_DST_IP_LOCATION_SUBDIVISION, (const unsigned char*)session_attribute->server_location->subdivision_addr, strlen(session_attribute->server_location->subdivision_addr), pmeinfo);
}
if(ret < 0) break;
}
if(session_attribute->ja3_fingerprint == NULL)
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);