MFC 19653 19654 19655

This commit is contained in:
Scott Ullrich 2007-10-09 21:48:44 +00:00
parent 63f63827cd
commit ca88dded01

View File

@ -46,36 +46,44 @@
}
function handle_argument_group($argument1, $argument2) {
global $config;
global $config;
log_error("Processing {$argument1} - {$argument2}");
$iface = convert_real_interface_to_friendly_interface_name($argument1);
if(!$iface)
if($iface == "") {
log_error("Not a valid interface \"$iface\"");
return;
}
if($argument2 == "") {
log_error("Not a valid interface action \"$argument2\"");
return;
}
if($config['interfaces'][$iface]['ipaddr'] <> "dhcp" and
$config['interfaces'][$iface]['ipaddr'] <> "pppoe" and
$config['interfaces'][$iface]['ipaddr'] <> "bigpond" and
$config['interfaces'][$iface]['ipaddr'] <> "pptp") {
log_error("Hotplug event detected for {$argument1} but ignoring since interface is not set for DHCP");
exec("/usr/sbin/arp -d -i {$argument1} -a");
} else {
switch ($argument1) {
switch ($argument2) {
case "stop":
case "down":
log_error("DEVD Ethernet detached event for {$argument1}");
exec("/sbin/ifconfig {$argument1} delete");
exec("/usr/sbin/arp -da");
exec("/usr/sbin/arp -d -i {$argument1} -a");
exit;
break; /* LINT - NOT REACHED */
case "start":
case "up":
log_error("DEVD Ethernet attached event for {$argument1}");
exec("/sbin/ifconfig {$argument1} up");
exec("/usr/sbin/arp -da");
exec("/usr/sbin/arp -d -i {$argument1} -a");
break;
}
switch ($iface) {
case "wan":
if($config['interfaces'][$iface]['ipaddr'] <> "pppoe") {
/* do not reconfigure on hotplug events when using pppoe */
if($config['interfaces'][$iface]['ipaddr'] <> "pppoe" and
$config['interfaces'][$iface]['ipaddr'] <> "pptp") {
/* do not reconfigure on hotplug events when using pppoe or pptp */
log_error("HOTPLUG: Configuring wan interface {$argument1}");
interfaces_wan_configure();
}