Commit 27490d7a authored by Franco Fichtner's avatar Franco Fichtner

rc: if we replace, replace all #1606

parent 0a339af9
...@@ -219,10 +219,11 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet ...@@ -219,10 +219,11 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet
$is_default = true; $is_default = true;
$new_name = ''; $new_name = '';
foreach ($a_gateways as $item) { foreach ($a_gateways as &$item) {
if ($item['ipprotocol'] === $inet_type) { if ($item['ipprotocol'] === $inet_type) {
if ($item['interface'] === $interface && $item['gateway'] === $gatewayip) { if ($item['interface'] === $interface && $item['gateway'] === $gatewayip) {
$new_name = $item['name']; $new_name = $item['name'];
unset($item);
continue; continue;
} }
if (isset($item['defaultgw'])) { if (isset($item['defaultgw'])) {
...@@ -247,6 +248,8 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet ...@@ -247,6 +248,8 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet
if ($new_name == '') { if ($new_name == '') {
$new_name = next_unused_gateway_name($interface); $new_name = next_unused_gateway_name($interface);
}
$item = array( $item = array(
'descr' => sprintf('Interface %s Gateway', strtoupper($interface)), 'descr' => sprintf('Interface %s Gateway', strtoupper($interface)),
'defaultgw' => $is_default, 'defaultgw' => $is_default,
...@@ -261,8 +264,8 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet ...@@ -261,8 +264,8 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet
if (!$is_in_subnet) { if (!$is_in_subnet) {
$item['fargw'] = 1; $item['fargw'] = 1;
} }
$a_gateways[] = $item; $a_gateways[] = $item;
}
return $new_name; return $new_name;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment