diff --git a/Makefile b/Makefile index 8f3f38d..f258701 100644 --- a/Makefile +++ b/Makefile @@ -94,9 +94,6 @@ version.h: debian/changelog make_version_h.pl as_del.h: as_del_list make_as_del.pl $(PERL) make_as_del.pl < $< > $@ -as32_del.h: as32_del_list make_as32_del.pl - $(PERL) make_as32_del.pl < $< > $@ - ip_del.h: ip_del_list make_ip_del.pl $(PERL) make_ip_del.pl < $< > $@ @@ -152,7 +149,7 @@ distclean: clean rm -f version.h po/whois.pot clean: - rm -f Makefile.depend as_del.h as32_del.h ip_del.h ip6_del.h \ + rm -f Makefile.depend as_del.h ip_del.h ip6_del.h \ nic_handles.h new_gtlds.h tld_serv.h servers_charset.h \ *.o whois mkpasswd rm -f po/*.mo diff --git a/as32_del_list b/as32_del_list deleted file mode 100644 index ab99059..0000000 --- a/as32_del_list +++ /dev/null @@ -1,19 +0,0 @@ -# http://www.iana.org/assignments/as-numbers - -# actually I listed here also the unallocated space reserved for each RIR - -131077 131086 whois.nic.ad.jp -131092 131101 whois.nic.or.kr -131152 131161 whois.nic.ad.jp -131791 131890 whois.nic.or.kr -131893 131992 whois.nic.ad.jp - -2.0 2.65535 apnic -3.0 3.65535 ripe -4.0 4.65535 lacnic -5.0 5.65535 afrinic -6.0 6.65535 arin - -# private ASN block -4200000000 4294967294 ripe - diff --git a/as_del_list b/as_del_list index 96a3756..625090a 100644 --- a/as_del_list +++ b/as_del_list @@ -95,3 +95,19 @@ # documentation and private ASN block 64496 65534 ripe +131077 131086 whois.nic.ad.jp +131092 131101 whois.nic.or.kr +131152 131161 whois.nic.ad.jp +131791 131890 whois.nic.or.kr +131893 131992 whois.nic.ad.jp + +# actually I listed here also the unallocated space reserved for each RIR +2.0 2.65535 apnic +3.0 3.65535 ripe +4.0 4.65535 lacnic +5.0 5.65535 afrinic +6.0 6.65535 arin + +# private ASN block +4200000000 4294967294 ripe + diff --git a/data.h b/data.h index cb3ccd8..342b2fe 100644 --- a/data.h +++ b/data.h @@ -118,8 +118,8 @@ const struct ip6_del ip6_assign[] = { }; struct as_del { - const unsigned short first; - const unsigned short last; + const unsigned long first; + const unsigned long last; const char *serv; }; @@ -128,17 +128,6 @@ const struct as_del as_assign[] = { { 0, 0, NULL } }; -struct as32_del { - const unsigned long first; - const unsigned long last; - const char *serv; -}; - -const struct as32_del as32_assign[] = { -#include "as32_del.h" - { 0, 0, NULL } -}; - const char *new_gtlds[] = { #include "new_gtlds.h" NULL diff --git a/make_as32_del.pl b/make_as32_del.pl deleted file mode 100755 index 51fdc00..0000000 --- a/make_as32_del.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -# SPDX-License-Identifier: GPL-2.0-or-later - -use warnings; -use strict; - -while (<>) { - chomp; - s/#.*$//; - s/^\s+//; s/\s+$//; - next if /^$/; - - my ($fh, $fl, $lh, $ll, $s, $f, $l); - if (($fh, $fl, $lh, $ll, $s) = - /^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/) { - $f = ($fh << 16) + $fl; - $l = ($lh << 16) + $ll; - - my $server = ($s =~ /\./) ? $s : "whois.$s.net"; - print qq|{ ${f}u, ${l}u,\t"$server" },\t/* $fh.$fl $lh.$ll */\n|; - } elsif (($f, $l, $s) = /^(\d+)\s+(\d+)\s+([\w\.-]+)$/) { - my $server = ($s =~ /\./) ? $s : "whois.$s.net"; - print qq|{ ${f}u, ${l}u,\t"$server" },\n|; - } else { - die "format error: $_"; - } -} - diff --git a/make_as_del.pl b/make_as_del.pl index d27da63..0248678 100755 --- a/make_as_del.pl +++ b/make_as_del.pl @@ -12,18 +12,22 @@ while (<>) { s/^\s+//; s/\s+$//; next if /^$/; - die "format error: $_" if not (/^([\d\.]+)\s+([\d\.]+)\s+([\w\.]+)$/); - my $f = $1; my $l = $2; my $s = $3; + my ($fh, $fl, $lh, $ll, $s, $f, $l); + my $comment = ''; + if (($fh, $fl, $lh, $ll, $s) = + /^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/) { + $f = ($fh << 16) + $fl; + $l = ($lh << 16) + $ll; + $comment = qq|\t/* $fh.$fl $lh.$ll */|; + } elsif (($f, $l, $s) = /^(\d+)\s+(\d+)\s+([\w\.-]+)$/) { + } else { + die "format error: $_"; + } die "constraint violated: $l < $last_l" if $l < $last_l; $last_l = $l; - print "{ ${f}, ${l}, \""; - if ($s =~ /\./) { - print "$s"; - } else { - print "whois.$s.net"; - } - print qq(" },\n); + my $server = ($s =~ /\./) ? $s : "whois.$s.net"; + print qq|{ ${f}u, ${l}u,\t"$server" },$comment\n|; } diff --git a/whois.c b/whois.c index 8d93c21..0a06b76 100644 --- a/whois.c +++ b/whois.c @@ -638,15 +638,9 @@ const char *whereas(const unsigned long asn) { int i; - if (asn > 65535) { - for (i = 0; as32_assign[i].serv; i++) - if (asn >= as32_assign[i].first && asn <= as32_assign[i].last) - return as32_assign[i].serv; - } else { - for (i = 0; as_assign[i].serv; i++) - if (asn >= as_assign[i].first && asn <= as_assign[i].last) - return as_assign[i].serv; - } + for (i = 0; as_assign[i].serv; i++) + if (asn >= as_assign[i].first && asn <= as_assign[i].last) + return as_assign[i].serv; return "\x06"; }