Skip to content
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

Retry Sendto() for IPv6 NA for tentative IPv6 addresses and EADDRNOTAVAIL #307

Conversation

thom311
Copy link
Contributor

@thom311 thom311 commented Jul 30, 2024

When kernel initially adds an IPv6 address, it is still tentative and
pending DuplicateAddressDetection. Trying to use the address results in
EADDRNOTAVAIL error.

Detect that error, and retry for up to 3 seconds to send the message.

Unfortunately, DAD can easily take more than a second, so this change
delays the completion of the CNI binary quite a bit.


@SchSeba Follow-up for #306

This seems to happen with Openshift 4.17, which makes me wonder whether previous versions had opportunisticoptimistic DAD enabled. If so, why was it disabled?

@coveralls
Copy link

coveralls commented Jul 30, 2024

Pull Request Test Coverage Report for Build 10466886239

Details

  • 6 of 29 (20.69%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 41.19%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/sriov/sriov.go 6 9 66.67%
pkg/utils/utils.go 0 7 0.0%
pkg/utils/packet.go 0 13 0.0%
Totals Coverage Status
Change from base Build 10353172804: -0.2%
Covered Lines: 540
Relevant Lines: 1311

💛 - Coveralls

pkg/utils/packet.go Outdated Show resolved Hide resolved
@thom311 thom311 force-pushed the th/send-na-eaddrnotavail-retry branch 2 times, most recently from a49b44b to 9056782 Compare July 31, 2024 07:05
pkg/utils/packet.go Outdated Show resolved Hide resolved
@thom311 thom311 force-pushed the th/send-na-eaddrnotavail-retry branch 2 times, most recently from ca6eccc to e60d611 Compare July 31, 2024 08:10
@adrianchiris
Copy link
Contributor

adrianchiris commented Jul 31, 2024

delaying CNI call for a single interface by up to 3 seconds for an optimization mechanism is very problematic in my view.
moreover if the first(ipv6) ip consumed these 3 seconds, then other IP6s will not have neighbour advertisment.

having opportunistic DAD enabled seems like the correct approach.
how do you enable that in the system ?

from cni POV we dont expect addresses to be duplicate (unless IPAM plugin is doing something wrong).

@thom311
Copy link
Contributor Author

thom311 commented Jul 31, 2024

delaying CNI call for a single interface by up to 3 seconds f

In practice, it seems to be more like 1.8 seconds. The 3 seconds is a maximum (which the patch maybe should reduce to 2 seconds). Still, it's long.

delaying CNI call for a single interface by up to 3 seconds for an optimization mechanism is very problematic in my view.

Note that the IPv6 addresses are not really usable on the POD anyway. It also means, to start the pod with non-complete IP configuration (e.g. they cannot bind to the IPv6 address). So delaying the startup may be desirable also for those reasons. However, to have this wait implemented via AnnounceIPs() is non-obvious.

moreover if the first(ipv6) ip consumed these 3 seconds, then other IP6s will not have neighbour advertisment.

I don't understand this. If the first IPv6 was delayed by the full 3 seconds, then indeed, subsequent addresses won't be delayed/retried. But they are still tried at least once.

having opportunistic DAD enabled seems like the correct approach.
how do you enable that in the system ?

Sorry, I misspoke earlier: s/opportunistic/optimistic/

I agree. Something like echo 1 > /proc/sys/net/ipv6/conf/eth0/optimistic_dad

@adrianchiris
Copy link
Contributor

I don't understand this. If the first IPv6 was delayed by the full 3 seconds, then indeed, subsequent addresses won't be delayed/retried. But they are still tried at least once.

yes, i re-read the code. you are correct.

@thom311 thom311 force-pushed the th/send-na-eaddrnotavail-retry branch from e60d611 to 0a30adb Compare July 31, 2024 12:10
@thom311
Copy link
Contributor Author

thom311 commented Jul 31, 2024

@adrianchiris branch completely reworked. Now, optimistic_dad is set.

This is a far-reaching change, I am not sure I understand all implications. It does however seem the right thing to me, also because it seems bad to hand control over to the container with IPv6 addresses that are not ready yet.

The retry is gone because it should no longer be necessary. It would however not hurt, because the retry was only done when it was determined to be necessary.

WDYT?

@wizhaoredhat
Copy link
Contributor

I really like the opportunistic DAD approach! It looks much better now. Also IPAM should really never give a duplicate IPv6 address when setup properly. As Adrian said, duplicate IPv6 addresses shouldn't occur.

@SchSeba
Copy link
Collaborator

SchSeba commented Aug 1, 2024

but we still need to remember the case where a user wants a static IP address on a pod and he restart the pod.

that is a valid use-case

@thom311
Copy link
Contributor Author

thom311 commented Aug 1, 2024

but we still need to remember the case where a user wants a static IP address on a pod and he restart the pod.

I don't follow. Could you please elaborate?

@thom311 thom311 force-pushed the th/send-na-eaddrnotavail-retry branch from 0a30adb to 7da1fcd Compare August 6, 2024 07:46
pkg/utils/packet.go Outdated Show resolved Hide resolved
pkg/utils/packet.go Outdated Show resolved Hide resolved
Without it, DAD is enabled and it takes more than a second for an IPv6
address to be no longer tentative and become usable.

This affects announceIPs(), which fails to send IPv6 NA.

I assume, this also meant that the container already started at
a point when IPv6 is not yet fully usable. For example, binding
to the address would fail.

Instead, enable optimistic_dad, so that we can use the address right
away.
Copy link
Collaborator

@SchSeba SchSeba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adrianchiris
Copy link
Contributor

overall LGTM, once comments addressed we can merge.

Don't let the first error shortcut the announcement of subsequent
addresses. Loop over all addresses, and return the joined errors. Note
that the caller anyway ignores the error and only uses it for debug
logging.
@thom311 thom311 force-pushed the th/send-na-eaddrnotavail-retry branch from e225822 to 8d1c353 Compare August 20, 2024 07:04
@adrianchiris adrianchiris merged commit fca6591 into k8snetworkplumbingwg:master Aug 20, 2024
10 of 11 checks passed
@thom311 thom311 deleted the th/send-na-eaddrnotavail-retry branch August 28, 2024 06:11
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.

6 participants