diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-06-30 22:14:55 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-06-30 22:14:55 +0000 |
commit | e80df06e5982ec989cf036356de46d4f80d6fb24 (patch) | |
tree | b5f8f61b232e4ff8af064819d9303afc76fa084d /usr/local/pkg/miniupnpd.inc | |
parent | 6e35cf3ff997ca60cb8aedcc4ae4f34f3b81535a (diff) | |
download | pfsense-e80df06e5982ec989cf036356de46d4f80d6fb24.zip pfsense-e80df06e5982ec989cf036356de46d4f80d6fb24.tar.gz |
Woops, we need this code. Write out config file correctly.
Diffstat (limited to 'usr/local/pkg/miniupnpd.inc')
-rw-r--r-- | usr/local/pkg/miniupnpd.inc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc index c13cc30..518cd9e 100644 --- a/usr/local/pkg/miniupnpd.inc +++ b/usr/local/pkg/miniupnpd.inc @@ -232,6 +232,35 @@ if(upnp_config('permdefault')) $configtext .= "deny 0-65535 0.0.0.0/0 0-65535\n"; + /* generate rc file start and stop */ + $stop = <<<EOD +if [ `pgrep miniupnpd | wc -l` != 0 ]; then + /usr/bin/killall miniupnpd + while [ `pgrep miniupnpd | wc -l` != 0 ]; do + sleep 1 + done + fi + # Clear existing rules and rdr entries + if [ `pfctl -aminiupnpd -sr | wc -l` != 0 ]; then + /sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null + fi + if [ `pfctl -aminiupnpd -sn | wc -l` != 0 ]; then + /sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null + fi +EOD; + $start = $stop."\n\t/usr/local/sbin/miniupnpd -f ".UPNP_CONFIG; + + /* write out the configuration */ + conf_mount_rw(); + upnp_write_config(UPNP_CONFIG,$configtext); + write_rcfile(array( + 'file' => 'miniupnpd.sh', + 'start' => $start, + 'stop' => $stop + ) + ); + conf_mount_ro(); + /* if miniupnpd not running start it */ if(!upnp_running()) { upnp_notice("Starting service on interface: {$ifaces_active}"); |