summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_virtual_ip_edit.php
diff options
context:
space:
mode:
authorsullrich <sullrich@pfsense.org>2009-11-28 18:43:09 -0500
committersullrich <sullrich@pfsense.org>2009-11-28 18:43:09 -0500
commit24caf10492066fa2c36c7aa9def0bcb1f94e029a (patch)
tree7afd3f7f14c0759b34d3b774e742b5260f28974b /usr/local/www/firewall_virtual_ip_edit.php
parent03fdfdd652b86da67eb44235f67a75e90fc9dfea (diff)
downloadpfsense-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-xusr/local/www/firewall_virtual_ip_edit.php14
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) {
OpenPOWER on IntegriCloud