Repository navigation
fix: propagate IPv6 scope_id through recv/bind paths (LAN-143) - #113
Merged
Merged
Conversation
Receiving: parse_sockaddr_storage now extracts sin6_scope_id from sockaddr_in6 and returns it alongside IpAddr. RecvResult carries the scope_id so link-local responders can be disambiguated by interface. Binding: --source-ip now accepts IPv6 zone IDs (fe80::1%eth0 or fe80::1%5). The zone is resolved to a numeric scope_id via if_nametoindex (for interface names) or parsed directly (for numeric IDs). bind_to_source_ip and create_udp_dgram_socket_bound_full accept an optional scope_id and construct SocketAddrV6 for link-local binds. Config gains source_ip_scope_id: Option<u32>, threaded through the engine's ICMP, UDP, and TCP bind paths. Closes LAN-143.
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.
Summary
Fixes IPv6 link-local scope ID being dropped on receiving and binding (LAN-143).
Receiving
parse_sockaddr_storagenow extractssin6_scope_idfromsockaddr_in6and returns it alongsideIpAddr.RecvResultcarries thescope_idso link-local responders can be disambiguated by interface.Binding
--source-ipnow accepts IPv6 zone IDs (fe80::1%eth0orfe80::1%5). The zone is resolved to a numeric scope_id viaif_nametoindex(for interface names) or parsed directly (for numeric IDs).bind_to_source_ipandcreate_udp_dgram_socket_bound_fullaccept an optional scope_id and constructSocketAddrV6for link-local binds.Config
Configgainssource_ip_scope_id: Option<u32>, threaded through the engine's ICMP, UDP, and TCP bind paths. CLI--source-ipis nowOption<String>(wasOption<IpAddr>) to accept zone syntax; the IP is parsed invalidate().Testing
cargo clippy --all-targets -- -D warningscleantest_parse_sockaddr_storage_ipv6_scope_id— link-local with scope_id=3test_parse_sockaddr_storage_ipv6_no_scope_id— global IPv6, scope_id=Nonetest_parse_sockaddr_storage_ipv4— IPv4, scope_id=Nonetest_source_ip_plain_ipv4— plain IPv4, no zonetest_source_ip_plain_ipv6— plain IPv6, no zonetest_source_ip_ipv6_numeric_scope—fe80::1%5→ scope_id=5test_source_ip_invalid_ip— rejects bad IPtest_source_ip_invalid_zone_interface— rejects unknown interface nameCloses LAN-143.