From 751c9cc39792ca7f8215ef99b2567836939905ef Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sat, 3 Oct 2020 14:29:16 +0200 Subject: [PATCH] Support CIDR queries to whois.arin.net This is a behaviour change: in this case the client used to use the parameters for non-CIDR queries, so the server would return nothing. Now an exact match for the provided ip/length query is requested. If the query is not an exact match then this is also different from the default behaviour of the server, which is to return a non-verbose summary of all less specific networks. --- whois.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/whois.c b/whois.c index ac23c06..b50d2b1 100644 --- a/whois.c +++ b/whois.c @@ -693,7 +693,10 @@ char *queryformat(const char *server, const char *flags, const char *query) strcat(buf, "a "); strcat(buf, query + 2); } else if (myinet_aton(query) || strchr(query, ':')) { - strcat(buf, "n + "); + if (strchr(query, '/')) + strcat(buf, "r + = "); + else + strcat(buf, "n + "); strcat(buf, query); } else strcat(buf, query);