Repository navigation
fix(protocols): reject a jumbogram RFC 2675 calls an error (#1687) - #1713
Conversation
|
Verdict: GOOD TO GO at
|
|
CI is red on
Round 3 fixes the generator or the test, keeping coverage of the Jumbo option, and re-runs every test that reads these captures. The verdict resets on the new head. |
|
Coverage: 89.47% (unit tier, Python 3.15,
Per-file detail: the |
1914607 to
a4cf408
Compare
|
Verdict: GOOD TO GO at
|
|
CI is red on |
RFC 2675 section 3 lists four errors a receiver must detect. The default engine dissected each as a jumbogram, or warned and went on. - schema/internet/ipv6.py: jumbogram_error() names the error, if any: a Payload Length of 0 with a Hop-by-Hop header and no Jumbo Payload option; a non-zero Payload Length with the option; a Jumbo Payload Length below 65,536; the option with a Fragment header (asked of the caller's walk). - IPv6.read raises ProtocolError for the first three, and the extension header walk for the fourth, as IPv4.read rejects a bad version, so behind a link layer the frame stops at IPv6 and rebuilds as captured. - IPv6.make with no payload_length writes 0 when the payload's leading Hop-by-Hop header carries a Jumbo Payload option, so a genuine Jumbo Payload Length builds a jumbogram the parser accepts. - examples/generators/options.py: HOPOPT's Jumbo Payload frame, one of those errors, is a genuine jumbogram, Jumbo Payload Length 65,536 filled out by a UDP datagram whose RFC 1071 checksum it sums without scapy, in a capture whose snaplen does not cut it. - tests: each error on IPv6, behind Ethernet and at extraction; make->parse of a jumbogram; the generator's jumbogram, its datagram built with scapy blocked; adapter-test rows on now-invalid jumbograms dropped.
a4cf408 to
f927e8d
Compare
|
Verdict: GOOD TO GO at
|
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
RFC 2675 §3 lists four errors a receiver must detect: Payload Length 0 with a Hop-by-Hop header and no Jumbo Payload option; a non-zero Payload Length with the option; a Jumbo Payload Length below 65,536; the option with a Fragment header.
IPv6.readnow raisesProtocolErrorfor each, asIPv4.readrejects a bad version, so behind a link layer the frame stops at IPv6 and rebuilds byte for byte.jumbogram_error()inschema/internet/ipv6.pydefines all four. A capture cut before the Jumbo Payload option is rejected too (the first error), as the RFC has it. A capture cut after the option but short of its Jumbo Payload Length is still read as a jumbogram.This changes the default engine only. The dpkt, scapy, pyshark and pypcapfile adapters are untouched; they are best effort and need not match.
IPv6.makewithpayload_lengthunset now writes 0 when the payload's leading Hop-by-Hop header carries a Jumbo Payload option, so a genuine Jumbo Payload Length builds a jumbogram, and make->parse round-trips byte for byte. Input the caller made invalid still raises on construction: a Jumbo Payload Length ≤ 65,535, an explicit non-zeropayload_length, or a Fragment header.HOPOPTalone and in IPv4 is unchanged.examples/generators/options.pybuilt HOPOPT's Jumbo Payload frame inoptions-ipv6.pcapwith Jumbo Payload Length 0 behind a non-zero Payload Length, now rejected, so the frame stopped at IPv6. It is now a genuine jumbogram: Payload Length 0, Jumbo Payload Length 65,536, filled out by a UDP datagram with a valid checksum, in a capture whose snaplen (262,144) lets libpcap readers take the 65,590-octet frame whole. The scapy engine reads only its first 65,535 octets (scapy's MTU, inPcapReader.recv); third-party engines are best effort.Tests: a new class in
test_ipv6_jumbogram_unit.py,tests/toolkit/test_pcap_jumbogram_rfc2675_1687_unit.py(default-engine extraction inputs) andtests/protocols/test_option_generator_jumbogram_1687_unit.py(the generator's jumbogram); all fail onorigin/main.test_option_coverage_runtime.pychecks the capture's jumbogram is read whole. Adapter tests drop the rows that compared an adapter with the default engine on a now-invalid jumbogram (#1708 cleans those files up). Only the related suites were run, on 3.14.8 and 3.11.15, not the whole suite.Closes #1687