Project

General

Profile

« Previous | Next » 

Revision 124b1b85

Added by Bill Marquette about 20 years ago

Ticket #6: Allow for NAT rule duplication (adv. outbound nat this round)

View differences:

usr/local/www/firewall_nat_out.php
284 284
                      </tr>
285 285
                      <tr>
286 286
                        <td><input onmouseover="fr_insline(<?=$nnats;?>, true)" onmouseout="fr_insline(<?=$nnats;?>, false)" name="move_<?=$i;?>" src="left.gif" title="move selected rules before this rule" height="17" type="image" width="17" border="0"></td>
287
                        <!-- <billm><td><a href="firewall_nat_out_edit.php?dup=<?=$i;?>"><img src="plus.gif" title="add a new nat based on this one" width="17" height="17" border="0"></a></td><billm> -->
287
                        <td><a href="firewall_nat_out_edit.php?dup=<?=$i;?>"><img src="plus.gif" title="add a new nat based on this one" width="17" height="17" border="0"></a></td>
288 288
                      </tr>
289 289
                    </table>
290 290
              <?php $i++; $nnats++; endforeach; ?>
usr/local/www/firewall_nat_out_edit.php
35 35
require("guiconfig.inc");
36 36

  
37 37
if (!is_array($config['nat']['advancedoutbound']['rule']))
38
    $config['nat']['advancedoutbound']['rule'] = array();
38
	$config['nat']['advancedoutbound']['rule'] = array();
39 39

  
40 40
$a_out = &$config['nat']['advancedoutbound']['rule'];
41 41
//nat_out_rules_sort();
42 42

  
43 43
$id = $_GET['id'];
44 44
if (isset($_POST['id']))
45
    $id = $_POST['id'];
45
	$id = $_POST['id'];
46

  
47
if (isset($_GET['dup']))  { 
48
	$id  =  $_GET['dup']; 
49
	$after  =  $_GET['dup']; 
50
}  
46 51

  
47 52
if (isset($id) && $a_out[$id]) {
48 53
    list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']);
49 54
    $pconfig['sourceport'] = $a_out[$id]['sourceport'];
50 55
    address_to_pconfig($a_out[$id]['destination'], $pconfig['destination'],
51 56
	   $pconfig['destination_subnet'], $pconfig['destination_not'],
52
	   null, null);
57
	   $none, $none); 
53 58
    $pconfig['natport'] = $a_out[$id]['natport'];
54 59
    $pconfig['target'] = $a_out[$id]['target'];
55 60
    $pconfig['interface'] = $a_out[$id]['interface'];
......
164 169
        if (isset($_POST['destination_not']) && $ext != "any")
165 170
            $natent['destination']['not'] = true;
166 171

  
167
        if (isset($id) && $a_out[$id])
168
            $a_out[$id] = $natent;
169
        else
170
            $a_out[] = $natent;
172
	if (isset($id) && $a_nat[$id])
173
		$a_nat[$id] = $natent;
174
	else {
175
		if (is_numeric($after))
176
			array_splice($a_nat, $after+1, 0, array($natent));
177
		else
178
			$a_nat[] = $natent;
179
	}
171 180

  
172 181
        touch($d_natconfdirty_path);
173 182

  

Also available in: Unified diff