From fdbf66d2810f301430b231609089d080dbbc5635 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 7 Oct 2006 20:32:06 +0000 Subject: Apply changes suggested in http://forum.pfsense.org/index.php/topic,551.msg13610.html#msg13610 --- packages/miniupnpd/miniupnpd.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'packages/miniupnpd') diff --git a/packages/miniupnpd/miniupnpd.inc b/packages/miniupnpd/miniupnpd.inc index ecd2fa10..d536253c 100644 --- a/packages/miniupnpd/miniupnpd.inc +++ b/packages/miniupnpd/miniupnpd.inc @@ -37,7 +37,9 @@ $start = "# Clear existing rules and rdr entries \n"; $start .= "/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null\n"; $start .= "/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null\n"; - $start .= "killall miniupnpd; sleep 3; /usr/local/sbin/miniupnpd -p 2869{$ifaces_final}"; + $start .= "/usr/bin/killall miniupnpd\n"; + $start .= "while [ `ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l` != 0 ]; do sleep 1; done\n"; + $start .= "/usr/local/sbin/miniupnpd -p 2869{$ifaces_final}"; /* override wan ip address, common for carp, etc */ if($overridewanip) @@ -54,7 +56,13 @@ ) ); } + + /* if not ONE instance running lets start */ + /* or if $_POST data as user is changing settings */ + if((int)exec("ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l") != 1 || $_POST['interface_array']) { start_service("miniupnpd"); + } + config_unlock(); conf_mount_ro(); } -- cgit v1.2.3