diff --git a/common/include/kni_cmsg.h b/common/include/kni_cmsg.h index 83294b8..d0a105b 100644 --- a/common/include/kni_cmsg.h +++ b/common/include/kni_cmsg.h @@ -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 diff --git a/common/src/kni_cmsg.cpp b/common/src/kni_cmsg.cpp index 4ba75f3..98954c0 100644 --- a/common/src/kni_cmsg.cpp +++ b/common/src/kni_cmsg.cpp @@ -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"; diff --git a/entry/src/kni_entry.cpp b/entry/src/kni_entry.cpp index 773cf95..729e1ff 100644 --- a/entry/src/kni_entry.cpp +++ b/entry/src/kni_entry.cpp @@ -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);