diff options
| author | liuxueli <[email protected]> | 2023-08-22 15:04:26 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2023-08-22 15:21:22 +0800 |
| commit | e3d38bfc5b4ab3ed28f36e8a9b4a8a7446feaaaa (patch) | |
| tree | b1f604bd61b3977985c94f57b4fe5e0e5ed5f399 | |
| parent | ff14e14afa36b5afaef14cabbbd372075cfceaf7 (diff) | |
修复http url中包含冒号未命中策略的问题
| -rw-r--r-- | src/tsg_entry.cpp | 3 | ||||
| -rw-r--r-- | src/tsg_rule.cpp | 15 | ||||
| -rw-r--r-- | src/tsg_rule_internal.h | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/tsg_entry.cpp b/src/tsg_entry.cpp index c082489..491e0d6 100644 --- a/src/tsg_entry.cpp +++ b/src/tsg_entry.cpp @@ -2121,8 +2121,7 @@ size_t session_pending_state_deal(const struct streaminfo *a_stream, struct sess if(srt_process_context->proto==PROTO_HTTP && srt_process_context->http_url!=NULL) { - table_idx=tsg_http_url_table_idx_get(); - matched_cnt+=tsg_scan_shared_policy(a_stream, g_tsg_maat_feather, srt_process_context->http_url, table_idx, (srt_process_context->mid), matched_rules+matched_cnt, n_matched_rules-matched_cnt); + matched_cnt+=tsg_scan_http_url_policy(a_stream, g_tsg_maat_feather, srt_process_context->http_url, (srt_process_context->mid), matched_rules+matched_cnt, n_matched_rules-matched_cnt); } session_app_gather_results_set_l7_protocol(a_stream, app_id, n_offset); diff --git a/src/tsg_rule.cpp b/src/tsg_rule.cpp index f2ec737..4f1068d 100644 --- a/src/tsg_rule.cpp +++ b/src/tsg_rule.cpp @@ -2652,6 +2652,16 @@ size_t tsg_scan_shared_policy(const struct streaminfo *a_stream, struct maat *fe return tsg_scan_string(a_stream, feather, domain, fqdn_len, (enum MAAT_SCAN_TB)idx, s_mid, matched_rules, n_matched_rules); } +size_t tsg_scan_http_url_policy(const struct streaminfo *a_stream, struct maat *feather, char *url, struct maat_state *s_mid, struct maat_rule *matched_rules, size_t n_matched_rules) +{ + if(url==NULL || matched_rules==NULL || n_matched_rules==0) + { + return 0; + } + + return tsg_scan_string(a_stream, feather, url, strlen(url), MAAT_SCAN_HTTP_URL, s_mid, matched_rules, n_matched_rules); +} + size_t tsg_scan_session_flags(const struct streaminfo *a_stream, struct maat *feather, unsigned long flag, struct maat_state *s_mid, struct maat_rule *matched_rules, size_t n_matched_rules) { return tsg_scan_flags(a_stream, feather, flag, MAAT_SCAN_SESSION_FLAGS, s_mid, matched_rules, n_matched_rules); @@ -3115,11 +3125,6 @@ int tsg_fqdn_category_table_idx_get(enum TSG_PROTOCOL proto) return -1; } -int tsg_http_url_table_idx_get(void) -{ - return MAAT_SCAN_HTTP_URL; -} - int tsg_session_record_switch_get(void) { return g_tsg_maat_rt_para.session_record_switch; diff --git a/src/tsg_rule_internal.h b/src/tsg_rule_internal.h index 3011b5a..d3f83be 100644 --- a/src/tsg_rule_internal.h +++ b/src/tsg_rule_internal.h @@ -152,7 +152,6 @@ char *tsg_device_tag_get(void); int tsg_session_record_switch_get(void); int tsg_domain_table_idx_get(enum TSG_PROTOCOL proto); int tsg_fqdn_category_table_idx_get(enum TSG_PROTOCOL proto); -int tsg_http_url_table_idx_get(void); long long tsg_default_compile_id_get(void); @@ -162,6 +161,7 @@ int tsg_get_app_name_by_id(struct maat *feather, int app_id, char *app_name, int size_t tsg_scan_session_flags(const struct streaminfo *a_stream, struct maat *feather, unsigned long flag, struct maat_state *s_mid, struct maat_rule *results, size_t n_results); size_t tsg_scan_app_id_policy(const struct streaminfo *a_stream, struct maat *feather, unsigned int app_id, struct maat_state *s_mid, struct maat_rule *results, size_t n_results); size_t tsg_scan_shared_policy(const struct streaminfo *a_stream, struct maat *feather, char *domain, int idx, struct maat_state *s_mid, struct maat_rule *results, size_t n_results); +size_t tsg_scan_http_url_policy(const struct streaminfo *a_stream, struct maat *feather, char *url, struct maat_state *s_mid, struct maat_rule *matched_rules, size_t n_matched_rules); size_t tsg_scan_tunnel_id(const struct streaminfo *a_stream, struct maat *feather, struct maat_rule *results, size_t n_results, struct maat_state *s_mid, long long *bool_id_array, size_t n_bool_id_array); size_t tsg_scan_fqdn_category_id(const struct streaminfo * a_stream, struct maat *feather, unsigned int *category_id, int category_id_num, int table_idx, struct maat_state *s_mid, struct maat_rule *results, size_t n_results); size_t tsg_scan_app_properties_policy(const struct streaminfo *a_stream, struct maat *feather, char *property, int property_len, char *district, int district_len, struct maat_state *s_mid, struct maat_rule *matched_rules, int n_matched_rules); |
