Skip Menu |

This queue is for tickets about the Net-IP-Match-XS CPAN distribution.

Report information
The Basics
Id: 13819
Status: new
Priority: 0/
Queue: Net-IP-Match-XS

People
Owner: Nobody in particular
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: (no value)



Subject: Fails when mask is /1
The following simple test yields erroneous results: perl -MNet::IP::Match::XS -le'print match_ip("212.199.130.15","167.218.137.215/1")?"yes":"no"' It incorrectly prints "yes" on both Linux and MacOSX. It looks like the "/1" mask is being interpreted as /31 Linux: RedHat 8.0, Perl 5.8.6 MacOSX: 10.3.9, Perl 5.8.1 (Apple's Perl distro) Other failures I found: perl -MNet::IP::Match::XS -le'print match_ip("212.199.130.15","212.199.130.0/2")?"yes":"no"' perl -MNet::IP::Match::XS -le'print match_ip("212.199.130.15","212.199.131.0/2")?"yes":"no"' (note: these IPs were initially chosen at random).
Subject: Fails for some masks
From: cdolan [...] cpan.org
Oops, it looks like my interpretation of /1 as the problem was wrong. I wrote some more tests into t/Net-IP-Match-XS.t and several succeed that should fail. With the attached test file, I get the following results on MacOSX 10.3.9, Perl 5.8.1: perl -Mblib t/Net-IP-Match-XS.t 1..8 ok 1 - use Net::IP::Match::XS; ok 2 - check non-match ok 3 - check match ok 4 - check another match not ok 5 - check another match # Failed test (t/Net-IP-Match-XS.t at line 33) not ok 6 - check another match # Failed test (t/Net-IP-Match-XS.t at line 35) not ok 7 - check another match # Failed test (t/Net-IP-Match-XS.t at line 37) ok 8 - check another match # Looks like you failed 3 tests of 8.
#!/usr/bin/perl use strict; use warnings; use FindBin qw($Bin); use Test::More tests => 8; ################# test 1 (should succeed) ####################### BEGIN { use_ok('Net::IP::Match::XS') }; my $match; ################# test 2 (should fail) ####################### $match = match_ip( qw( 207.175.219.202 10.0.0.0/8 99.99.99 ) ); ok( ! $match, "check non-match" ); ################# test 3 (should succeed) ####################### $match = match_ip( qw( 207.175.219.202 10.0.0.0/8 192.168.0.0/16 207.175.219.200/29 ) ); ok( $match, "check match" ); ################# test 4 (should succeed) ####################### my @ips = split / /, '10.0.0.0/8 192.168.0.0/16 207.175.219.200/29'; $match = match_ip( "'207.175.219.202xxx'", @ips ); ok( $match, "check another match" ); $match = match_ip( qw( 209.249.163.62 209.249.163.0/1) ); ok( !$match, "check another match" ); $match = match_ip( qw( 209.249.163.62 209.249.163.0/2) ); ok( !$match, "check another match" ); $match = match_ip( qw( 209.249.163.62 209.249.163.0/4) ); ok( !$match, "check another match" ); $match = match_ip( qw( 209.249.163.62 209.249.163.0/8) ); ok( $match, "check another match" );
From: cdolan [...] cpan.org
Aaauuggghhh, never mind... I was confused about the way masking works. I thought /1 was just the single IP. What I meant was /32. Please ignore/delete this bug.