Fix ADDRESSES = 'detect' on optional interface

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6146 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-04-28 15:07:08 +00:00
parent e8a4bb4469
commit f22fc6575e

View File

@ -190,6 +190,14 @@ sub setup_one_masq($$$$$$)
' addrlist="$addrlist --to-source $address"',
'done' );
$target = '-j SNAT $addrlist';
if ( interface_is_optional $interface ) {
add_commands( $chainref,
'',
'if [ -n "$addrlist" ]; then' );
push_cmd_mode( $chainref );
$detectaddress = 1;
}
} else {
my $addrlist = '';
for my $addr ( split /,/, $addresses ) {
@ -212,6 +220,11 @@ sub setup_one_masq($$$$$$)
#
expand_rule $chainref , POSTROUTE_RESTRICT , $rule, $networks, $destnets, '', $target, '', '' , '';
if ( $detectaddress ) {
pop_cmd_mode( $chainref );
add_command( $chainref , 'fi' );
}
if ( $add_snat_aliases ) {
my ( $interface, $alias ) = split /:/, $fullinterface;
for my $address ( split /,/, $addresses ) {