Allow maquerade in custom chain
authorJamie Cameron <jcameron@webmin.com>
Fri, 29 Feb 2008 17:06:20 +0000 (17:06 +0000)
committerJamie Cameron <jcameron@webmin.com>
Fri, 29 Feb 2008 17:06:20 +0000 (17:06 +0000)
firewall/CHANGELOG
firewall/edit_rule.cgi
firewall/save_rule.cgi

index fa5cd2f..7bcdfd7 100644 (file)
@@ -18,4 +18,4 @@ On Debian 3.1 systems, IPtables rules are saved in /etc/iptables.up.rules and ac
 ---- Changes since 1.350 ----
 Added a setup option to configure a firewall for a typical hosting server.
 ---- Changes since 1.400 ----
-Show SNAT inputs in custom NAT chains.
+Show SNAT and masquerade inputs in custom NAT chains.
index 1664572..42a9367 100755 (executable)
@@ -122,7 +122,8 @@ if (($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'POSTROUTING') &&
                    "<input name=rtoto size=6 value='$rtoto'>"),"</td> </tr>\n";
        }
 
-if (($table->{'name'} eq 'nat' && $rule->{'chain'} eq 'POSTROUTING') &&
+if (($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'PREROUTING' &&
+     $rule->{'chain'} ne 'OUTPUT') &&
     &can_jump("MASQUERADE")) {
        # Show inputs for masquerading ports
        if ($rule->{'j'}->[1] eq 'MASQUERADE') {
index 9d71938..7e360b5 100755 (executable)
@@ -58,8 +58,9 @@ else {
                        delete($rule->{'reject-with'});
                        }
                }
-       if ($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'POSTROUTING' ||
-           $table->{'name'} eq 'nat' && $rule->{'chain'} eq 'POSTROUTING') {
+
+       # Parse redirect or masquerade input
+       if ($table->{'name'} eq 'nat') {
                if ($rule->{'j'}->[1] eq 'REDIRECT' && !$in{'rtodef'}) {
                        $in{'rtofrom'} =~ /^\d+$/ ||
                                &error($text{'save_ertoports'});