Correct detection of IPv6 PERSISTENT_SNAT

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-02-23 12:59:38 -08:00
parent 6035d49ede
commit 82f9ba8bb7
2 changed files with 4 additions and 1 deletions

View File

@ -2225,6 +2225,8 @@ determine_capabilities() {
if qt $g_tool -t nat -N $chain; then
if [ $g_family -eq 4 ]; then
qt $g_tool -t nat -A $chain -j SNAT --to-source 1.2.3.4 --persistent && PERSISTENT_SNAT=Yes
else
qt $g_tool -t nat -A $chain -j SNAT --to-source 2001::1 --persistent && PERSISTENT_SNAT=Yes
fi
qt $g_tool -t nat -F $chain
qt $g_tool -t nat -X $chain

View File

@ -3549,9 +3549,10 @@ sub Persistent_Snat() {
have_capability( 'NAT_ENABLED' ) || return '';
my $result = '';
my $address = $family == F_IPV4 ? '1.2.3.4' : '2001::1';
if ( qt1( "$iptables -t nat -N $sillyname" ) ) {
$result = qt1( "$iptables -t nat -A $sillyname -j SNAT --to-source 1.2.3.4 --persistent" );
$result = qt1( "$iptables -t nat -A $sillyname -j SNAT --to-source $address --persistent" );
qt1( "$iptables -t nat -F $sillyname" );
qt1( "$iptables -t nat -X $sillyname" );