From 859451697bb5efe1d554a2dcdeea81025e801ca3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 19 Oct 2009 22:45:56 -0400 Subject: [PATCH] Add support for PPP cards to get_real_interface() --- etc/inc/interfaces.inc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 52d771b789..61dedd9ff2 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -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); } -?> +?> \ No newline at end of file