Revision 7d2fedc9
Added by Ermal LUÇI over 12 years ago
etc/rc.linkup | ||
---|---|---|
39 | 39 |
function handle_argument_group($iface, $argument2) { |
40 | 40 |
global $config; |
41 | 41 |
|
42 |
if (!is_array($config['interfaces'][$iface])) |
|
43 |
return; |
|
44 |
|
|
42 | 45 |
$ipaddr = $config['interfaces'][$iface]['ipaddr']; |
43 |
if (is_ipaddr($ipaddr) || empty($ipaddr)) { |
|
44 |
log_error("Hotplug event detected for {$iface} but ignoring since interface is configured with static IP ({$ipaddr})"); |
|
46 |
$ip6addr = $config['interfaces'][$iface]['ipaddrv6']; |
|
47 |
if ((!empty($ipaddr) && is_ipaddrv4($ipaddr)) || (empty($ipaddr) && empty($ip6addr)) || (!empty($ip6addr) && is_ipaddrv6($ip6addr))) { |
|
48 |
$friendly = convert_friendly_interface_to_friendly_descr($iface); |
|
49 |
log_error("Hotplug event detected for {$friendly}({$iface}) but ignoring since interface is configured with static IP ({$ipaddr} {$ip6addr})"); |
|
45 | 50 |
interfaces_staticarp_configure($iface); |
46 | 51 |
$iface = get_real_interface($iface); |
47 | 52 |
interfaces_bring_up($iface); |
... | ... | |
75 | 80 |
if (file_exists("{$g['varrun_path']}/booting")) { |
76 | 81 |
/* ignore all linkup events */ |
77 | 82 |
} else { |
78 |
foreach($_SERVER['argv'] as $argv) { |
|
79 |
switch($argv) { |
|
80 |
case "start": |
|
81 |
$action = "start"; |
|
82 |
break; |
|
83 |
case "stop": |
|
84 |
$action = "stop"; |
|
85 |
break; |
|
86 |
case "/etc/rc.linkup": |
|
87 |
break; |
|
88 |
default: |
|
89 |
$interface = convert_real_interface_to_friendly_interface_name($argv); |
|
90 |
if($interface == "") { |
|
91 |
unset($interface); |
|
92 |
} |
|
93 |
break; |
|
94 |
} |
|
95 |
if(($action) && ($interface)) { |
|
96 |
handle_argument_group($interface, $action); |
|
97 |
unset ($action, $interface); |
|
98 |
} |
|
83 |
if ($argc < 3) { |
|
84 |
log_error("HOTPLUG event: The number of required parameters not passed!"); |
|
85 |
exit; |
|
86 |
} |
|
87 |
$action = $argv[1]; |
|
88 |
switch($action) { |
|
89 |
case "start": |
|
90 |
case "stop": |
|
91 |
break; |
|
92 |
default: |
|
93 |
log_error("HOTPLUG event: The action parameter passed is wrong($action) only start/stop/up/down are allowed!"); |
|
94 |
exit; |
|
95 |
/* NOTREACHED */ |
|
96 |
break; |
|
99 | 97 |
} |
98 |
$interface = convert_real_interface_to_friendly_interface_name($argv[2]); |
|
99 |
if (!empty($interface)) |
|
100 |
handle_argument_group($interface, $action); |
|
100 | 101 |
} |
101 | 102 |
|
102 | 103 |
?> |
Also available in: Unified diff
Make the script rc.linkuip compatible with ipv6 as well.