Skip to content

Preserve full NDP option lengths during encoding and parsing - #36

Open
omrzk wants to merge 1 commit into
mdlayher:mainfrom
omrzk:fix/long-option-lengths
Open

omrzk wants to merge 1 commit into
mdlayher:mainfrom
omrzk:fix/long-option-lengths

Conversation

@omrzk

@omrzk omrzk commented Nov 17, 2026

Copy link
Copy Markdown

Valid NDP options of 256 bytes or more fail to encode or parse because RawOption multiplies its eight-bit length before converting it to int. Captive Portal, Nonce and RA Flags Extension encoding also narrows the byte count before converting to eight-byte units. For example, NewCaptivePortal accepts a 247-byte HTTPS URI, but MarshalMessage returns unexpected EOF for it.

Perform the byte arithmetic at integer width and narrow only the final unit count. Add public Router Advertisement regressions for every wire length from 8 to 2040 bytes, the constructor URI boundary, long typed options, padding and a following MTU option. Mismatched lengths, truncation and oversized options remain rejected.

Validation: the final regressions fail on current main for all 224 raw option lengths of at least 256 bytes, nine constructor-valid URI lengths and long typed options. Full go test -race -tags gofuzz -count=1 ./... passes on Go 1.20.14 and Go 1.26.10; vet, Staticcheck, build and formatting checks pass. These are packet fixtures and ordinary local tests; privileged socket integration and live router deployment were not run.

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