diff options
author | Ermal <eri@pfsense.org> | 2012-12-18 15:31:10 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-12-19 21:26:17 +0000 |
commit | 7d2fedc976cb23901ee3f88d6d322bf1fb21ae0e (patch) | |
tree | 3dd505522683cd8bfe9b766f371f9f4b0108cc1f /etc/rc.linkup | |
parent | a33b69dbd9a6682c452ef509a30340ca4e69646b (diff) | |
download | pfsense-7d2fedc976cb23901ee3f88d6d322bf1fb21ae0e.zip pfsense-7d2fedc976cb23901ee3f88d6d322bf1fb21ae0e.tar.gz |
Make the script rc.linkuip compatible with ipv6 as well.
Diffstat (limited to 'etc/rc.linkup')
-rwxr-xr-x | etc/rc.linkup | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/etc/rc.linkup b/etc/rc.linkup index 23d7c9b..217fe65 100755 --- a/etc/rc.linkup +++ b/etc/rc.linkup @@ -39,9 +39,14 @@ require_once("interfaces.inc"); function handle_argument_group($iface, $argument2) { global $config; + if (!is_array($config['interfaces'][$iface])) + return; + $ipaddr = $config['interfaces'][$iface]['ipaddr']; - if (is_ipaddr($ipaddr) || empty($ipaddr)) { - log_error("Hotplug event detected for {$iface} but ignoring since interface is configured with static IP ({$ipaddr})"); + $ip6addr = $config['interfaces'][$iface]['ipaddrv6']; + if ((!empty($ipaddr) && is_ipaddrv4($ipaddr)) || (empty($ipaddr) && empty($ip6addr)) || (!empty($ip6addr) && is_ipaddrv6($ip6addr))) { + $friendly = convert_friendly_interface_to_friendly_descr($iface); + log_error("Hotplug event detected for {$friendly}({$iface}) but ignoring since interface is configured with static IP ({$ipaddr} {$ip6addr})"); interfaces_staticarp_configure($iface); $iface = get_real_interface($iface); interfaces_bring_up($iface); @@ -75,28 +80,24 @@ global $g; if (file_exists("{$g['varrun_path']}/booting")) { /* ignore all linkup events */ } else { - foreach($_SERVER['argv'] as $argv) { - switch($argv) { - case "start": - $action = "start"; - break; - case "stop": - $action = "stop"; - break; - case "/etc/rc.linkup": - break; - default: - $interface = convert_real_interface_to_friendly_interface_name($argv); - if($interface == "") { - unset($interface); - } - break; - } - if(($action) && ($interface)) { - handle_argument_group($interface, $action); - unset ($action, $interface); - } + if ($argc < 3) { + log_error("HOTPLUG event: The number of required parameters not passed!"); + exit; + } + $action = $argv[1]; + switch($action) { + case "start": + case "stop": + break; + default: + log_error("HOTPLUG event: The action parameter passed is wrong($action) only start/stop/up/down are allowed!"); + exit; + /* NOTREACHED */ + break; } + $interface = convert_real_interface_to_friendly_interface_name($argv[2]); + if (!empty($interface)) + handle_argument_group($interface, $action); } ?> |