Repository navigation
Conversation
The neighbor cache kept a single `silent_until` deadline for the whole cache, so after dispatching a discovery request for one address every lookup for a different uncached address returned `RateLimited` for the next second. Resolving a gateway for DNS therefore delayed the ARP request for the actual peer by up to SILENT_TIME. Track the silence deadline per destination address in a `LinearMap<IpAddress, Instant, IFACE_NEIGHBOR_CACHE_COUNT>` instead, evicting the entry with the earliest deadline when full. `flush()` now also clears the silence map.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1210 +/- ##
==========================================
- Coverage 82.57% 82.57% -0.01%
==========================================
Files 83 83
Lines 26174 26212 +38
==========================================
+ Hits 21613 21644 +31
- Misses 4561 4568 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #1209
Reproduction
iface::neighbor::Cachekept a singlesilent_untildeadline for the whole cache. After one ARP/NDISC request was dispatched for address A,lookup()returnedRateLimitedfor every other uncached address B for the nextSILENT_TIME(1 s), so B's request was not sent until A's silence expired.Unit-level before this patch:
cache.limit_rate(t0)madelookup(other_addr, t0+100ms)returnRateLimitedeven though no request forother_addrwas ever made. On hardware (Issue #1209, ESP32-S3 with gateway-as-DNS on the same link) this shows up as DNS resolving fast every time and the subsequentconnect()stalling ~1.03 s on the first attempt after link-up.Root cause
Cache::limit_ratewrote one cache-wideInstant(silent_until), andCache::lookupconsulted it regardless of which address was being resolved. Nothing tied the silence to the address whose request actually went out on the wire.Fix
Track the silence deadline per destination address:
silent_until: Instantbecomessilent_until: LinearMap<IpAddress, Instant, IFACE_NEIGHBOR_CACHE_COUNT>.lookup(addr, now):RateLimitedonly if that address has a non-expired deadline.limit_rate(addr, now): inserts/overwrites the deadline for that address only; if the map is full it first evicts the entry with the earliest deadline (same "evict oldest" rule asfill_with_expiration).flush()now also clears the silence map, so a cache flush can no longer leave stale deadlines behind.iface::InterfaceInnerpasses the resolved destination (dst_addr) instead of restricting the whole cache.Impact
SILENT_TIMEper address, as before per cache-wide behavior.LinearMapofIFACE_NEIGHBOR_CACHE_COUNT(IpAddress, Instant)entries in the cache, no heap allocation (smoltcp is no_std/heap-free).Testing
test_hush_is_per_address(a request for one address leaves a second addressNotFound, both silenced addresses behave independently, a third address staysNotFound), extendedtest_hushwith an other-address assertion, and addedtest_flush_clears_silence.cargo test: 675 passed, 0 failed (unit + interface tests; full suite).cargo test --doc: 7 passed.cargo clippy --lib: no new warnings from this change (2 pre-existing unrelated warnings).cargo fmt;git diff --checkclean.Not verified
AI disclosure
This PR was authored by an AI agent (OpenClaw, running scheduled OSS-bugfix automation for account @tasodoufu). The change, tests, and description were drafted and verified by the agent under human review/account ownership.
Issue
Fixes #1209
Issue condition check (at open and at push)
#1209: OPEN, unassigned, no assignee, no takeover/comments from others, no competing open PR referencing the fix (the only cross-reference was an unrelated 2021 PR). LICENSE: 0BSD (permissive). No repo AI policy found (CONTRIBUTING.md absent; no AI prohibition found in the repo's public docs).