Subject: | Net-IPTrie-v0.2 add() rejects all-zero prefixes |
Trying to add the IPv4 default prefix '0.0.0.0/0' croaks "Missing
required arguments: address or iaddress". Please find attached a patch
for fixing this (and a typo in SYNOPSIS).
Distribution name and version: Net-IPTrie-v0.2
Perl version: v5.8.5 built for i386-linux-thread-multi
Operating System vendor and version: Red Hat Enterprise Linux AS4 update 6
Subject: | Net-IPTrie.diff |
diff -ruN Net-IPTrie-v0.2.orig/lib/Net/IPTrie.pm Net-IPTrie-v0.2/lib/Net/IPTrie.pm
--- Net-IPTrie-v0.2.orig/lib/Net/IPTrie.pm 2007-10-10 21:47:32.000000000 +0300
+++ Net-IPTrie-v0.2/lib/Net/IPTrie.pm 2007-11-25 16:39:47.000000000 +0200
@@ -18,7 +18,7 @@
use Net::IPTrie;
my $tr = Net::IPTrie->new(version=>4); # IPv4
- my $n = $tr->add(addres=>'10.0.0.0/8', prefix=>8);
+ my $n = $tr->add(address=>'10.0.0.0/8', prefix=>8);
my $a = $tr->add(address=>'10.0.0.1', data) # prefix defaults to 32
$a->parent->address eq $n->address or die "?";
@@ -139,7 +139,7 @@
croak "find is an instance method" unless ref($self);
my ($address, $iaddress, $prefix, $deep) = @argv{'address', 'iaddress', 'prefix', 'deep'};
- croak "Missing required arguments: address or iaddress" unless ($address || $iaddress);
+ croak "Missing required arguments: address or iaddress" unless ( defined $address || defined $iaddress);
$prefix = $self->size unless ( $prefix );
my $p = $self->{_trie}; # pointer that starts at the root
@@ -204,7 +204,7 @@
croak "add is an instance method" unless ref($self);
my ($address, $iaddress, $prefix, $data) = @argv{'address', 'iaddress', 'prefix', 'data'};
- croak "Missing required arguments: address" unless ( $address || $iaddress );
+ croak "Missing required arguments: address" unless ( defined $address || defined $iaddress );
$prefix = $self->size unless ( $prefix );