does anyone see a downside to this? 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.

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 19:43:34 -0000
@@ -803,7 +803,10 @@ getaddr(int which, char *s, struct hoste
        int afamily, bits;
 
        if (af == 0) {
-               af = AF_INET;
+               if (strchr(s, ':') != NULL)
+                       af = AF_INET6;
+               else
+                       af = AF_INET;
                aflen = sizeof(struct sockaddr_in);
        }
        afamily = af;   /* local copy of af so we can change it */

Reply via email to