On 2013/05/23 15:03, Sebastian Benoit wrote: > Stuart Henderson(st...@openbsd.org) 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? >
Possible manpage wording.. Index: route.8 =================================================================== RCS file: /cvs/src/sbin/route/route.8,v retrieving revision 1.70 diff -u -p -r1.70 route.8 --- route.8 13 Jul 2012 10:15:53 -0000 1.70 +++ route.8 23 May 2013 13:49:50 -0000 @@ -310,6 +310,9 @@ Actual data, in hexadecimal format .El .Pp +In the absence of modifiers, an address is assumed to be IPv4, +unless containing a : character when it is treated as IPv6. +.Pp The optional modifier .Fl link specifies that all subsequent addresses are specified as link-level addresses,