relay: use IETF IP testing addresses

This commit is contained in:
Matt Simerson 2012-05-21 15:36:37 -04:00
parent 2727b8529c
commit 8795d4fd6e
3 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
# sample entries, used for testing # test entries - http://tools.ietf.org/html/rfc5737
192.168.99.5 192.0.99.5
192.168.99.6 192.0.99.6
192.168.98. 192.0.98.
# add your own entries below... # add your own entries below...

View File

@ -2,4 +2,4 @@
# e.g. "127.0.0.1", or "192.168." # e.g. "127.0.0.1", or "192.168."
127.0.0.1 127.0.0.1
# leading/trailing whitespace is ignored # leading/trailing whitespace is ignored
192.168. 192.0.

View File

@ -33,24 +33,24 @@ sub test_is_octet_match {
$self->populate_relayclients(); $self->populate_relayclients();
$self->qp->connection->remote_ip('192.168.1.1'); $self->qp->connection->remote_ip('192.0.1.1');
ok( $self->is_octet_match(), "match, +"); ok( $self->is_octet_match(), "match, +");
$self->qp->connection->remote_ip('192.169.1.1'); $self->qp->connection->remote_ip('192.51.1.1');
ok( ! $self->is_octet_match(), "nope, -"); ok( ! $self->is_octet_match(), "nope, -");
$self->qp->connection->remote_ip('10.10.10.10'); $self->qp->connection->remote_ip('203.0.113.0');
ok( ! $self->is_octet_match(), "nope, -"); ok( ! $self->is_octet_match(), "nope, -");
}; };
sub test_is_in_cidr_block { sub test_is_in_cidr_block {
my $self = shift; my $self = shift;
$self->qp->connection->remote_ip('192.168.1.1'); $self->qp->connection->remote_ip('192.0.1.1');
$self->{_cidr_blocks} = [ '192.168.1.0/24' ]; $self->{_cidr_blocks} = [ '192.0.1.0/24' ];
ok( $self->is_in_cidr_block(), "match, +" ); ok( $self->is_in_cidr_block(), "match, +" );
$self->{_cidr_blocks} = [ '192.168.0.0/24' ]; $self->{_cidr_blocks} = [ '192.0.0.0/24' ];
ok( ! $self->is_in_cidr_block(), "nope, -" ); ok( ! $self->is_in_cidr_block(), "nope, -" );
@ -65,8 +65,8 @@ sub test_is_in_cidr_block {
sub test_is_in_norelayclients { sub test_is_in_norelayclients {
my $self = shift; my $self = shift;
my @matches = qw/ 192.168.99.5 192.168.98.1 192.168.98.255 /; my @matches = qw/ 192.0.99.5 192.0.98.1 192.0.98.255 /;
my @false = qw/ 192.168.99.7 192.168.109.7 /; my @false = qw/ 192.0.99.7 192.0.109.7 /;
foreach ( @matches ) { foreach ( @matches ) {
$self->qp->connection->remote_ip($_); $self->qp->connection->remote_ip($_);