From 81f256c0b800c55f60342e72f1f395560b35616a Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 20 Dec 2009 22:51:06 -0500 Subject: clean this up a bit, add comments --- etc/inc/filter.inc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'etc/inc/filter.inc') diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index fc8c32d..4ab0a83 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -643,12 +643,14 @@ function filter_generate_optcfg_array() } if($config['ppps']) { $ppp=0; - $startingip = 1; foreach($config['ppps']['ppp'] as $ifgen) { + // get the device name for this PPP connection minus /dev/ (e.g. cuaU0) $dev = substr($ifgen['port'], 5); + // $ps is the PID of the ppp process matching this device $ps = trim(`ps awux | grep -v grep | grep "$dev" | awk '{ print \$2 }'`); if($ps) { - $interface = trim(`ifconfig | grep -v grep | grep -B2 "$ps" | head -n1 | cut -d: -f1`); + // $interface is the device in use by the PID of the ppp process found above (e.g. tun0) + $interface = trim(`ifconfig | grep -B2 "$ps" | head -n1 | cut -d: -f1`); if($interface) { foreach ($config['interfaces'] as $ifdescr => $ifname) { if($ifname['serialport'] == $dev) { @@ -659,7 +661,6 @@ function filter_generate_optcfg_array() unset($FilterIflist[$ifname['descr']]); $FilterIflist[$ifname['descr']] = $oc; $ppp++; - } } } @@ -2397,4 +2398,4 @@ EOD; return($ipfrules); } -?> +?> \ No newline at end of file -- cgit v1.1