r35604 - in /trunk/libnet-patricia-perl: Changes MANIFEST META.yml Patricia.pm Patricia.xs debian/changelog debian/control libpatricia/patricia.c test.pl

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Sun May 17 20:59:05 UTC 2009


Author: ryan52-guest
Date: Sun May 17 20:58:59 2009
New Revision: 35604

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35604
Log:
* New upstream release
* Add myself to Uploaders
* Debian Policy 3.8.1

Added:
    trunk/libnet-patricia-perl/META.yml
      - copied unchanged from r35603, branches/upstream/libnet-patricia-perl/current/META.yml
Modified:
    trunk/libnet-patricia-perl/Changes
    trunk/libnet-patricia-perl/MANIFEST
    trunk/libnet-patricia-perl/Patricia.pm
    trunk/libnet-patricia-perl/Patricia.xs
    trunk/libnet-patricia-perl/debian/changelog
    trunk/libnet-patricia-perl/debian/control
    trunk/libnet-patricia-perl/libpatricia/patricia.c
    trunk/libnet-patricia-perl/test.pl

Modified: trunk/libnet-patricia-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Changes?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Changes (original)
+++ trunk/libnet-patricia-perl/Changes Sun May 17 20:58:59 2009
@@ -3,6 +3,10 @@
 TODO
         - add AF_INET6 support
         - add POD describing Graham Barr's API improvements
+
+1.015 Sun Jan 25 19:07 2009 (alpha)
+	- fixed bugs #14244, #20219
+	- added _integer methods to add/remove entries
 
 1.014 Thu Dec  8 18:05 2005
         - fixed the "climb_inorder" item in the POD

Modified: trunk/libnet-patricia-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/MANIFEST?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/MANIFEST (original)
+++ trunk/libnet-patricia-perl/MANIFEST Sun May 17 20:58:59 2009
@@ -13,3 +13,4 @@
 demo/demo.c
 typemap
 COPYING
+META.yml                                 Module meta-data (added by MakeMaker)

Modified: trunk/libnet-patricia-perl/Patricia.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Patricia.pm?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Patricia.pm (original)
+++ trunk/libnet-patricia-perl/Patricia.pm Sun May 17 20:58:59 2009
@@ -1,5 +1,6 @@
 #  Net::Patricia - Patricia Trie perl module for fast IP address lookups
 #  Copyright (C) 2000-2005  Dave Plonka
+#  Copyright (C) 2009       Dave Plonka & Philip Prindeville
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -15,20 +16,22 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-# $Id: Patricia.pm,v 1.14 2005/12/09 00:03:56 dplonka Exp $
 # Dave Plonka <plonka at doit.wisc.edu>
+# Philip Prindeville <philipp at redfish-solutions.com>
 
 package Net::Patricia;
 
+use version;
 use strict;
 use Carp;
 use vars qw($VERSION @ISA);
-use Socket qw(AF_INET inet_aton);
+use Socket qw(AF_INET inet_aton inet_ntoa);
 
 require DynaLoader;
+require 5.6.0;
 
 @ISA = qw(DynaLoader);
-'$Revision: 1.14 $' =~ m/(\d+)\.(\d+)/ && (( $VERSION ) = sprintf("%d.%03d", $1, $2));
+'$Revision: 1.15 $' =~ m/(\d+)\.(\d+)(\.\d+)?/ && ( $VERSION = "$1.$2$3");
 
 bootstrap Net::Patricia $VERSION;
 
@@ -86,39 +89,51 @@
 
 sub Net::Patricia::AF_INET::add {
   my ($self, $ip, $bits, $data) = @_;
-  $data ||= $bits ? "$ip/$bits" : $ip;
+  $data ||= defined $bits ? "$ip/$bits" : $ip;
   my $packed = inet_aton($ip) || croak("invalid key");
-  _add($self,AF_INET,$packed,$bits || 32, $data);
+  _add($self,AF_INET,$packed,(defined $bits ? $bits : 32), $data);
+}
+
+sub Net::Patricia::AF_INET::add_integer {
+  my ($self, $num, $bits, $data) = @_;
+  my $packed = pack("N", $num);
+  my $ip = inet_ntoa($packed) || croak("invalid address");
+  $data ||= defined $bits ? "$ip/$bits" : $ip;
+  _add($self,AF_INET,$packed,(defined $bits ? $bits : 32), $data);
 }
 
 sub Net::Patricia::AF_INET::match_integer {
   my ($self, $num, $bits) = @_;
-  _match($self,AF_INET,pack("N",$num),$bits || 32);
+  _match($self,AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
 }
 
 sub Net::Patricia::AF_INET::exact_integer {
   my ($self, $num, $bits) = @_;
-  _exact($self,AF_INET,pack("N",$num),$bits || 32);
+  _exact($self,AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
 }
 
 sub Net::Patricia::AF_INET::match {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_aton($ip) || croak("invalid key");
-  _match($self,AF_INET,$packed,$bits || 32);
+  _match($self,AF_INET,$packed,(defined $bits ? $bits : 32));
 }
 
 sub Net::Patricia::AF_INET::exact {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_aton($ip) || croak("invalid key");
-  _exact($self,AF_INET,$packed,$bits || 32);
+  _exact($self,AF_INET,$packed,(defined $bits ? $bits : 32));
 }
 
 sub Net::Patricia::AF_INET::remove {
   my ($self, $ip, $bits) = @_;
   my $packed = inet_aton($ip) || return undef;
-  _remove($self,AF_INET,$packed,$bits || 32);
-}
-
+  _remove($self,AF_INET,$packed,(defined $bits ? $bits : 32));
+}
+
+sub Net::Patricia::AF_INET::remove_integer {
+  my ($self, $num, $bits) = @_;
+  _remove($self,AF_INET,pack("N",$num),(defined $bits ? $bits : 32));
+}
 
 1;
 __END__
@@ -328,34 +343,6 @@
 
 =head1 BUGS
 
-The match_string method ignores the mask bits/width, if specified, in
-its argument.  So, if you add two prefixes with the same base address
-but different mask widths, this module will match the most-specific
-prefix even if that prefix doesn't wholly cotain the prefix specified
-by the match argument.  For example:
-
-   use Net::Patricia;
-   my $pt = new Net::Patricia;
-   $pt->add_string('192.168.0.0/25');
-   $pt->add_string('192.168.0.0/16');
-   print $pt->match_string('192.168.0.0/24'), "\n";
-
-prints "192.168.0.0/25", just as if you had called:
-
-   print $pt->match_string('192.168.0.0'), "\n";
-
-This issue was reported to me by John Payne, who also provided a
-candidate patch, but I have not applied it since I hesitate to change
-this behavior which was inherited from MRT.  Consequently, this module
-might seem to violate the principle of least surprise if you specific
-the mask bits when trying to find the best match.
-
-Methods to add or remove nodes using integer arguments are yet to be
-implemented.  This was a lower priority since it is less necessary to
-avoid the overhead involved in translation from a string representation
-since add and remove operations are usually performed less frequently
-than matching operations.
-
 This modules does not yet support AF_INET6 (IP version 6) 128 bit
 addresses, although the underlying patricialib C code does.
 
@@ -370,8 +357,10 @@
 =head1 AUTHOR
 
 Dave Plonka <plonka at doit.wisc.edu>
-
-Copyright (C) 2000-2005  Dave Plonka.  This program is free software; you
+Philip Prindeville <philipp at redfish-solutions.com>
+
+Copyright (C) 2000-2005  Dave Plonka.  Copyright (C) 2009  Dave Plonka
+& Philip Prindeville.  This program is free software; you
 can redistribute it and/or modify it under the terms of the GNU General
 Public License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

Modified: trunk/libnet-patricia-perl/Patricia.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/Patricia.xs?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/Patricia.xs (original)
+++ trunk/libnet-patricia-perl/Patricia.xs Sun May 17 20:58:59 2009
@@ -140,7 +140,7 @@
 
 #define Fill_Prefix(p,f,a,b,mb) \
 	do { \
-		if (b <= 0 || b > mb) \
+		if (b < 0 || b > mb) \
 		  croak("invalid key"); \
 		memcpy(&p.add.sin, a, (mb+7)/8); \
 		p.family = f; \

Modified: trunk/libnet-patricia-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/debian/changelog?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/debian/changelog (original)
+++ trunk/libnet-patricia-perl/debian/changelog Sun May 17 20:58:59 2009
@@ -1,12 +1,18 @@
-libnet-patricia-perl (1.014-5) UNRELEASED; urgency=low
+libnet-patricia-perl (1.15-1) UNRELEASED; urgency=low
 
+  [ gregor herrmann ]
   * Add debian/README.source to document quilt usage, as required by
     Debian Policy since 3.8.0.
   * debian/control: Changed: Switched Vcs-Browser field to ViewSVN
     (source stanza).
   * debian/control: Added: ${misc:Depends} to Depends: field.
 
- -- gregor herrmann <gregoa at debian.org>  Wed, 06 Aug 2008 21:33:58 -0300
+  [ Ryan Niebur ]
+  * New upstream release
+  * Add myself to Uploaders
+  * Debian Policy 3.8.1
+
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Sun, 17 May 2009 13:58:50 -0700
 
 libnet-patricia-perl (1.014-4) unstable; urgency=low
 

Modified: trunk/libnet-patricia-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/debian/control?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/debian/control (original)
+++ trunk/libnet-patricia-perl/debian/control Sun May 17 20:58:59 2009
@@ -5,9 +5,9 @@
 Uploaders: Michael Zehrer <zehrer at zepan.org>,
  Niko Tyni <ntyni at iki.fi>,
  Damyan Ivanov <dmn at debian.org>,
- gregor herrmann <gregoa at debian.org>
+ gregor herrmann <gregoa at debian.org>, Ryan Niebur <ryanryan52 at gmail.com>
 Build-Depends: debhelper (>= 6), perl (>= 5.8.0-3), quilt (>= 0.40)
-Standards-Version: 3.7.3
+Standards-Version: 3.8.1
 Homepage: http://search.cpan.org/dist/Net-Patricia/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnet-patricia-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libnet-patricia-perl/

Modified: trunk/libnet-patricia-perl/libpatricia/patricia.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/libpatricia/patricia.c?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/libpatricia/patricia.c (original)
+++ trunk/libnet-patricia-perl/libpatricia/patricia.c Sun May 17 20:58:59 2009
@@ -639,7 +639,7 @@
 #endif /* PATRICIA_DEBUG */
 	if (comp_with_mask (prefix_tochar (node->prefix), 
 			    prefix_tochar (prefix),
-			    node->prefix->bitlen)) {
+			    node->prefix->bitlen) && node->prefix->bitlen <= bitlen) {
 #ifdef PATRICIA_DEBUG
             fprintf (stderr, "patricia_search_best: found %s/%d\n", 
 	             prefix_toa (node->prefix), node->prefix->bitlen);

Modified: trunk/libnet-patricia-perl/test.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-patricia-perl/test.pl?rev=35604&op=diff
==============================================================================
--- trunk/libnet-patricia-perl/test.pl (original)
+++ trunk/libnet-patricia-perl/test.pl Sun May 17 20:58:59 2009
@@ -6,7 +6,7 @@
 # Change 1..1 below to 1..last_test_to_print .
 # (It may become useful if the test is moved to ./t subdirectory.)
 
-BEGIN { $| = 1; $debug = 1; print "1..18\n"; }
+BEGIN { $| = 1; $debug = 1; print "1..19\n"; }
 END {print "not ok 1\n" unless $loaded;}
 use Net::Patricia;
 $loaded = 1;
@@ -128,6 +128,10 @@
    print "not ok 18\n"
 }
 
+$t->add_string('0/0');
+
+print $t->match_string("10.0.0.1")?"ok 19\n":"not ok 19\n";
+
 undef $t;
 
 exit;




More information about the Pkg-perl-cvs-commits mailing list