Skip to content

Take a default route's family from rtm_family - #14920

Open
dany74q wants to merge 1 commit into
google:masterfrom
dany74q:newroute-gateway-family
Open

dany74q wants to merge 1 commit into
google:masterfrom
dany74q:newroute-gateway-family

Conversation

@dany74q

@dany74q dany74q commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

A route request without RTA_DST picked IPv4 or IPv6 from the length of RTA_GATEWAY and never read rtm_family, so AF_INET with a 16-byte gateway installed an IPv6 default route, AF_INET6 with a 4-byte gateway installed an IPv4 one, and a request with any other family was accepted. Linux dispatches the request on rtm_family and validates RTA_GATEWAY against the family it selects.

localRoute now takes a default route's family from rtm_family and answers EOPNOTSUPP when it is neither AF_INET nor AF_INET6. It refuses an RTA_GATEWAY shorter than that family's address with ERANGE and reads a longer one for its leading bytes, as Linux does. RTM_DELROUTE shares the parse and changes the same way. Routes with RTA_DST are unchanged.

Fixes google#14918
@dany74q
dany74q force-pushed the newroute-gateway-family branch from 97aed63 to 1401419 Compare September 28, 2026 18:32
@dany74q

dany74q commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

friendly ping @relkochta

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