diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2009-12-21 15:27:20 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2009-12-21 15:27:20 +0100 |
commit | 2328dcc5f0fd5cd875ec15d47260d3626615bb0d (patch) | |
tree | c924961f54efe3240ea8ce94f7f51b816f1a9941 /etc/inc/upgrade_config.inc | |
parent | d30bbdd730e0fb86d913c3ab5cd529d83220a685 (diff) | |
download | pfsense-2328dcc5f0fd5cd875ec15d47260d3626615bb0d.zip pfsense-2328dcc5f0fd5cd875ec15d47260d3626615bb0d.tar.gz |
Partial rewrite of gateway code, now partially facilitates dynamic interfaces
- Upgrade code takes different naming into account
- Add gateway entries for dynamic interfaces
- Rewrite status array to also support dynamic interfaces.
- Always use unique localhost monitor IP addresses for down dynamic interfaces
- Accept the gateway IP address of "dynamic" on the gateway edit page
Diffstat (limited to 'etc/inc/upgrade_config.inc')
-rw-r--r-- | etc/inc/upgrade_config.inc | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 24a104f..0a8cf45 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -763,32 +763,34 @@ function upgrade_042_to_043() { if(! interface_has_gateway($ifname)) { continue; } - if(is_ipaddr($config['interfaces'][$ifname]['gateway'])) { + if(is_ipaddr($interface['gateway'])) { $config['gateways']['gateway_item'][$i]['gateway'] = $config['interfaces'][$ifname]['gateway']; - $config['gateways']['gateway_item'][$i]['interface'] = $ifname; - $config['gateways']['gateway_item'][$i]['name'] = strtoupper($ifname) ."_GW"; - /* add default gateway bit for wan on upgrade */ - if($ifname == "wan") { - $config['gateways']['gateway_item'][$i]['defaultgw'] = true; - } - if(is_ipaddr($config['interfaces'][$ifname]['use_rrd_gateway'])) { - $config['gateways']['gateway_item'][$i]['monitor'] = $config['interfaces'][$ifname]['use_rrd_gateway']; - unset($config['interfaces'][$ifname]['use_rrd_gateway']); - } - $config['interfaces'][$ifname]['gateway'] = $config['gateways']['gateway_item'][$i]['name']; + $config['gateways']['gateway_item'][$i]['descr'] = "Interface $ifname Static Gateway"; + } else { + $config['gateways']['gateway_item'][$i]['gateway'] = "dynamic"; + $config['gateways']['gateway_item'][$i]['descr'] = "Interface $ifname Dynamic Gateway"; + } + $config['gateways']['gateway_item'][$i]['interface'] = $ifname; + $config['gateways']['gateway_item'][$i]['name'] = "GW_" . strtoupper($ifname); + /* add default gateway bit for wan on upgrade */ + if($ifname == "wan") { + $config['gateways']['gateway_item'][$i]['defaultgw'] = true; + } + if(is_ipaddr($config['interfaces'][$ifname]['use_rrd_gateway'])) { + $config['gateways']['gateway_item'][$i]['monitor'] = $config['interfaces'][$ifname]['use_rrd_gateway']; + unset($config['interfaces'][$ifname]['use_rrd_gateway']); + } + $config['interfaces'][$ifname]['gateway'] = $config['gateways']['gateway_item'][$i]['name']; - /* Update all filter rules which might reference this gateway */ - $j = 0; - foreach($config['filter']['rule'] as $rule) { - if(is_ipaddr($rule['gateway']) && ($rule['gateway'] == $config['gateways']['gateway_item'][$i]['gateway'])) { - $config['filter']['rule'][$j]['gateway'] = $config['gateways']['gateway_item'][$i]['name']; - } - $j++; + /* Update all filter rules which might reference this gateway */ + $j = 0; + foreach($config['filter']['rule'] as $rule) { + if(is_ipaddr($rule['gateway']) && ($rule['gateway'] == $config['gateways']['gateway_item'][$i]['gateway'])) { + $config['filter']['rule'][$j]['gateway'] = $config['gateways']['gateway_item'][$i]['name']; } - - /* any other gateway upgrades here */ - $i++; + $j++; } + $i++; } } @@ -1548,8 +1550,8 @@ function upgrade_053_to_054() { foreach($lbpool['servers'] as $member) { $split = split("\|", $member); $interface = $split[0]; - /* on static upgraded configuration we automatically append _GW */ - $static_name = strtoupper($ifname) . "_GW"; + /* on static upgraded configuration we automatically prepend GW_ */ + $static_name = "GW_" . strtoupper($interface); if(is_array($gateways[$static_name])) { $interface = $static_name; } @@ -1561,7 +1563,9 @@ function upgrade_053_to_054() { $i = 1; } $gateway_group['item'][] = "$interface|$i"; - $config['interfaces'][$interface]['monitorip'] = "$monitor"; + if(is_ipaddr($monitor)) { + $config['interfaces'][$interface]['monitorip'] = "$monitor"; + } } $gateway_group_arr[] = $gateway_group; } else { |