From 93d96f83f9fc7ee567ce055a6efb4ab14a3939f5 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 21 May 2014 08:56:52 +0200 Subject: [PATCH] fix for test case test/test-errors1 --- src/PVE/Firewall.pm | 4 ++-- test/test-errors1/100.fw | 4 +++- test/test-errors1/tests | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm index 3a96179..eda3e55 100644 --- a/src/PVE/Firewall.pm +++ b/src/PVE/Firewall.pm @@ -1318,8 +1318,8 @@ sub ruleset_generate_cmdstr { } } } elsif ($rule->{dport} || $rule->{sport}) { - warn "ignoring destination port '$rule->{dport}' - no protocol specified\n" if $rule->{dport}; - warn "ignoring source port '$rule->{sport}' - no protocol specified\n" if $rule->{sport}; + die "destination port '$rule->{dport}', but no protocol specified\n" if $rule->{dport}; + die "source port '$rule->{sport}', but no protocol specified\n" if $rule->{sport}; } push @cmd, "-m addrtype --dst-type $rule->{dsttype}" if $rule->{dsttype}; diff --git a/test/test-errors1/100.fw b/test/test-errors1/100.fw index 25d9a2c..27a3593 100644 --- a/test/test-errors1/100.fw +++ b/test/test-errors1/100.fw @@ -4,6 +4,8 @@ enable: 1 [RULES] -# rule with dport but missing protocol +# rule with dport but missing protocol - should be ignored IN ACCEPT -dport 80 +# correct rule +IN ACCEPT -p tcp -dport 82 diff --git a/test/test-errors1/tests b/test/test-errors1/tests index 4c4bf67..99380b9 100644 --- a/test/test-errors1/tests +++ b/test/test-errors1/tests @@ -1,2 +1,3 @@ -{ from => 'outside', to => 'vm100', dport => 80, action => 'ACCEPT' } -{ from => 'outside', to => 'vm100', dport => 81, action => 'DROP' } \ No newline at end of file +{ from => 'outside', to => 'vm100', dport => 80, action => 'DROP' } +{ from => 'outside', to => 'vm100', dport => 81, action => 'DROP' } +{ from => 'outside', to => 'vm100', dport => 82, action => 'ACCEPT' } -- 2.39.2