This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][PATCH] Parse interface zone id for node-local multicast too


Hi,

I stumbled upon programs not able to send to an interface-local multicast
address; at first, it was because Linux kernel since 3.10 (see
842df0739776fc9af7ac15968b44415a31ba9be4) *requires* a zone id for
interface-local multicast addresses, while I thought it did not (I think there
is some confusion here, as they are often qualified “node-local”, which seems
to imply they do not need scope qualification). But then, currently, glibc does
not parse interface names to zone id (sometimes called “scope id” too) for
interface-local multicast addresses, so they are a bit difficult to use; e.g.:

  $ ping6 ff01::1%lo
  unknown host
  $ ping6 ff01::1%1
  PING ff01::1%1(ff01::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.018 ms
  ^C

The following patch proposes to allow it. Proposed commit message following.
Please Cc your answers to me.

Regards,
-- Benjamin Cama

This scope is better qualified as "interface-local" by RFC 4291, and gai
thus should parse interface names for it too. Linux furthermore requires
qualified interface-local multicast addresses since 3.10.

Signed-off-by: Benjamin Cama <b.cama@kerlink.fr>
---
 inet/inet6_scopeid_pton.c     | 1 +
 inet/tst-inet6_scopeid_pton.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/inet/inet6_scopeid_pton.c b/inet/inet6_scopeid_pton.c
index f842ffc..e09b1cb 100644
--- a/inet/inet6_scopeid_pton.c
+++ b/inet/inet6_scopeid_pton.c
@@ -33,6 +33,7 @@ __inet6_scopeid_pton (const struct in6_addr *address, const char *scope,
                       uint32_t *result)
 {
   if (IN6_IS_ADDR_LINKLOCAL (address)
+      || IN6_IS_ADDR_MC_NODELOCAL (address)
       || IN6_IS_ADDR_MC_LINKLOCAL (address))
     {
       uint32_t number = __if_nametoindex (scope);
diff --git a/inet/tst-inet6_scopeid_pton.c b/inet/tst-inet6_scopeid_pton.c
index 2178c5b..30b928f 100644
--- a/inet/tst-inet6_scopeid_pton.c
+++ b/inet/tst-inet6_scopeid_pton.c
@@ -118,9 +118,9 @@ do_test (void)
     {
       expect_success ("fe80::1", interface_name, interface_index);
       expect_success ("ff02::1", interface_name, interface_index);
+      expect_success ("ff01::1", interface_name, interface_index);
       expect_failure ("::", interface_name);
       expect_failure ("::1", interface_name);
-      expect_failure ("ff01::1", interface_name);
       expect_failure ("2001:db8::1", interface_name);
     }
 
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]