Hi, Any comments?
On Sun, May 20, 2018 at 07:48:34PM +0100, Mikolaj Kucharski wrote: > Hi, > > This is very naive patch for whois(1) which makes it work > by default for IPv6 addresses. I went with very minimal > approach here. If string contains colon, it's asumed to > be IPv6 address. Comments welcome. > > Please CC me, as I'm not subscribed to the list. > > Index: whois.c > =================================================================== > RCS file: /cvs/src/usr.bin/whois/whois.c,v > retrieving revision 1.56 > diff -u -p -u -r1.56 whois.c > --- whois.c 26 Jul 2017 15:48:38 -0000 1.56 > +++ whois.c 4 Apr 2018 19:01:45 -0000 > @@ -278,7 +278,8 @@ whois(const char *query, const char *ser > * If the TLD is a number, query ARIN, otherwise, use TLD.whois-server.net. > * If the domain does not contain '.', check to see if it is an NSI handle > * (starts with '!') or a CORE handle (COCO-[0-9]+ or COHO-[0-9]+) or an > - * ASN (starts with AS). Fall back to NICHOST for the non-handle case. > + * ASN (starts with AS) or IPv6 address (contains ':'). Fall back to > + * NICHOST for the non-handle and non-IPv6 case. > */ > char * > choose_server(const char *name, const char *country, char **tofree) > @@ -305,6 +306,8 @@ choose_server(const char *name, const ch > else if ((strncasecmp(name, "AS", 2) == 0) && > strtol(name + 2, &ep, 10) > 0 && *ep == '\0') > return (MNICHOST); > + else if (strchr(name, ':') != NULL) /* IPv6 address */ > + return (ANICHOST); > else > return (NICHOST); > } else if (isdigit((unsigned char)*(++qhead))) Regards, Mikolaj