autoip: Choose next address after rate limit #59
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.
Fix: AutoIP selects a new address after rate limiting
Issue
After hitting MAX_CONFLICTS (10), AutoIP enters rate limiting mode for 60 seconds. After this timeout, it tries to acquire an IP address again, but it incorrectly reuses the same address that previously had conflicts.
This causes devices to fail Bonjour Conformance Tests for rate limiting, as they should try different addresses after timeouts.
Root Cause
In lwIP pre-2.2.0, address conflict detection was handled directly in autoip.c, where
tried_llipaddr
was incremented inautoip_restart()
:lwip/src/core/ipv4/autoip.c
Lines 125 to 130 in 6ca936f
When ACD was extracted into a separate module in 2.2.0, this increment was missing for the rate-limiting path in the callback handler. The
ACD_DECLINE
case cleared the address but didn't increment the counter.Fix
The patch adds one line to increment the
tried_llipaddr
counter in theACD_DECLINE
case, ensuring that after rate limiting, a new address is tried rather than the same one.Testing
With this patch, devices pass the Bonjour Conformance Test for rate limiting.