From 542f27954494d3556e4f3b8196636af49f462706 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 1 Aug 2012 10:01:08 -0700 Subject: [PATCH] Don't allow a source interface in a DNAT/REDIRECT rule with source == firewall Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Nat.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Nat.pm b/Shorewall/Perl/Shorewall/Nat.pm index 3a7f3aab8..1a23a28c0 100644 --- a/Shorewall/Perl/Shorewall/Nat.pm +++ b/Shorewall/Perl/Shorewall/Nat.pm @@ -632,12 +632,13 @@ sub handle_nat_rule( $$$$$$$$$$$$ ) { # # And generate the nat table rule(s) # + my $firewallsource = $sourceref && ( $sourceref->{type} & ( FIREWALL | VSERVER ) ); + expand_rule ( ensure_chain ('nat' , - ( $action_chain ? - $action_chain : - ( $sourceref->{type} == FIREWALL ? 'OUTPUT' : - dnat_chain $sourceref->{name} ) ) ), - PREROUTE_RESTRICT , + ( $action_chain ? $action_chain : + $firewallsource ? 'OUTPUT' : + dnat_chain $sourceref->{name} ) ) , + $firewallsource ? OUTPUT_RESTRICT : PREROUTE_RESTRICT , $rule , $source , $origdest ,