Repository navigation
device: the local address is resolved on every call (2.0.2) - #14
Merged
MorningLightMountain713 merged 1 commit intoOct 19, 2026
Conversation
Device.getLocalAddress asks the kernel which address reaches the router each time it is called, and keeps no answer. Every mapping request sends the host's address of that moment as NewInternalClient, and a listing judges which entries are this host's against it. The host's address belongs to its route to the router, not to the router: a DHCP lease, an interface or a default route can change it while the gateway stays at the same location. Under cacheGateway the Device lives as long as the client, so a stored address would outlive such a change. The route query sends no packet, so it is asked again rather than stored. A client given a localAddress keeps using it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The host's LAN address is resolved on every call, never stored. It belongs to the host's route to the router, not to the router: a DHCP lease, an interface or a default route can change it while the gateway stays at the same location, and under
cacheGatewaytheDevicelives as long as the client.Behaviour
Device.getLocalAddressasks the kernel which address reaches the router each time it is called (a UDP connect, which sends no packet). Every mapping request sends the address of that moment asNewInternalClient, andgetMappings({ local })and thelocalflag on a lookup judge ownership against it. The cached gateway is unaffected: it is still kept, and still found again when it stops answering. A client given alocalAddresskeeps using it.Tests
npm test: 873 passing. New: a caching client that maps, sees the host's address change, and maps again sends the new address from the same cached gateway; and two calls togetLocalAddressmake two route queries and return the changed address. Both are red against 2.0.1's stored address.npm run flux-test:igd2: green against IGD v2 and IGD v1.🤖 Generated with Claude Code