-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Missing a way to get local IP address for received UDP message #1649
Comments
Also nodejs/node-v0.x-archive#6589. There are valid use cases and I think it would make a good addition. However, different platforms have different quirks and there may be performance implications to consider. It's not really clear to me what the best way forward is. |
Edit: My issue can be fixed by binding to the multicast address. |
This would be helpful for my ICE agent since I need to create sockets for each address accessible from the network. I have to do some funky iteration through |
Put into https://github.com/nodejs/node/projects/13 backlog |
Add IPv6 link local scope ID suffix to the rinfo address in those received upd6 datagrams whose source address is a link local address. Add a new test case, test-dgram-udp6-link-local-address, to verify that IPv6 UDP datagrams received from a link-local source address do contain the scope ID suffix in the rinfo address field. When a packet is received from a link-local source address, if the address does not contain the scope ID suffix, it is impossible to reply back to the sender, as the kernel is not able to determine the right network interface to send the packet through and returns with an error. Ref: nodejs#1649 PR-URL: nodejs#14500
Add IPv6 link local scope ID suffix to the rinfo address in those received upd6 datagrams whose source address is a link local address. Add a new test case, test-dgram-udp6-link-local-address, to verify that IPv6 UDP datagrams received from a link-local source address do contain the scope ID suffix in the rinfo address field. When a packet is received from a link-local source address, if the address does not contain the scope ID suffix, it is impossible to reply back to the sender, as the kernel is not able to determine the right network interface to send the packet through and returns with an error. Ref: #1649 PR-URL: #14500 Refs: #1649 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stewart X Addison <sxa@uk.ibm.com>
Add IPv6 link local scope ID suffix to the rinfo address in those received upd6 datagrams whose source address is a link local address. Add a new test case, test-dgram-udp6-link-local-address, to verify that IPv6 UDP datagrams received from a link-local source address do contain the scope ID suffix in the rinfo address field. When a packet is received from a link-local source address, if the address does not contain the scope ID suffix, it is impossible to reply back to the sender, as the kernel is not able to determine the right network interface to send the packet through and returns with an error. Ref: #1649 PR-URL: #14500 Refs: #1649 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stewart X Addison <sxa@uk.ibm.com>
Add IPv6 link local scope ID suffix to the rinfo address in those received upd6 datagrams whose source address is a link local address. Add a new test case, test-dgram-udp6-link-local-address, to verify that IPv6 UDP datagrams received from a link-local source address do contain the scope ID suffix in the rinfo address field. When a packet is received from a link-local source address, if the address does not contain the scope ID suffix, it is impossible to reply back to the sender, as the kernel is not able to determine the right network interface to send the packet through and returns with an error. Ref: #1649 PR-URL: #14500 Refs: #1649 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stewart X Addison <sxa@uk.ibm.com>
Add IPv6 link local scope ID suffix to the rinfo address in those received upd6 datagrams whose source address is a link local address. Add a new test case, test-dgram-udp6-link-local-address, to verify that IPv6 UDP datagrams received from a link-local source address do contain the scope ID suffix in the rinfo address field. When a packet is received from a link-local source address, if the address does not contain the scope ID suffix, it is impossible to reply back to the sender, as the kernel is not able to determine the right network interface to send the packet through and returns with an error. Ref: #1649 PR-URL: #14500 Refs: #1649 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stewart X Addison <sxa@uk.ibm.com>
If I see it correctly, this issue has not really been resolved yet, right? |
It's never been implemented because of irreconcilable platform differences. The last attempt was almost 10 years ago but I don't think the situation has materially improved. |
I see, thank you for your feedback on this! Since the issue remains unresolved, would make it sense to reopen it, though..? |
Only if there is some way forward but that's not the case here. If it can't be made to work, it can't be made to work. |
For broadcast UDP messages I just listened on the broadcast address of each subnet of each interface. Don't listen on 255.255.255.255. This should work for unicast too (by listening on specific addresses). Normally you won't find two interfaces with overlapping subnets. If you do, then problably it has something to do with those platform differences and you surely already have bigger problems like NodeJS not allowing binding/restricting the socket to a specific interface. So, in short, you shouldn't need Node telling you the destination IP address of the received packet, you can figure it out. Also, by listening on specific broadcast addresses and specific IPs you can automatically rule out interfaces you're not suposed to listen on. A big security plus as a default. |
This is a duplicate of nodejs/node-v0.x-archive#8788
Basically: I have a udp server listening on a port on multiple interfaces - when I get a message on this port, I would like to be able to detect what interface the message was received from.
The text was updated successfully, but these errors were encountered: