From de174cd1bc972ba99a5c0c0190a662b30161bb02 Mon Sep 17 00:00:00 2001 From: Pekka Nikander Date: Wed, 26 Jul 2017 13:49:21 +0200 Subject: [PATCH] dgram: add IPv6 scope id suffix to received udp6 dgrams 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: https://github.com/nodejs/node/issues/1649 PR-URL: https://github.com/nodejs/node/pull/14500 Refs: https://github.com/nodejs/node/issues/1649 Reviewed-By: Ben Noordhuis Reviewed-By: Luigi Pinca Reviewed-By: Stewart X Addison --- doc/api/dgram.md | 6 +++ src/tcp_wrap.cc | 15 +++++- .../test-dgram-udp6-link-local-address.js | 51 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-dgram-udp6-link-local-address.js diff --git a/doc/api/dgram.md b/doc/api/dgram.md index ae948d361ab173..25fee3a9310ca0 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -96,6 +96,12 @@ The event handler function is passed two arguments: `msg` and `rinfo`. * `port` {number} The sender port. * `size` {number} The message size. +If the source address of the incoming packet is an IPv6 link local +address, the interface name is added to the `address`. For +example, a packet received on the `en0` interface might have the +address field set to `'fe80::2618:1234:ab11:3b9c%en0'`, where `'%en0'` +is the interface name as a zone id suffix. + ### `socket.addMembership(multicastAddress[, multicastInterface])`