Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Apr 2005 01:05:06 +0200 (SAST)
From:      Adrian Frith <adrian@frith.homelinux.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/80421: [PATCH] whois(1) should query AfriNIC server for African IP's
Message-ID:  <200504272305.j3RN56pJ081997@frith.homelinux.org>
Resent-Message-ID: <200504272310.j3RNA0RJ072396@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         80421
>Category:       bin
>Synopsis:       [PATCH] whois(1) should query AfriNIC server for African IP's
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 27 23:10:00 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Adrian Frith <adrian@frith.homelinux.org>
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
University of Cape Town, South Africa
>Environment:
System: FreeBSD frith.homelinux.org 5.4-STABLE FreeBSD 5.4-STABLE #0: Mon Apr 25 02:25:26 SAST 2005 root@diogenes.frith:/usr/obj/usr/src/sys/DIOGENES i386

>Description:
	As of 2005-02-21, management of IP numbers used on the continent of
	Africa and the western Indian Ocean islands has been transferred from
	ARIN and RIPE NCC to the new AfriNIC RIR (www.afrinic.net). Since this
	change, the ARIN whois server does not return useful information for
	queries on IP numbers in the ranges which have been transferred.
	Therefore, the /usr/bin/whois utility should use the AfriNIC whois
	server (whois.afrinic.net) when appropriate (as it does for APNIC,
	LACNIC and RIPE NCC IP ranges).
>How-To-Repeat:
	Use the /usr/bin/whois utility to query any IP number in the ranges
	which are now managed by AfriNIC. These include 196.2[3-6].0.0/16,
	165.14[3-9].0.0/16, and 137.158.0.0/16. For example,
	'whois 137.158.128.3' returns only the information that the range has
	been transferred to AfriNIC, while
	'whois -h whois.afrinic.net 137.158.128.3' returns useful information
	about the IP's ownership.
>Fix:

	Apply the attached patch to the whois sources.

--- whois-afrinic.patch begins here ---
--- usr.bin/whois/whois.c.orig	Wed Apr 27 23:09:06 2005
+++ usr.bin/whois/whois.c	Thu Apr 28 00:01:37 2005
@@ -77,6 +77,7 @@
 #define NORIDHOST	"whois.norid.no"
 #define	IANAHOST	"whois.iana.org"
 #define GERMNICHOST	"de.whois-servers.net"
+#define FNICHOST	"whois.afrinic.net"
 #define	DEFAULT_PORT	"whois"
 #define	WHOIS_SERVER_ID	"Whois Server: "
 #define	WHOIS_ORG_SERVER_ID	"Registrant Street1:Whois Server:"
@@ -86,7 +87,8 @@
 
 #define ishost(h) (isalnum((unsigned char)h) || h == '.' || h == '-')
 
-const char *ip_whois[] = { LNICHOST, RNICHOST, PNICHOST, BNICHOST, NULL };
+const char *ip_whois[] = { LNICHOST, RNICHOST, PNICHOST, BNICHOST,
+			   FNICHOST, NULL };
 const char *port = DEFAULT_PORT;
 
 static char *choose_server(char *);
@@ -108,7 +110,7 @@
 
 	country = host = qnichost = NULL;
 	flags = use_qnichost = 0;
-	while ((ch = getopt(argc, argv, "aAbc:dgh:iIklmp:QrR6")) != -1) {
+	while ((ch = getopt(argc, argv, "aAbc:dfgh:iIklmp:QrR6")) != -1) {
 		switch (ch) {
 		case 'a':
 			host = ANICHOST;
@@ -125,6 +127,9 @@
 		case 'd':
 			host = DNICHOST;
 			break;
+		case 'f':
+			host = FNICHOST;
+			break;
 		case 'g':
 			host = GNICHOST;
 			break;
@@ -355,7 +360,7 @@
 usage(void)
 {
 	fprintf(stderr,
-	    "usage: whois [-aAbdgiIklmQrR6] [-c country-code | -h hostname] "
+	    "usage: whois [-aAbdfgiIklmQrR6] [-c country-code | -h hostname] "
 	    "[-p port] name ...\n");
 	exit(EX_USAGE);
 }
--- usr.bin/whois/whois.1.orig	Wed Apr 27 23:39:02 2005
+++ usr.bin/whois/whois.1	Wed Apr 27 23:58:04 2005
@@ -40,7 +40,7 @@
 .Nd "Internet domain name and network number directory service"
 .Sh SYNOPSIS
 .Nm
-.Op Fl aAbdgiIklmQrR6
+.Op Fl aAbdfgiIklmQrR6
 .Op Fl c Ar country-code | Fl h Ar host
 .Op Fl p Ar port
 .Ar name ...
@@ -58,7 +58,7 @@
 .Pq Tn ARIN
 database.
 It contains network numbers used in those parts of the world covered neither by
-.Tn APNIC
+.Tn APNIC , AfriNIC , LACNIC ,
 nor by
 .Tn RIPE .
 .Pp
@@ -87,6 +87,11 @@
 database.
 It contains points of contact for subdomains of
 .Pa .MIL .
+.It Fl f
+Use the African Network Information Centre
+.Pq Tn AfriNIC
+database. It contains network numbers used in Africa and the islands of the
+western Indian Ocean.
 .It Fl g
 Use the US non-military federal government database, which contains points of
 contact for subdomains of
@@ -112,7 +117,7 @@
 If a query to
 .Tn ARIN
 references
-.Tn APNIC , LACNIC ,
+.Tn APNIC , AfriNIC , LACNIC ,
 or
 .Tn RIPE ,
 that server will be queried also, provided that the
--- whois-afrinic.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504272305.j3RN56pJ081997>