diff options
author | sullrich <sullrich@pfsense.org> | 2009-11-28 18:43:09 -0500 |
---|---|---|
committer | sullrich <sullrich@pfsense.org> | 2009-11-28 18:43:09 -0500 |
commit | 24caf10492066fa2c36c7aa9def0bcb1f94e029a (patch) | |
tree | 7afd3f7f14c0759b34d3b774e742b5260f28974b /usr/local/www/firewall_virtual_ip_edit.php | |
parent | 03fdfdd652b86da67eb44235f67a75e90fc9dfea (diff) | |
download | pfsense-24caf10492066fa2c36c7aa9def0bcb1f94e029a.zip pfsense-24caf10492066fa2c36c7aa9def0bcb1f94e029a.tar.gz |
Automatically select the last known vhid + 1 when creating new entries
Diffstat (limited to 'usr/local/www/firewall_virtual_ip_edit.php')
-rwxr-xr-x | usr/local/www/firewall_virtual_ip_edit.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index c388842..260e557 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -68,6 +68,16 @@ function return_first_two_octets($ip) { return $ip_split[0] . "." . $ip_split[1]; } +function find_last_used_vhid() { + global $config, $g; + $vhid = 0; + foreach($config['virtualip']['vip'] as $vip) { + if($vip['vhid'] > $vhid) + $vhid = $vip['vhid']; + } + return $vhid; +} + if (isset($id) && $a_vip[$id]) { $pconfig['mode'] = $a_vip[$id]['mode']; $pconfig['vhid'] = $a_vip[$id]['vhid']; @@ -79,6 +89,10 @@ if (isset($id) && $a_vip[$id]) { $pconfig['descr'] = $a_vip[$id]['descr']; $pconfig['type'] = $a_vip[$id]['type']; $pconfig['interface'] = $a_vip[$id]['interface']; +} else { + $lastvhid = find_last_used_vhid(); + $lastvhid++; + $pconfig['vhid'] = $lastvhid; } if ($_POST) { |