On 2015/03/26 13:48, Martin Pieuchot wrote:
> How do people feel about printing the prefixlen in CIDR notation?  I'm
> annoyed about outputs not fitting in 80 chars when using autoconf magic:
> 
> -inet6 fd00::f2de:f1ff:fe6a:15d1 prefixlen 64 autoconf pltime 3594 vltime 7194
> +inet6 fd00::f2de:f1ff:fe6a:15d1/64 autoconf pltime 3594 vltime 7194
> 
> While here can I convert " autoconfprivacy" to " privacy" or "+privacy"?
> 
> Index: ifconfig.c
> ===================================================================
> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
> retrieving revision 1.296
> diff -u -p -r1.296 ifconfig.c
> --- ifconfig.c        5 Feb 2015 10:30:25 -0000       1.296
> +++ ifconfig.c        26 Mar 2015 12:15:10 -0000
> @@ -3192,7 +3192,7 @@ in6_alias(struct in6_ifreq *creq)
>                       warn("SIOCGIFNETMASK_IN6");
>       } else {
>               sin6 = (struct sockaddr_in6 *)&ifr6.ifr_addr;
> -             printf(" prefixlen %d", prefix(&sin6->sin6_addr,
> +             printf("/%d", prefix(&sin6->sin6_addr,
>                   sizeof(struct in6_addr)));
>       }

seems reasonable. (I'd quite like that for v4 too, though it wouldn't
cope with non-contiguous netmask ;)

> @@ -3216,7 +3216,7 @@ in6_alias(struct in6_ifreq *creq)
>               if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_AUTOCONF)
>                       printf(" autoconf");
>               if (ifr6.ifr_ifru.ifru_flags6 & IN6_IFF_PRIVACY)
> -                     printf(" autoconfprivacy");
> +                     printf(" privacy");
>       }
>  
>       if (scopeid)
> 

I do prefer "privacy" here, but generally the printed flags match the
name used to configure them so this would be better if the cmds[] table
and manual changed too. (But then we might want to keep backwards compat
to reduce risk of people locking themselves out of remote machines if
they have a flag in the wrong place on a hostname.if line)...

Reply via email to