mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-23 22:18:57 +01:00
Fix dynamic zone fiasco
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6352 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
37a5edb43a
commit
89d8afe45c
@ -187,6 +187,7 @@ add_to_zone() # $1...${n-1} = <interface>[:<hosts>] $n = zone
|
|||||||
|
|
||||||
for h in $dest_hosts; do
|
for h in $dest_hosts; do
|
||||||
iface=${h%%:*}
|
iface=${h%%:*}
|
||||||
|
iface=${iface#+}
|
||||||
hosts=${h#*:}
|
hosts=${h#*:}
|
||||||
|
|
||||||
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
||||||
@ -206,6 +207,7 @@ add_to_zone() # $1...${n-1} = <interface>[:<hosts>] $n = zone
|
|||||||
|
|
||||||
for h in $source_hosts; do
|
for h in $source_hosts; do
|
||||||
iface=${h%%:*}
|
iface=${h%%:*}
|
||||||
|
iface=${iface#+}
|
||||||
hosts=${h#*:}
|
hosts=${h#*:}
|
||||||
|
|
||||||
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
||||||
@ -374,6 +376,7 @@ delete_from_zone() # $1 = <interface>[:<hosts>] $2 = zone
|
|||||||
|
|
||||||
for h in $dest_hosts; do
|
for h in $dest_hosts; do
|
||||||
iface=${h%%:*}
|
iface=${h%%:*}
|
||||||
|
iface=${iface#+}
|
||||||
hosts=${h#*:}
|
hosts=${h#*:}
|
||||||
|
|
||||||
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
||||||
@ -390,6 +393,7 @@ delete_from_zone() # $1 = <interface>[:<hosts>] $2 = zone
|
|||||||
|
|
||||||
for h in $source_hosts; do
|
for h in $source_hosts; do
|
||||||
iface=${h%%:*}
|
iface=${h%%:*}
|
||||||
|
iface=${iface#+}
|
||||||
hosts=${h#*:}
|
hosts=${h#*:}
|
||||||
|
|
||||||
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
if [ "$iface" != "$interface" -o "$hosts" != "$host" ]; then
|
||||||
|
@ -1420,25 +1420,25 @@ sub generate_matrix() {
|
|||||||
add_rule $in_ref , "-i $interface -s $net -j RETURN";
|
add_rule $in_ref , "-i $interface -s $net -j RETURN";
|
||||||
add_rule $out_ref , "-i $interface -s $net -j RETURN";
|
add_rule $out_ref , "-i $interface -s $net -j RETURN";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $capabilities{POLICY_MATCH} ) {
|
if ( $capabilities{POLICY_MATCH} ) {
|
||||||
my $type = $zoneref->{type};
|
my $type = $zoneref->{type};
|
||||||
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
|
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
|
||||||
|
|
||||||
if ( $config{DYNAMIC_ZONES} ) {
|
if ( $config{DYNAMIC_ZONES} ) {
|
||||||
no warnings;
|
no warnings;
|
||||||
create_zone_dyn_chain $zone, $frwd_ref if (%$source_ref || $type ne 'ipsec4' );
|
create_zone_dyn_chain $zone, $frwd_ref if (%$source_ref || $type eq 'ipsec4' );
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $interface ( keys %$source_ref ) {
|
for my $interface ( keys %$source_ref ) {
|
||||||
my $arrayref = $source_ref->{$interface};
|
my $arrayref = $source_ref->{$interface};
|
||||||
for my $hostref ( @{$arrayref} ) {
|
for my $hostref ( @{$arrayref} ) {
|
||||||
my $ipsec_match = match_ipsec_in $zone , $hostref;
|
my $ipsec_match = match_ipsec_in $zone , $hostref;
|
||||||
for my $net ( @{$hostref->{hosts}} ) {
|
for my $net ( @{$hostref->{hosts}} ) {
|
||||||
add_rule
|
add_rule
|
||||||
$filter_table->{forward_chain $interface} ,
|
$filter_table->{forward_chain $interface} ,
|
||||||
join( '', match_source_net( $net ), $ipsec_match, "-j $frwd_ref->{name}" );
|
join( '', match_source_net( $net ), $ipsec_match, "-j $frwd_ref->{name}" );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ sub determine_zones()
|
|||||||
$in_options = '' if $in_options eq '-';
|
$in_options = '' if $in_options eq '-';
|
||||||
$out_options = '' if $out_options eq '-';
|
$out_options = '' if $out_options eq '-';
|
||||||
|
|
||||||
$zone_hash{in_out} = parse_zone_option_list( $options || '',$zoneref->{type} );
|
$zone_hash{in_out} = parse_zone_option_list( $options || '', $zoneref->{type} );
|
||||||
$zone_hash{in} = parse_zone_option_list( $in_options || '', $zoneref->{type} );
|
$zone_hash{in} = parse_zone_option_list( $in_options || '', $zoneref->{type} );
|
||||||
$zone_hash{out} = parse_zone_option_list( $out_options || '', $zoneref->{type} );
|
$zone_hash{out} = parse_zone_option_list( $out_options || '', $zoneref->{type} );
|
||||||
$zone_hash{complex} = ($zoneref->{type} eq 'ipsec4' || $options || $in_options || $out_options ? 1 : 0);
|
$zone_hash{complex} = ($zoneref->{type} eq 'ipsec4' || $options || $in_options || $out_options ? 1 : 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user