Repository navigation
Conversation
#895) - `ESP.read`'s decrypted tail now returns the parsed header instead of calling `_decode_next_layer` when `extension=True`, matching the seven other IPv6 extension headers. `IPv6._decode_next_layer` walks the rest of the chain itself, so decoding it again here is discarded work. - `ESP._make_opaque` gets the same guard, consulting `self._extf` since it takes no `extension` parameter. It is the undecrypted return, reached from several places in `read`, so guarding only `read`'s tail would leave the common case — a capture taken without keys — unfixed. - New `test_esp_extension_short_circuit_895_unit.py` counts calls into `Internet._decode_next_layer` rather than asserting on output, since the change is work not done. Patching is on `Internet`, which defines the method; patching `ProtocolBase` intercepts nothing and reads zero. Verified: 5 new tests pass, and reverting either guard fails them — `1 != 0` on the call count, plus the family sweep naming `esp.py:1194`. `test_esp_unit`, `test_ah_unit`, `test_ipv6_ext_unit` and isort all green.
Owner
Author
|
Closed unmerged per the ruling on #895 — "okay, that makes sense now." ESP is an IPv6 extension header per IANA, but RFC 4303 puts its Next Header inside the encrypted trailer, so the chain walk cannot continue past it and the short-circuit loses every parsed inner layer rather than deferring the work. Measured: |
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.
Closes #895.
The maintainer's ruling: "i say the short-circuit must be done in
ESPcause it's part of the IPv6 extension headers."#924 discharged this issue's substantive half —
_extfbecame load-bearing, sopayload,protochainandprotocolconsult it. This is the other half: theif extension: returnguard its seven siblings all have before calling_decode_next_layer. When the header is one link of an IPv6 chain,IPv6._decode_next_layerwalks the rest of the chain itself, so decoding it again from inside the header produces a result nobody reads.ESPneeded the guard in two places, not one. The decrypted path returns atread's tail; every undecrypted path — no security association, wrong key, malformed trailer — returns through_make_opaqueinstead. Guarding onlyread's tail would leave the common case unfixed, since a capture taken without keys is the expected case rather than the rare one._make_opaquehas noextensionparameter, so it consultsself._extf, which__post_init__sets before handing off toread.Measured, patching
Internet— which is what actually defines_decode_next_layer; patchingProtocolBaseintercepts nothing and silently reads zero:Reverting both guards fails the new tests with
1 != 0and with the family sweep namingesp.py:1194.One note on the tests themselves: the family sweep pairs each
return self._decode_next_layer(with the two lines above it. A first draft merely looked forif extension:anywhere in the file and passed on unfixedESP, becauseESP.protocolalready consultsself._extffor an unrelated reason — true and useless. The committed version distinguishes a guarded return from an unguarded one.Verified: 5 new tests pass;
test_esp_unit,test_ah_unit,test_ipv6_ext_unitandtest_isort_cleangreen at 65 tests.fix