Use the IANA recovered address space list

This commit is contained in:
Marco d'Itri 2014-05-21 16:00:37 +02:00
parent 6a0956c7e5
commit b1299db453
3 changed files with 50 additions and 0 deletions

1
data.h
View File

@ -102,6 +102,7 @@ struct ip_del {
};
const struct ip_del ip_assign[] = {
#include "ip_del_recovered.h"
#include "ip_del.h"
{ 0, 0, NULL }
};

18
ip_del_recovered.h Normal file
View File

@ -0,0 +1,18 @@
{ 736100352UL, 736624639UL, "whois.apnic.net" },
{ 736886784UL, 737411071UL, "whois.apnic.net" },
{ 737476608UL, 738000895UL, "whois.apnic.net" },
{ 738066432UL, 738197503UL, "whois.apnic.net" },
{ 757071872UL, 759169023UL, "whois.arin.net" },
{ 759169024UL, 759238655UL, "whois.apnic.net" },
{ 763363328UL, 765460479UL, "whois.ripe.net" },
{ 765460480UL, 767557631UL, "whois.lacnic.net" },
{ 767557632UL, 769589247UL, "whois.afrinic.net" },
{ 2523594752UL, 2523660287UL, "whois.apnic.net" },
{ 2525036544UL, 2525102079UL, "whois.apnic.net" },
{ 2532442112UL, 2532507647UL, "whois.apnic.net" },
{ 2584739840UL, 2584805375UL, "whois.afrinic.net" },
{ 2737767424UL, 2737771263UL, "whois.apnic.net" },
{ 2737771520UL, 2737772031UL, "whois.apnic.net" },
{ 2737774592UL, 2737778175UL, "whois.apnic.net" },
{ 2737778432UL, 2737831935UL, "whois.apnic.net" },
{ 2738159616UL, 2738225151UL, "whois.apnic.net" },

31
make_ip_del_recovered.pl Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/perl
# https://www.iana.org/assignments/ipv4-recovered-address-space/ipv4-recovered-address-space-2.csv
use warnings;
use strict;
use autodie;
use Text::CSV;
my $csv = Text::CSV->new;
open(my $in, '<', 'ipv4-recovered-address-space-2.csv');
open(my $out, '>', 'ip_del_recovered.h');
while (my $row = $csv->getline($in)) {
next if $row->[0] eq 'Start address';
next if $row->[5] ne 'ALLOCATED';
my ($b1, $b2, $b3, $b4) = split(/\./, $row->[0]);
my ($e1, $e2, $e3, $e4) = split(/\./, $row->[1]);
die if not defined $b4 or not defined $e4;
print $out '{ ' .
(($b1 << 24) + ($b2 << 16) + ($b3 << 8) + $b4) . 'UL, ' .
(($e1 << 24) + ($e2 << 16) + ($e3 << 8) + $e4) . 'UL, ' .
'"' . $row->[4] . qq|" },\n|;
}
close($in);
close($out);