diff options
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); } ?> |