test: add Scapy-backed advanced packet regression tests#48
Merged
Conversation
leodido
commented
May 3, 2026
leodido
commented
May 3, 2026
leodido
commented
May 3, 2026
leodido
commented
May 3, 2026
Required for advanced packet tests that craft IP options, fragments, and protocol-specific packets via Scapy. Co-authored-by: Ona <no-reply@ona.com>
test/scapy_packets.py: Python CLI with send/sniff subcommands. Uses L3 send (kernel handles Ethernet/routing). Supports packet types: tcp, udp, icmp, gre, fragment-first, fragment-subsequent. IP options (IHL > 5) via --ip-options flag. Unique IP ID per packet for deterministic sniffing. test/helpers.bash: start_sniffer, wait_sniffer, scapy_send, arp_prewarm, assert_packet_seen, assert_packet_blocked. Sniff timeout defaults to 2s, configurable via SCAPY_SNIFF_TIMEOUT. Co-authored-by: Ona <no-reply@ona.com>
…ivate_ipv4 13 test cases covering: - block_ipv4: IP options, first/subsequent fragments - block_port: IP options with matching/non-matching port, first fragment drop, subsequent fragment pass (fail-open) - block_private_ipv4: ICMP to private vs non-private, TCP-only SSH exemption (port 22), UDP port 22 drop, GRE drop, fragment handling Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
f8c5a01 to
b684cd2
Compare
fntlnz
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add 13 test cases covering IP options (IHL > 5), first/subsequent
fragment handling, ICMP subnet filtering, TCP-only SSH exemption,
UDP/GRE blocking, and fail-open behavior for
block_*programs.Architecture
test/scapy_packets.py: Python helper withsend/sniffsubcommandstest/scapy.bats: Bats test file using existing veth+namespace topologytest/helpers.bash: sniffer lifecycle wrappers and packet assertionsTests judge allow/block by wire visibility on the host-side veth,
not application-level behavior. Each packet uses a unique IP ID for
deterministic sniffing. Sniff timeout defaults to 2s, configurable
via
SCAPY_SNIFF_TIMEOUTenv var.Test cases
block_ipv4block_portblock_private_ipv4Infrastructure changes
.devcontainer/Dockerfileand both CI jobs (Ubuntu + Arch)