Transfer rc.linkup over to devd

This commit is contained in:
Scott Ullrich 2006-03-13 03:59:25 +00:00
parent 8af4ca7b2f
commit c511b3696c

View File

@ -37,50 +37,59 @@
if($g['booting'] == true) {
/* ignore all linkup events */
} else {
$friendly_interface = convert_real_interface_to_friendly_interface_name($argv[1]);
if($config['interfaces'][$friendly_interface]['ipaddr'] <> "dhcp" and
$config['interfaces'][$friendly_interface]['ipaddr'] <> "pppoe" and
$config['interfaces'][$friendly_interface]['ipaddr'] <> "bigpond" and
$config['interfaces'][$friendly_interface]['ipaddr'] <> "pptp") {
log_error("Hotplug event detected for {$argv[1]} but ignoring since interface is not set for DHCP");
exit;
}
if($argv[2] == "stop" or $argv[2] == "down") {
log_error("DEVD Ethernet detached event for {$argv[1]}");
exec("/sbin/ifconfig {$argv[1]} delete");
exec("/usr/sbin/arp -da");
exit;
}
if($argv[2] == "start" or $argv[2] == "up") {
log_error("DEVD Ethernet attached event for {$argv[1]}");
exec("/sbin/ifconfig {$argv[1]} up");
exec("/usr/sbin/arp -da");
}
if($argv[1] <> "") {
$interface = convert_real_interface_to_friendly_interface_name($argv[1]);
} else {
log_error("WARNING: No interface passed to rc.linkup");
$interface = "wan";
}
if($interface == "wan") {
if($config['interfaces'][$friendly_interface]['ipaddr'] <> "pppoe") {
/* do not reconfigure on hotplug events when using pppoe */
log_error("HOTPLUG: Configuring wan interface {$interface}");
interfaces_wan_configure();
$processing = true;
$counter = 1;
while($processing == true) {
if($argv[$counter] == "" or $argv[$counter] == "\n")
exit;
echo "Processing {$argv[$counter]} - {$argv[$counter+1]}\n";
$friendly_interface = convert_real_interface_to_friendly_interface_name($argv[$counter]);
if($config['interfaces'][$friendly_interface]['ipaddr'] <> "dhcp" and
$config['interfaces'][$friendly_interface]['ipaddr'] <> "pppoe" and
$config['interfaces'][$friendly_interface]['ipaddr'] <> "bigpond" and
$config['interfaces'][$friendly_interface]['ipaddr'] <> "pptp") {
log_error("Hotplug event detected for {$argv[$counter]} but ignoring since interface is not set for DHCP");
$counter++;
$counter++;
} else {
if($argv[$counter+1] == "stop" or $argv[$counter+1] == "down") {
log_error("DEVD Ethernet detached event for {$argv[$counter]}");
exec("/sbin/ifconfig {$argv[$counter]} delete");
exec("/usr/sbin/arp -da");
}
if($argv[$counter+1] == "start" or $argv[$counter+1] == "up") {
log_error("DEVD Ethernet attached event for {$argv[$counter]}");
exec("/sbin/ifconfig {$argv[$counter]} up");
exec("/usr/sbin/arp -da");
}
if($argv[$counter] <> "") {
$interface = convert_real_interface_to_friendly_interface_name($argv[$counter]);
} else {
log_error("WARNING: No interface passed to rc.linkup");
$interface = "wan";
}
if($interface == "wan") {
if($config['interfaces'][$friendly_interface]['ipaddr'] <> "pppoe") {
/* do not reconfigure on hotplug events when using pppoe */
log_error("HOTPLUG: Configuring wan interface {$interface}");
interfaces_wan_configure();
}
} else if($interface == "lan") {
log_error("HOTPLUG: Configuring lan interface {$interface}");
interfaces_lan_configure();
} else {
log_error("HOTPLUG: Configuring optional interface {$interface}");
interfaces_optional_configure_if($interface);
}
$counter++;
$counter++;
}
} else if($interface == "lan") {
log_error("HOTPLUG: Configuring lan interface {$interface}");
interfaces_lan_configure();
} else {
log_error("HOTPLUG: Configuring optional interface {$interface}");
interfaces_optional_configure_if($interface);
}
}
?>
?>