Skip to content
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

Return only non-deprecated temporary IPv6 addresses in node.js #2871

Open
achingbrain opened this issue Dec 4, 2024 · 1 comment
Open

Return only non-deprecated temporary IPv6 addresses in node.js #2871

achingbrain opened this issue Dec 4, 2024 · 1 comment
Labels
need/triage Needs initial labeling and prioritization

Comments

@achingbrain
Copy link
Member

achingbrain commented Dec 4, 2024

When we listen a wildcard interface (e.g. add /ip4/0.0.0.0/tcp/0 or /ip6/::/tcp/0 to addresses.listen), the transport in question loops over the output of os.networkInterfaces() to work out which addresses the node is reachable on.

This works find for IPv4, but for IPv6 we get a multiple addresses reported for the interface.

Because IPv6 addresses can identify a host uniquely in the world, OSs generate temporary addresses for traffic that will leave the local network as a privacy measure.

Each temporary address exists for a limited time - when a new temporary address is generated, older addresses are marked "deprecated" which means they'll be removed at some point in the near future.

Ideally when reporting the addresses we are listening on, we'd filter out any deprecated addresses to keep our peer records small and to avoid broadcasting soon-to-be-removed addresses.

Unfortunately this information is not available in the Node.js API.

An alternative is to use the network-interfaces-plus module which uses a native add-on to access the flags for each interface. The module is not well used and it's compatibility with current or future versions of Node.js is unclear, there may be other options.

@achingbrain achingbrain added the need/triage Needs initial labeling and prioritization label Dec 4, 2024
@dozyio
Copy link
Contributor

dozyio commented Dec 5, 2024

Wondering if deprecated addresses are still removed when there is a server is listening on them? Will do some tests over the weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants