Skip to content

feat(flow): add ICMP echo flow extraction and correlation#27

Merged
AKOrojo merged 1 commit intomainfrom
feature/icmp_flow_extrat
Mar 5, 2026
Merged

feat(flow): add ICMP echo flow extraction and correlation#27
AKOrojo merged 1 commit intomainfrom
feature/icmp_flow_extrat

Conversation

@AKOrojo
Copy link
Contributor

@AKOrojo AKOrojo commented Mar 5, 2026

Implement stateful ICMP flow tracking in the conversation extraction engine:

  • New IcmpFlowState struct tracking echo request/reply pairs via identifier

    • Tracks icmp_type, icmp_code, identifier, request_count, reply_count, last_seq
    • Supports both ICMP and ICMPv6 (types 8/0, 128/129)
    • Non-echo ICMP types (error messages) tracked via (type, code) as port substitute
  • Update flow key extraction (key.rs):

    • Echo packets use identifier symmetrically (id, id) to ensure bidirectional canonicalization
    • Guarantees request and reply hash to same flow key regardless of direction
  • Extended ProtocolState enum with Icmp and Icmpv6 variants

  • Added ICMP packet processing to ConversationTable.ingest_packet()

  • Python API: new Conversation properties for ICMP fields (icmp_type, icmp_code, icmp_identifier, icmp_request_count, icmp_reply_count, icmp_last_seq)

All properties return None for non-ICMP flows for clean Python API.

Tests: 5 new ICMP-specific tests + all existing 19 flow tests pass

  • Echo request/reply correlation
  • Multiple sequences in same flow
  • Different identifiers create separate flows
  • Non-echo ICMP tracking
  • Python getters return None for non-ICMP

Implement stateful ICMP flow tracking in the conversation extraction engine:

- New IcmpFlowState struct tracking echo request/reply pairs via identifier
  - Tracks icmp_type, icmp_code, identifier, request_count, reply_count, last_seq
  - Supports both ICMP and ICMPv6 (types 8/0, 128/129)
  - Non-echo ICMP types (error messages) tracked via (type, code) as port substitute

- Update flow key extraction (key.rs):
  - Echo packets use identifier symmetrically (id, id) to ensure bidirectional canonicalization
  - Guarantees request and reply hash to same flow key regardless of direction

- Extended ProtocolState enum with Icmp and Icmpv6 variants
- Added ICMP packet processing to ConversationTable.ingest_packet()
- Python API: new Conversation properties for ICMP fields (icmp_type, icmp_code,
  icmp_identifier, icmp_request_count, icmp_reply_count, icmp_last_seq)

All properties return None for non-ICMP flows for clean Python API.

Tests: 5 new ICMP-specific tests + all existing 19 flow tests pass
- Echo request/reply correlation
- Multiple sequences in same flow
- Different identifiers create separate flows
- Non-echo ICMP tracking
- Python getters return None for non-ICMP
@AKOrojo AKOrojo merged commit ed06d5d into main Mar 5, 2026
1 check passed
@AKOrojo AKOrojo deleted the feature/icmp_flow_extrat branch March 5, 2026 03:38
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.

1 participant