ok

Stefan Sperling(s...@stsp.name) on 2017.06.24 07:09:20 +0200:
> The kernel rejects IPv6 destination addresses on point-to-point
> interfaces if the prefixlen is not 128. Because ifconfig defaults
> to prefixlen 64, configuring IPv6 on e.g. gif(4) requires an
> explicit prefix length, for instance:
> 
>    ifconfig gif0 inet6 ADDR1 ADDR2 prefixlen 128
> 
> Without prefixlen we get: ifconfig: SIOCAIFADDR: Invalid argument
> 
> However, this command works for IPv4:
> 
>    ifconfig gif0 ADDR1 ADDR2
> 
> The netmask isn't forced to 255.255.255.255 by the kernel, though.
> 
> Assuming the kernel is correct in enforcing IPv6 prefixlen 128,
> for whatever reason, then I suggest we make ifconfig figure out
> the required prefixlen by itself so this command works as it
> does for IPv4:
> 
>    ifconfig gif0 inet6 ADDR1 ADDR2
> 
> ok?
> 
> Index: ifconfig.c
> ===================================================================
> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
> retrieving revision 1.344
> diff -u -p -r1.344 ifconfig.c
> --- ifconfig.c        8 Jun 2017 19:23:39 -0000       1.344
> +++ ifconfig.c        24 Jun 2017 04:54:17 -0000
> @@ -803,9 +803,13 @@ nextarg:
>               /*
>                * Aggregatable address architecture defines all prefixes
>                * are 64. So, it is convenient to set prefixlen to 64 if
> -              * it is not specified.
> +              * it is not specified. If we are setting a destination
> +              * address on a point-to-point interface, 128 is required.
>                */
> -             setifprefixlen("64", 0);
> +             if (setipdst && (flags & IFF_POINTOPOINT))
> +                     setifprefixlen("128", 0);
> +             else
> +                     setifprefixlen("64", 0);
>               /* in6_getprefix("64", MASK) if MASK is available here... */
>       }
>  
> @@ -1241,6 +1245,7 @@ void
>  setifdstaddr(const char *addr, int param)
>  {
>       setaddr++;
> +     setipdst++;
>       afp->af_getaddr(addr, DSTADDR);
>  }
>  
> 

Reply via email to