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

n-acd: use separate seed state for each probe of the same acd #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bengal
Copy link
Contributor

@bengal bengal commented Oct 3, 2023

Currently, all the probes of an acd instance share the same seed state. This means that the state is updated by all the probes, and as a consequence they get different jitters for the wait timeouts; therefore the order in which addresses become available (and can configured on the interface) is not deterministic.

Keep a separate seed state for each probe, initialized from the acd seed. This ensures that all the probes use the same timeouts when sending probe requests, and that in case of no collision, addresses are available in the order of probe start.

According to RFC 5227, the reason for the initial random delay is that

This initial random delay helps ensure that a large number of
hosts powered on at the same time do not all send their initial
probe packets simultaneously

There is no mention that different addresses on the same interface should have a different delay.

Currently, all the probes of an acd instance share the same seed
state. This means that the state is updated by all the probes, and as
a consequence they get different jitters for the wait timeouts;
therefore the order in which addresses become available (and can
configured on the interface) is not deterministic.

Keep a separate seed state for each probe, initialized from the acd
seed. This ensures that all the probes use the same timeouts when
sending probe requests, and that in case of no collision, addresses
are available in the order of probe start.

According to RFC 5227, the reason for the initial random delay is that

   "This initial random delay helps ensure that a large number of
   hosts powered on at the same time do not all send their initial
   probe packets simultaneously"

There is no mention that different addresses on the same interface
should have a different delay.
thom311 pushed a commit to NetworkManager/NetworkManager that referenced this pull request Oct 5, 2023
Currently, all the probes of an acd instance share the same seed
state. This means that the state is updated by all the probes, and as
a consequence they get different jitters for the wait timeouts;
therefore the order in which addresses become available (and are
configured on the interface) is not deterministic.

Keep a separate seed state for each probe, initialized from the acd
seed. This ensures that all the probes use the same timeouts when
sending probe requests, and that in case of no collision, addresses
are available in the order of probe start.

n-acd pull request: nettools/n-acd#10
@dvdhrm
Copy link
Member

dvdhrm commented Oct 6, 2023

The code schedules a timer. If your task is moved to another CPU, the clocks might be slightly out of sync and you can still end up with probes being reordered.

I am not sure this is really worthwhile. You can always delay address setup until all probes for all addresses finished, in case this is the desired behavior.

I am unsure what you are trying to achieve. Why do you need probing to be deterministic? Shouldn't any upper dependency inevitably use some state machine to track dependencies, rather than relying on the lower protocols to be ordered on the network layer?

Lastly, even if you do have a desire for deterministic behavior, why not rather add n_acd_probe_config_set_seed()? This will grant full control over the random seed to the caller, allowing for completely deterministic behavior in tests, without relying on n-acd duplicating seeds across possibly repeated probes.

thom311 pushed a commit to NetworkManager/NetworkManager that referenced this pull request Nov 21, 2023
Currently, all the probes of an acd instance share the same seed
state. This means that the state is updated by all the probes, and as
a consequence they get different jitters for the wait timeouts;
therefore the order in which addresses become available (and are
configured on the interface) is not deterministic.

Keep a separate seed state for each probe, initialized from the acd
seed. This ensures that all the probes use the same timeouts when
sending probe requests, and that in case of no collision, addresses
are available in the order of probe start.

n-acd pull request: nettools/n-acd#10

(cherry picked from commit 2372791)
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.

None yet

2 participants