diff options
| author | root <[email protected]> | 2024-02-26 07:24:58 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-02-26 07:24:58 +0000 |
| commit | 0bae12016ed42ec2f0968a234f096d2f64f79708 (patch) | |
| tree | 2fa39ea4b4fc6d29b0d77f7bbb96cb9769119e78 | |
| parent | eb81762de33118cc8619452c517fc56f8b278d5a (diff) | |
TSG-19517: 对于disabled状态的rule,TCP纯控制报文不计入界面的流量统计
| -rw-r--r-- | shaping/src/shaper.cpp | 5 | ||||
| -rw-r--r-- | shaping/src/shaper_stat.cpp | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp index 59dbf53..0092ae2 100644 --- a/shaping/src/shaper.cpp +++ b/shaping/src/shaper.cpp @@ -1048,6 +1048,9 @@ static void shaper_token_consume_force(struct shaping_flow *sf, struct metadata for (int i = 0; i < sf->rule_num; i++) { rule = &sf->matched_rule_infos[i]; + if (!rule->is_enabled) { + continue; + } shaper_deposit_token_get(&rule->primary, meta->raw_len * 8, meta->dir, rule->primary.priority, 1); } @@ -1281,7 +1284,7 @@ void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx) } shaper_global_stat_throughput_rx_inc(&ctx->thread_global_stat, meta.raw_len); - if (meta.is_ctrl_pkt || !sf) {//ctrl pkt need send directly + if (meta.is_ctrl_pkt || !sf || sf->rule_num == 0) {//ctrl pkt need send directly marsio_send_burst(ctx->marsio_info->mr_path, ctx->thread_index, &rx_buff[i], 1); shaper_global_stat_throughput_tx_inc(&ctx->thread_global_stat, meta.raw_len); } else { diff --git a/shaping/src/shaper_stat.cpp b/shaping/src/shaper_stat.cpp index 808abd1..8b8d2ea 100644 --- a/shaping/src/shaper_stat.cpp +++ b/shaping/src/shaper_stat.cpp @@ -334,6 +334,9 @@ void shaper_stat_forward_all_rule_inc(struct shaping_stat *stat, struct shaping_ for (i = 0; i < sf->rule_num; i++) { rule = &sf->matched_rule_infos[i]; + if (!rule->is_enabled) { + continue; + } shaper_stat_forward_inc(&rule->primary.stat, direction, pkt_len, thread_id); } |
