Skip to content

Preserve partial bytes in route information prefixes - #35

Open
omrzk wants to merge 1 commit into
mdlayher:mainfrom
omrzk:fix/preserve-route-prefix-bits
Open

omrzk wants to merge 1 commit into
mdlayher:mainfrom
omrzk:fix/preserve-route-prefix-bits

Conversation

@omrzk

@omrzk omrzk commented Nov 16, 2026

Copy link
Copy Markdown

Route Information decoding currently rounds the prefix length down to whole bytes. A valid advertised 2001:db8:1234:56ff:8000::/65, for example, becomes 2001:db8:1234:56ff::/65 after ParseMessage, so consumers (including the ndp CLI) see a different route.

Copy the encoded prefix and mask off only the reserved bits after the advertised prefix length, as required by RFC 4191 section 2.3. Add raw Router Advertisement regressions covering all 0–128 prefix lengths, permitted padded encodings and nonzero reserved bits, while checking the following MTU option, preference and lifetime.

Validation: 130 new cases fail on current main; all 195 pass with the fix. Full go test -race -tags gofuzz ./... passes on Go 1.20.14 and Go 1.26.10; build, vet, Staticcheck and formatting checks pass. These are raw packet fixtures and ordinary local tests; privileged socket integration and a 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