]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/forwardfw.cgi
Forward Firewall: cleanup of initscript. Fixes double log entries when INPUT is set...
[people/teissler/ipfire-2.x.git] / html / cgi-bin / forwardfw.cgi
index 84e01704d8c754b6c7b15be5068d55d623b2168e..3f4ad306b30e48979c2020457cdb25a43e6dc52b 100755 (executable)
@@ -77,7 +77,7 @@ my %aliases=();
 my %optionsfw=();
 my %ifaces=();
 
-my $VERSION='0.9.8.7';
+my $VERSION='0.9.8.9';
 my $color;
 my $confignet          = "${General::swroot}/fwhosts/customnetworks";
 my $confighost         = "${General::swroot}/fwhosts/customhosts";
@@ -923,7 +923,19 @@ sub checkrule
 {
        #check valid port for NAT
        if($fwdfwsettings{'USE_NAT'} eq 'ON'){
+               #if no port is given in nat area, take target host port
                if($fwdfwsettings{'nat'} eq 'dnat' && $fwdfwsettings{'grp3'} eq 'TGT_PORT' && $fwdfwsettings{'dnatport'} eq ''){$fwdfwsettings{'dnatport'}=$fwdfwsettings{'TGT_PORT'};}
+               
+               #check if given nat port is already used by another dnatrule
+               if($fwdfwsettings{'nat'} eq 'dnat'){
+                       foreach my $id (sort keys %confignatfw){
+                               if ($fwdfwsettings{'dnatport'} eq $confignatfw{$id}[30]){
+                                       $errormessage=$Lang::tr{'fwdfw natport used'}."<br>";
+                               }
+                       }
+               }
+               
+               #check if port given in nat area is a single valid port
                if($fwdfwsettings{'nat'} eq 'dnat' && !&check_natport($fwdfwsettings{'dnatport'})){
                        $errormessage=$Lang::tr{'fwdfw target'}.": ".$Lang::tr{'fwdfw dnat porterr'}."<br>";
                }
@@ -1738,17 +1750,12 @@ END
                <tr><td width='1%'><input type='checkbox' name='USE_NAT' value='ON' $checked{'USE_NAT'}{'ON'}></td><td width='15%'>$Lang::tr{'fwdfw use nat'}</td><td colspan='5'></td></tr>
                <tr><td colspan='2'></td><td width='1%'><input type='radio' name='nat' value='dnat' checked ></td><td width='50%'>$Lang::tr{'fwdfw dnat'}</td>
 END
-               if (! -z "${General::swroot}/ethernet/aliases"){
-                       print"<td width='8%'>IPFire: </td><td width='20%' align='right'><select name='dnat' style='width:140px;'>";
-                       print "<option value='ALL' $selected{'dnat'}{$Lang::tr{'all'}}>$Lang::tr{'all'}</option>";
-                       print "<option value='Default IP' $selected{'dnat'}{'Default IP'}>Default IP</option>";
-
-                       foreach my $alias (sort keys %aliases)
-                       {
-                               print "<option value='$alias' $selected{'dnat'}{$alias}>$alias</option>";
-                       }
-               }else{
-                       print"<td></td><td style='width:200px;'><input type='hidden' name ='ipfire' value='Default IP'>";
+               print"<td width='8%'>IPFire: </td><td width='20%' align='right'><select name='dnat' style='width:140px;'>";
+               print "<option value='ALL' $selected{'dnat'}{$Lang::tr{'all'}}>$Lang::tr{'all'}</option>";
+               print "<option value='Default IP' $selected{'dnat'}{'Default IP'}>Default IP</option>";
+               foreach my $alias (sort keys %aliases)
+               {
+                       print "<option value='$alias' $selected{'dnat'}{$alias}>$alias</option>";
                }
                print"</td></tr>";
                print"<tr><td colspan='4'></td><td>Port: </td><td align='right'><input type='text' name='dnatport' style='width:130px;' value=$fwdfwsettings{'dnatport'}> </td></tr>";