Skip to content

autoip: Choose next address after rate limit #59

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

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

Conversation

david-cermak
Copy link
Contributor

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 in autoip_restart():

lwip/src/core/ipv4/autoip.c

Lines 125 to 130 in 6ca936f

autoip_restart(struct netif *netif)
{
struct autoip *autoip = netif_autoip_data(netif);
autoip->tried_llipaddr++;
autoip_start(netif);
}

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 the ACD_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.

AutoIP now selects a new address after rate limit timeout,
AutoIP tries a new address by incrementing the tried_llipaddr counter
in the ACD_DECLINE case of the callback.

In lwIP pre-2.2.0, address conflict detection was handled within autoip.c, and
the incrementing happened in autoip_restart() (line 150). When ACD was
extracted into a separate module in 2.2.0, this increment was missing for the
rate-limiting path.

Without this change, devices continuously retry the same IP address after rate
limiting, causing them to fail Bonjour Conformance Tests.
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.

1 participant