Date: Fri, 8 Apr 2016 11:43:22 +0000 (UTC) From: Tony Finch <fanf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297708 - head/usr.bin/whois Message-ID: <201604081143.u38BhMah094083@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: fanf Date: Fri Apr 8 11:43:22 2016 New Revision: 297708 URL: https://svnweb.freebsd.org/changeset/base/297708 Log: Handle whois referrals between RIRs This is rather ugly, because the RIPE and APNIC whois servers do not provide referrals for address blocks that they do not manage. However ARIN is usually the right place or knows the right place so we try there. The particular instance which clued me in to this bug is U.Mich. 141.211.0.0/16 for which the referral chain should be IANA -> RIPE -> ARIN. RIPE's RDAP does provide useful redirects (for example try `curl -I http://rdap.db.ripe.net/ip/141.211.0.0) so maybe their whois server can be improved. AfriNIC's whois server gives more direct referrals, but they are designed to be human-readable. Ugly, but we can manage. The issue of referrals between RIRs is likely to become more important in the future whith the increasing number of cross-region IP address block transfers increases. Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Fri Apr 8 11:20:56 2016 (r297707) +++ head/usr.bin/whois/whois.c Fri Apr 8 11:43:22 2016 (r297708) @@ -114,9 +114,16 @@ static struct { WHOIS_REFERRAL("Whois Server:"), WHOIS_REFERRAL("Registrar WHOIS Server:"), /* corporatedomains.com */ WHOIS_REFERRAL("ReferralServer: whois://"), /* ARIN */ + WHOIS_REFERRAL("descr: region. Please query"), /* AfriNIC */ { NULL, 0 } }; +static const char *actually_arin[] = { + "netname: ERX-NETBLOCK\n", /* APNIC */ + "netname: NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK\n", + NULL +}; + static const char *port = DEFAULT_PORT; static const char *choose_server(char *); @@ -469,6 +476,12 @@ done: (int)(p - host), host); break; } + for (i = 0; actually_arin[i] != NULL; i++) { + if (strncmp(buf, actually_arin[i], len) == 0) { + s_asprintf(&nhost, "%s", ANICHOST); + break; + } + } } /* Verisign etc. */ if (!(flags & WHOIS_SPAM_ME) &&
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604081143.u38BhMah094083>