New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipv6: Fix source address with many addresses in same network #11384
Merged
Conversation
This file contains 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
wengzhe
reviewed
Dec 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, it seems reasonable to get a source address from the destination address when we're replying. I also found the same problem in ping6 just last week, and didn't get time to fully analyze this problem, thanks for checking it over protocols.
Previously ipv6 multi-address support decided packet source address based on its destination. This doesn't work if NuttX device has multiple addresses within same subnet. Instead when a packet is a response to existing connection, the source address should be based on the destination address used in the received packet.
PetteriAimonen
force-pushed
the
net_ipv6_multi_src
branch
from
December 13, 2023 10:27
94359ff
to
878d987
Compare
wengzhe
approved these changes
Dec 13, 2023
anchao
approved these changes
Dec 13, 2023
xiaoxiang781216
approved these changes
Dec 13, 2023
jerpelea
approved these changes
Dec 13, 2023
wengzhe
added a commit
to wengzhe/nuttx
that referenced
this pull request
Feb 2, 2024
apache#11384 has changed the source address selection of UDP from raddr to laddr, but not all UDP connections have laddr set, then we need to fallback to get source from raddr. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
xiaoxiang781216
pushed a commit
that referenced
this pull request
Feb 2, 2024
#11384 has changed the source address selection of UDP from raddr to laddr, but not all UDP connections have laddr set, then we need to fallback to get source from raddr. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
freakishness
pushed a commit
to freakishness/incubator-nuttx
that referenced
this pull request
Feb 18, 2024
apache#11384 has changed the source address selection of UDP from raddr to laddr, but not all UDP connections have laddr set, then we need to fallback to get source from raddr. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
halyssonJr
pushed a commit
to halyssonJr/nuttx
that referenced
this pull request
Apr 10, 2024
apache#11384 has changed the source address selection of UDP from raddr to laddr, but not all UDP connections have laddr set, then we need to fallback to get source from raddr. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
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
Previously ipv6 multi-address support decided packet source address based on its destination. This doesn't work if NuttX device has multiple addresses within same subnet. Replies will come from different address that the originator contacted, which causes warnings for ICMPv6 and stops TCP from working.
Instead when a packet is a response to existing connection, the source address should be based on the destination address used in the received packet.
RFC6724 does not go much into detail on this, but says:
This commit implements it so that the destination address of received packet is used if it is among the local interface addresses.
If it is not, a best matching address is selected.
Related to #11054 and #11378.
@wengzhe Does this look reasonable to you?
Impact
Makes a difference only when
CONFIG_NETDEV_MULTIPLE_IPv6
is enabled.Affects ICMPv6 and TCP & UDP.
Testing
Tested with following addresses:
fd0f::e100
beforeifup()
, with netmask /64.fd0f::1:0:e100
usingifconfig
.fd0f::aaa1:59ff:fe15:4b25
to itself.