&1 >/dev/null\n"; $start .= "/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null\n"; $start .= "while [ `pgrep miniupnpd | wc -l` != 0 ]; do sleep 1; done\n"; $start .= "fi\n"; $start .= "/usr/local/sbin/miniupnpd -p 2869{$ifaces_final}"; /* override wan ip address, common for carp, etc */ if($overridewanip) $start .= " -o {$overridewanip}"; /* enable logging of packets handled by miniupnpd rules */ if($logpackets) $start .= " -L"; $stop = "/usr/bin/killall miniupnpd \n"; $stop .= "# Clear existing rules and rdr entries \n"; $stop .= "/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null\n"; $stop .= "/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null\n"; $stop .= "while [ `pgrep miniupnpd | wc -l` != 0 ]; do sleep 1; done"; write_rcfile(array( "file" => "miniupnpd.sh", "start" => $start, "stop" => $stop ) ); /* if not ONE instance running lets start */ /* or if $_POST data as user is changing settings */ if((int)exec("pgrep miniupnpd | wc -l") != 1 || $_POST['iface_array']) { upnp_notice("Starting service"); start_service("miniupnpd"); } } } if(!$iface_array || !$ifaces_final) { /* no parameters user does not want miniupnpd running */ /* lets stop the service and remove the rc file */ stop_service("miniupnpd"); upnp_warn("No interfaces stopping service"); exec("rm -f /usr/local/etc/rc.d/miniupnpd*"); } config_unlock(); conf_mount_ro(); } ?>