Skip to content

device: the local address is resolved on every call (2.0.2) - #14

Merged
MorningLightMountain713 merged 1 commit into
RunOnFlux:mainfrom
MorningLightMountain713:fix/local-address-per-request
Oct 19, 2026
Merged

MorningLightMountain713 merged 1 commit into
RunOnFlux:mainfrom
MorningLightMountain713:fix/local-address-per-request

Conversation

@MorningLightMountain713

Copy link
Copy Markdown

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 cacheGateway the Device lives as long as the client.

Behaviour

Device.getLocalAddress asks 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 as NewInternalClient, and getMappings({ local }) and the local flag 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 a localAddress keeps 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 to getLocalAddress make 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

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>
@MorningLightMountain713
MorningLightMountain713 merged commit f924f2f into RunOnFlux:main Oct 19, 2026
5 checks passed
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