From c6186571e515c254d246ed75b809592060bb7907 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 7 Aug 2012 14:51:58 -0700 Subject: [PATCH] Handle raw table zones from VSERVERS Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Misc.pm | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Misc.pm b/Shorewall/Perl/Shorewall/Misc.pm index ddca5494a..5b8667366 100644 --- a/Shorewall/Perl/Shorewall/Misc.pm +++ b/Shorewall/Perl/Shorewall/Misc.pm @@ -1310,6 +1310,7 @@ sub generate_source_rules( $$$;@ ) { sub handle_loopback_traffic() { my @zones = ( vserver_zones, firewall_zone ); my $natout = $nat_table->{OUTPUT}; + my $rawout = $raw_table->{OUTPUT}; my $rulenum = 0; my $outchainref; @@ -1333,6 +1334,7 @@ sub handle_loopback_traffic() { my $z1ref = find_zone( $z1 ); my $type1 = $z1ref->{type}; my $natref = $nat_table->{dnat_chain $z1}; + my $notrackref = $raw_table->{notrack_chain( $z1 )}; # # Add jumps in the 'output' chain to the rules chains # @@ -1342,10 +1344,32 @@ sub handle_loopback_traffic() { generate_dest_rules( $outchainref, $chain, $z2, @rule ) if $chain; } + # + # Handle conntrack + # + if ( $notrackref ) { + add_ijump $rawout, j => $notrackref if $notrackref->{referenced}; + } } else { for my $z2 ( @zones ) { generate_source_rules( $outchainref, $z1, $z2, @rule ); } + # + # Handle conntrack rules + # + if ( $notrackref->{referenced} ) { + for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) { + my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref); + my @ipsec_match = match_ipsec_in $z1 , $hostref; + + for my $net ( @{$hostref->{hosts}} ) { + add_ijump( $rawout, + j => $exclusion , + imatch_source_net $net, + @ipsec_match ); + } + } + } } if ( $natref && $natref->{referenced} ) { @@ -1960,12 +1984,6 @@ sub generate_matrix() { } } # - # NOTRACK from firewall - # - if ( ( my $notrackref = $raw_table->{notrack_chain(firewall_zone)}) ) { - add_ijump $raw_table->{OUTPUT}, j => $notrackref if $notrackref->{referenced}; - } - # # Main source-zone matrix-generation loop # progress_message ' Entering main matrix-generation loop...';