Skip to content

feat: packet_segmentation_reassembly supports configurable port ranges#11458

Merged
yuanchaoa merged 1 commit intomainfrom
support-port-range-9j12f
Mar 16, 2026
Merged

feat: packet_segmentation_reassembly supports configurable port ranges#11458
yuanchaoa merged 1 commit intomainfrom
support-port-range-9j12f

Conversation

@yuanchaoa
Copy link
Contributor

This PR is for:

  • Agent

@yuanchaoa yuanchaoa force-pushed the support-port-range-9j12f branch 2 times, most recently from a7bd75a to b6ad0e1 Compare March 13, 2026 02:35
@yuanchaoa yuanchaoa enabled auto-merge (rebase) March 13, 2026 02:37
@yuanchaoa
Copy link
Contributor Author

@claude review一下这份提交的代码修改,看看是否有bug或实现缺陷

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @yuanchaoa's task in 31m 11s —— View job


Progress

  • Read repository guidelines (CLAUDE.md) — none found
  • Review PR changes and relevant files
  • Provide review feedback

Review summary

The range parsing logic is a good direction, but the current config schema and parser introduce backward-compatibility and documented‑usage breakages. These will cause valid existing configs (and the new README example) to fail to load or silently do nothing.

Findings

  1. Backward compatibility regression for existing numeric lists

    • Where: agent/src/config/config.rs:899-903
    • Issue: packet_segmentation_reassembly is now Vec<String> with no custom deserializer. serde_yaml does not coerce numeric YAML items into strings, so configs like packet_segmentation_reassembly: [80, 443] (previously valid) will fail to deserialize entirely.
    • Suggestion: Add a custom deserializer that accepts ints or strings (and also supports scalar comma‑separated strings) and normalizes to a string list.
    • Fix this →
  2. Comma‑separated range example doesn’t parse

    • Where: agent/src/config/handler.rs:539-565
    • Issue: The parser only accepts one port or one start-end range per list item. The README example 1000,2000-2010,5000 (and any single string containing commas) will fail to parse and be ignored.
    • Suggestion: Split each entry on commas before parsing, or reuse parse_u16_range_list_to_bitmap to handle commas/ranges robustly.
    • Fix this →

Tests

  • Not run (review only)

@yuanchaoa yuanchaoa force-pushed the support-port-range-9j12f branch from b6ad0e1 to 9d715a1 Compare March 13, 2026 06:18
@yuanchaoa
Copy link
Contributor Author

@claude review一下这份提交的代码修改,看看是否有bug或实现缺陷;注意结果使用中文

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @yuanchaoa's task in 22m 2s —— View job


任务清单

  • 阅读仓库指南(CLAUDE.md,未发现)
  • 查看 PR diff 和相关代码
  • 总结审查结论并反馈(中文)

审查总结

整体思路可行,但当前配置解析/文档存在兼容性风险,可能导致既有配置加载失败或新示例无法生效。

发现的问题

  1. 已有数值列表配置会反序列化失败(兼容性回退)

    • 位置:agent/src/config/config.rs:899-903
    • 说明:字段改为 Vec<String> 后未加自定义反序列化。YAML 数字项不会自动转成字符串,之前有效的 packet_segmentation_reassembly: [80, 443] 会导致配置反序列化失败。
    • 建议:为该字段增加自定义 serde 反序列化,接受 int 或 string(最好也支持单个逗号分隔字符串),统一转成 Vec<String>
    • Fix this →
  2. 示例被理解为单字符串时无法解析

    • 位置:agent/src/config/handler.rs:541-565
    • 说明:当前解析逻辑只支持“每个列表元素为单端口或单范围”。若用户按 Type string 理解成单字符串(如 packet_segmentation_reassembly: "1000,2000-2010,5000"),现逻辑会把整串当作一个范围并失败,配置被忽略。
    • 建议:对每个条目再按逗号拆分,逐个解析;或复用 parse_u16_range_list_to_bitmap 的逻辑。
    • Fix this →

测试

  • 未运行(仅代码审查)

@yuanchaoa yuanchaoa force-pushed the support-port-range-9j12f branch from 9d715a1 to 495216c Compare March 13, 2026 06:51
@yuanchaoa
Copy link
Contributor Author

@claude review一下这份提交的代码修改,看看是否有bug或实现缺陷;注意结果使用中文

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @yuanchaoa's task in 10m 45s —— View job


任务清单

  • 阅读仓库指南(CLAUDE.md)
  • 查看 PR diff 和相关代码
  • 总结审查结论并反馈(中文)

审查总结

整体思路可行,但当前配置反序列化与解析逻辑存在兼容性/可用性缺口,可能导致既有配置无法加载或新示例配置失效。

发现的问题

  1. 已有数值列表配置会反序列化失败(兼容性回退)

    • 位置:agent/src/config/config.rs:899-903
    • 说明:字段改为 Vec<String> 后未加自定义反序列化。serde_yaml 不会把 YAML 数字自动转成字符串,之前有效的 packet_segmentation_reassembly: [80, 443] 会直接反序列化失败并导致配置整体加载失败。
    • 建议:为该字段增加自定义 deserializer,接受 int 或 string(最好也支持单个逗号分隔字符串),统一转为 Vec<String>
    • Fix this →
  2. 逗号分隔范围在当前解析中会被整串拒绝

    • 位置:agent/src/config/handler.rs:541-565
    • 说明:解析逻辑只支持“每个列表元素是单端口或单范围”。如果用户按 Type string 理解为单字符串(如 "1000,2000-2010,5000"),整串会当作一个范围解析失败并被忽略。
    • 建议:对每个条目再按逗号拆分逐个解析,或复用 parse_u16_range_list_to_bitmap
    • Fix this →

测试

  • 未运行(仅代码审查)

@yuanchaoa yuanchaoa force-pushed the support-port-range-9j12f branch from 495216c to bb4af27 Compare March 16, 2026 03:16
@yuanchaoa yuanchaoa merged commit 7b0f454 into main Mar 16, 2026
10 checks passed
@yuanchaoa yuanchaoa deleted the support-port-range-9j12f branch March 16, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants