diff mbox

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

Message ID 1496073029-21572-1-git-send-email-b.cama@kerlink.fr
State New
Headers show

Commit Message

Benjamin Cama May 29, 2017, 3:50 p.m. UTC
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(-)

Comments

Benjamin Cama June 21, 2017, 7:53 a.m. UTC | #1
Hi,

No feedback on this? Did I do something wrong?
Thanks.

Le lundi 29 mai 2017 à 17:50 +0200, Benjamin Cama a écrit :
> 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);
>      }
>
Florian Weimer June 21, 2017, 9:50 a.m. UTC | #2
On 05/29/2017 05:50 PM, Benjamin Cama wrote:
> 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 +-

The patch and rationale are okay.  Could you file a bug in Bugzilla?
Then I can push the patch for you with a ChangeLog entry.

Thanks,
Florian
diff mbox

Patch

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);
     }