]> git.proxmox.com Git - pve-firewall.git/commitdiff
add tests for corosync multicast addrtype rules
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 20 May 2014 06:24:31 +0000 (08:24 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 20 May 2014 06:24:31 +0000 (08:24 +0200)
test/fwtester.pl
test/test-default-rules1/tests

index 17b883d51a4fec531139abfe3e04e1820deb4914..a99a7906ded4d1865bfd9b579dc4e016baae7332 100755 (executable)
@@ -81,8 +81,16 @@ sub rule_match {
            die "please implement cstate test '$cstate'";
        }
 
-       if ($rule =~ s/^-m addrtype\s*//) {
-           return undef; # simply ignore
+       if ($rule =~ s/^-m addrtype --src-type (\S+)\s*//) {
+           my $atype = $1;
+           die "missing srctype" if !$pkg->{srctype};
+           return undef if $atype ne $pkg->{srctype};
+       }
+
+       if ($rule =~ s/^-m addrtype --dst-type (\S+)\s*//) {
+           my $atype = $1;
+           die "missing dsttype" if !$pkg->{dsttype};
+           return undef if $atype ne $pkg->{dsttype};
        }
 
        if ($rule =~ s/^-i (\S+)\s*//) {
@@ -485,6 +493,8 @@ sub simulate_firewall {
        dport => undef,
        source => undef,
        dest => undef,
+       srctype => 'UNICAST',
+       dsttype => 'UNICAST',
     };
 
     while (my ($k,$v) = each %$test) {
index 58c7743327385305a5142b6cfb9bea455eec2d1e..4aaf7c441bcd84157c7706e50fd4d33e6886e818 100644 (file)
@@ -12,6 +12,8 @@
 { from => 'host', to => 'outside', dest => '172.16.1.3', proto => 'udp', dport => 5404, action => 'ACCEPT' }
 { from => 'host', to => 'outside', dest => '172.16.1.3', proto => 'udp', dport => 5405, action => 'ACCEPT' }
 { from => 'host', to => 'outside', dest => '172.16.1.3', proto => 'udp', dport => 5406, action => 'DROP' }
+{ from => 'host', to => 'outside', dest => '239.192.158.83', proto => 'udp', dport => 5404, dsttype => 'UNICAST', action => 'DROP' }
+{ from => 'host', to => 'outside', dest => '239.192.158.83', proto => 'udp', dport => 5404, dsttype => 'MULTICAST', action => 'ACCEPT' }
 
 
 # traffic from other node
@@ -26,6 +28,8 @@
 { from => 'outside', to => 'host', source => '172.16.1.3', proto => 'udp', dport => 5404, action => 'ACCEPT' }
 { from => 'outside', to => 'host', source => '172.16.1.3', proto => 'udp', dport => 5405, action => 'ACCEPT' }
 { from => 'outside', to => 'host', source => '172.16.1.3', proto => 'udp', dport => 5406, action => 'DROP' }
+{ from => 'outside', to => 'host', source => '172.16.1.3', dest => '239.192.158.83', proto => 'udp', dport => 5404, dsttype => 'UNICAST', action => 'DROP' }
+{ from => 'outside', to => 'host', source => '172.16.1.3', dest => '239.192.158.83', proto => 'udp', dport => 5404, dsttype => 'MULTICAST', action => 'ACCEPT' }
 
 
 { from => 'host', to => 'ct200', action => 'DROP' }