Add support for PPP cards to get_real_interface()

This commit is contained in:
Scott Ullrich 2009-10-19 22:45:56 -04:00
parent b4d3639286
commit 859451697b

View File

@ -2210,17 +2210,28 @@ function get_real_interface($interface = "wan") {
case "enc0":
$wanif = "enc0";
break;
/* XXX: dial in support?!
case "ppp":
$wanif = "ppp";
break;
*/
default:
$iflist = get_configured_interface_with_descr(false, true);
foreach ($iflist as $if => $ifdesc) {
if ($interface == $if || $interface == $ifdesc) {
// PPP Support
if($config['interfaces'][$if]['serialport']) {
$dev = $config['interfaces'][$if]['serialport'];
$ps = trim(`ps awux | grep -v grep | grep "$dev" | awk '{ print \$2 }'`);
if($ps) {
$int = trim(`ifconfig | grep -v grep | grep -B2 "$ps" | head -n1 | cut -d: -f1`);
if($int) {
$wanif = $int;
break;
}
}
}
$cfg = $config['interfaces'][$if];
if (empty($cfg['ipaddr'])) {
@ -2670,4 +2681,4 @@ function setup_pppoe_reset_file($interface, $status) {
unlink_if_exists(CRON_PPPOE_CMD_FILE);
}
?>
?>