Changeset 449
- Timestamp:
- 01/10/13 17:18:52 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r448 r449 4624 4624 foreach my $ipprefix (split /[,\s]+/, $lochash->{$location}{iplist}) { 4625 4625 $ipprefix =~ s/\s+//g; 4626 print $datafile "%$location:$ipprefix\n"; 4626 $ipprefix = new NetAddr::IP $ipprefix; 4627 ##fixme: how to handle IPv6? 4628 next if $ipprefix->{isv6}; 4629 # have to account for /nn CIDR entries. tinydns only speaks octet-sliced prefix. 4630 if ($ipprefix->masklen <= 8) { 4631 foreach ($ipprefix->split(8)) { 4632 my $tmp = $_->addr; 4633 $tmp =~ s/\.\d+\.\d+\.\d+$//; 4634 print $datafile "%$location:$tmp\n"; 4635 } 4636 } elsif ($ipprefix->masklen <= 16) { 4637 foreach ($ipprefix->split(16)) { 4638 my $tmp = $_->addr; 4639 $tmp =~ s/\.\d+\.\d+$//; 4640 print $datafile "%$location:$tmp\n"; 4641 } 4642 } elsif ($ipprefix->masklen <= 24) { 4643 foreach ($ipprefix->split(24)) { 4644 my $tmp = $_->addr; 4645 $tmp =~ s/\.\d+$//; 4646 print $datafile "%$location:$tmp\n"; 4647 } 4648 } else { 4649 foreach ($ipprefix->split(32)) { 4650 print $datafile "%$location:".$_->addr."\n"; 4651 } 4652 } 4627 4653 } 4628 4654 print $datafile "%$location\n" if !$lochash->{$location}{iplist};
Note:
See TracChangeset
for help on using the changeset viewer.