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.
This commit is contained in:
parent
d416a65514
commit
42e88fe650
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297708
@ -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 @@ whois(const char *query, const char *hostname, int flags)
|
||||
(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) &&
|
||||
|
Loading…
Reference in New Issue
Block a user