From 8c04775fcac445e59951a34393875a6bb2efcabf 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 --- 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 38072d71aa69a6..894ab8f80b5e44 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -94,6 +94,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])`