Repository navigation
fix(pcapng): correct flags-option length messages and IPv6 maker defaults (#2168) - #2179
Merged
Merged
Conversation
…ults (#2168) Problem: the epb_flags and pack_flags readers reject any length but 4, yet their error said "expected 8". The IPv6 NRB makers defaulted to IPv4 addresses, so making an nrb_record_ipv6 record or an ns_dnsIP6addr option without an address raised FieldValueError (IP version mismatch: 4 != 6). Fix: both messages say "expected 4". _make_option_ns_dnsipv6 defaults to 2001:4860:4860::8888 and _make_record_ipv6 to ::1. These mirror the IPv4 makers: ns_dnsIP4addr defaults to 8.8.8.8, a public DNS server, and 2001:4860:4860::8888 is that same service's IPv6 address; the IPv4 record defaults to the 127.0.0.1 loopback, and ::1 is the IPv6 loopback. Test: test_pcapng_flags_length_ipv6_defaults_2168_unit pins both messages and makes each IPv6 record and option with its default, then parses and rebuilds it byte-exactly.
Owner
Author
|
Review: GOOD TO GO at |
Owner
Author
|
Ready to merge at
|
Contributor
|
Coverage: 91.55% (unit tier, Python 3.15,
Per-file detail: the |
5 tasks done
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.
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectDescription
Closes #2168.
PCAPNG._read_option_epb_flagsand_read_option_pack_flagsreject any length other than 4, but their error said "expected 8". Onmain, a length-8 option gaveinvalid length (expected 8, got 8). Both now say "expected 4"._make_option_ns_dnsipv6defaulted to'8.8.8.8'and_make_record_ipv6to'127.0.0.1', so making either without an address raisedFieldValueError: IP version mismatch: 4 != 6. The new defaults mirror the IPv4 ones:2001:4860:4860::8888for the option, the IPv6 address of the same public DNS server as8.8.8.8;::1for the record, the IPv6 loopback.tests/protocols/misc/test_pcapng_flags_length_ipv6_defaults_2168_unit.py, tierALL. It checks both messages, and builds each IPv6 record and option without an address: the parsed address is right and the rebuild is byte for byte. Without the fix it fails 4 tests, on the two messages and on the IP version mismatch twice.