Repository navigation
shared: use the scope of a link-local egress address - #4181
Merged
Merged
Conversation
added 2 commits
October 14, 2026 15:14
parse_numeric_addr() writes a struct sockaddr_in or sockaddr_in6 into a struct sockaddr_storage, and sockaddrs_eq() reads it as a struct sockaddr. This breaks the strict aliasing rule: the compiler may assume that the write does not change what the read returns. The bug was latent. An unrelated change in this file made gcc 14 inline differently in a musl release build. The generated code then compared two equal IPv4 addresses as different. Access the addresses through a union of the sockaddr types, and copy the addresses of getifaddrs() into it. Fixes: 74b5d63 ("libnvme/util: reimplement numeric address helpers without getaddrinfo") Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Every interface has a route to the IPv6 link-local prefix, so the route lookup for a link-local traddr returns any interface. The I/O queue count then comes from the wrong NIC. For a link-local destination, return the interface that the scope names. Accept an interface index as scope too, as the kernel does. Fixes: 6153710 ("shared/net-util-linux: add support for retrieving egress netdev") Signed-off-by: Martin Belanger <martin.belanger@dell.com>
martin-belanger
force-pushed
the
net-util-scoped-ipv6
branch
from
October 14, 2026 19:15
bbf436f to
e261af4
Compare
Collaborator
|
Looks good. Thanks! |
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.
Follow-up to #4140.
For a link-local traddr without
--host-iface, the route lookup inshr_route_get_egress_iface()returned any interface, because every interface has a route to the link-local prefix. The I/O queue count then came from the wrong NIC.fe80::1%2), as in the kernel.NOTE: The first commit fixes a latent strict-aliasing bug in the same file. The scope change made gcc 14 inline differently in the musl release build, and tree-fabrics then failed because two equal IPv4 addresses compared as different.
Tests in
test-net-util.c: scope name, scope index, no scope, unknown scope. All four fail without the fix.