Stuart Henderson([email protected]) on 2013.05.22 21:18:05 +0100:
> On 2013/05/22 20:47, Stuart Henderson wrote:
> > does anyone see a downside to this? 

i see none other than making the maze of options of route(8) a bit more
bizarre.

> > if the address family is not
> > explicitly specified, assume v6 if it looks like it may be an ipv6
> > address.
> > 
> > allows e.g. "route get 2001:200:dff:fff1:216:3eff:feb1:44d7"
> > without needing to specify -inet6.
> 
> oops, as pointed out by jca@, I missed aflen (or rather, saw it and
> for some unknown reason thought it didn't matter, I blame my tooth ;)
> 
> Index: route.c
> ===================================================================
> RCS file: /cvs/src/sbin/route/route.c,v
> retrieving revision 1.161
> diff -u -p -r1.161 route.c
> --- route.c   21 Mar 2013 04:43:17 -0000      1.161
> +++ route.c   22 May 2013 20:15:53 -0000
> @@ -803,8 +803,13 @@ getaddr(int which, char *s, struct hoste
>       int afamily, bits;
>  
>       if (af == 0) {
> -             af = AF_INET;
> -             aflen = sizeof(struct sockaddr_in);
> +             if (strchr(s, ':') != NULL) {
> +                     af = AF_INET6;
> +                     aflen = sizeof(struct sockaddr_in6);
> +             } else {
> +                     af = AF_INET;
> +                     aflen = sizeof(struct sockaddr_in);
> +             }
>       }
>       afamily = af;   /* local copy of af so we can change it */


ok

maybe a note in the manpage?

Reply via email to