diff options
-rw-r--r-- | etc/inc/filter.inc | 6 | ||||
-rw-r--r-- | etc/inc/gwlb.inc | 12 | ||||
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 9 |
3 files changed, 17 insertions, 10 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 4a9ac22..5dc5cd5 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -550,7 +550,7 @@ function filter_generate_gateways() { $gwip = get_interface_gateway($gateway['friendlyiface']); if (is_ipaddr($gwip) && !empty($int)) $route = "route-to ( {$int} {$gwip} )"; - $rules .= "{$gwname} = \" {$route} \"\n"; + $rules .= "GW{$gwname} = \" {$route} \"\n"; } } @@ -584,7 +584,7 @@ function filter_generate_gateways() { } } } - $rules .= "{$gateway} = \" {$route} \"\n"; + $rules .= "GW{$gateway} = \" {$route} \"\n"; } } @@ -1499,7 +1499,7 @@ function filter_generate_user_rule($rule) { /* if user has selected a custom gateway, lets work with it */ else if($rule['gateway'] <> "") { /* Add the load balanced gateways */ - $aline['route'] = " \${$rule['gateway']} "; + $aline['route'] = " \$GW{$rule['gateway']} "; } if(isset($rule['protocol'])) { diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 7a6647f..ba1d9f0 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -299,7 +299,7 @@ function return_gateways_array($disabled = false) { $gateway['gateway'] = get_interface_gateway($ifname, $gateway['dynamic']); $gateway['interface'] = get_real_interface($ifname); $gateway['friendlyiface'] = $ifname; - $gateway['name'] = "{$friendly}_GW"; + $gateway['name'] = "{$friendly}"; $gateway['attribute'] = "system"; /* Loopback dummy for dynamic interfaces without a IP */ @@ -309,10 +309,12 @@ function return_gateways_array($disabled = false) { /* automatically skip known static and dynamic gateways we have a array entry for */ foreach($gateways_arr as $gateway_item) { - if($gateway_item['gateway'] == $gateway['gateway'] && ($ifname == $gateway_item['friendlyiface'])) - continue 2; - if(($gateway_item['gateway'] == "dynamic") && ($ifname == $gateway_item['friendlyiface'])) - continue 2; + if ($ifname == $gateway_item['friendlyiface'] || $friendly == $gateway_item['name']) { + if ($gateway_item['gateway'] == $gateway['gateway']) + continue 2; + if ($gateway_item['gateway'] == "dynamic") + continue 2; + } } /* retrieve a proper monitor IP? */ diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 60b8700..689397b 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -167,10 +167,15 @@ if ($_POST) { /* rebuild the array with the manual entries only */ $gateway = array(); - $gateway['interface'] = $_POST['interface']; + if ($_POST['attribute'] == "system") { + $gateway['interface'] = $pconfig['friendlyiface']; + $gateway['gateway'] = "dynamic"; + } else { + $gateway['interface'] = $_POST['interface']; + $gateway['gateway'] = $_POST['gateway']; + } $gateway['name'] = $_POST['name']; $gateway['weight'] = $_POST['weight']; - $gateway['gateway'] = $_POST['gateway']; $gateway['descr'] = $_POST['descr']; if(is_ipaddr($_POST['monitor'])) { $gateway['monitor'] = $_POST['monitor']; |