summaryrefslogtreecommitdiffstats
path: root/usr/local/pkg
diff options
context:
space:
mode:
authorRyan Wagoner <rsw686@pfsense.org>2007-07-23 16:57:18 +0000
committerRyan Wagoner <rsw686@pfsense.org>2007-07-23 16:57:18 +0000
commit1cb3a834d3c1c0d2048fa6b4eb7af3822445ed71 (patch)
treeefb480f7926694b54132be8a7e6174b087c792e4 /usr/local/pkg
parentdb157e3b5a0162cf90dcc215205c48d24f22e58d (diff)
downloadpfsense-1cb3a834d3c1c0d2048fa6b4eb7af3822445ed71.zip
pfsense-1cb3a834d3c1c0d2048fa6b4eb7af3822445ed71.tar.gz
-move upnp_action to services.inc
-make sure to clear rules when stopping miniupnpd -fix status_upnp and status_services pages so they use upnp_action and not the rcfile
Diffstat (limited to 'usr/local/pkg')
-rw-r--r--usr/local/pkg/miniupnpd.inc56
-rw-r--r--usr/local/pkg/miniupnpd.xml6
2 files changed, 8 insertions, 54 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc
index c0ec6da..5e1a204 100644
--- a/usr/local/pkg/miniupnpd.inc
+++ b/usr/local/pkg/miniupnpd.inc
@@ -4,25 +4,11 @@
/* MiniUPnPd */
+ define('UPNP_CONFIG','/var/etc/miniupnpd.conf');
+
function upnp_notice ($msg) { syslog(LOG_NOTICE, "miniupnpd: {$msg}"); return; }
function upnp_warn ($msg) { syslog(LOG_WARNING, "miniupnpd: {$msg}"); return; }
- function upnp_action ($action) {
- switch($action) {
- case "start":
- mwexec("killall miniupnpd 2>/dev/null");
- upnp_start();
- break;
- case "stop":
- mwexec("killall miniupnpd");
- break;
- case "restart":
- mwexec("killall miniupnpd");
- upnp_start();
- break;
- }
- }
-
function upnp_running () {
if((int)exec("pgrep miniupnpd | wc -l") > 0)
return true;
@@ -37,7 +23,6 @@
}
function upnp_write_config($conf_file, $conf_text) {
- $conf_file = "/var/etc/miniupnpd.conf";
$conf = fopen($conf_file, "w");
if(!$conf) {
upnp_warn("Could not open {$conf_file} for writing.");
@@ -154,8 +139,6 @@
/* since config is written before this file invoked we don't need to read post data */
if(upnp_config('enable') && upnp_config('iface_array'))
$iface_array = explode(',',upnp_config('iface_array'));
- else
- upnp_action("stop");
if($iface_array) {
foreach($iface_array as $iface) {
@@ -233,28 +216,8 @@
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 /var/etc/miniupnpd.conf";
-
/* write out the configuration */
- conf_mount_rw();
- upnp_write_config("/var/etc/miniupnpd.conf",$configtext);
- conf_mount_ro();
+ upnp_write_config(UPNP_CONFIG,$configtext);
/* if miniupnpd not running start it */
if(!upnp_running()) {
@@ -273,18 +236,15 @@ EOD;
/* no parameters user does not want miniupnpd running */
/* lets stop the service and remove the rc file */
- if(file_exists(UPNP_RCFILE)) {
+ if(file_exists(UPNP_CONFIG)) {
if(!upnp_config('enable'))
upnp_notice('Stopping service: miniupnpd disabled');
else
- upnp_notice('Stopping service: no interfaces selected');
-
- upnp_action('stop');
+ upnp_notice('Stopping service: no interfaces selected');
- conf_mount_rw();
- unlink(UPNP_RCFILE);
- unlink("/var/etc/miniupnpd.conf");
- conf_mount_ro();
+ upnp_notice('Stopping service: miniupnpd disabled');
+ upnp_action('stop');
+ unlink(UPNP_CONFIG);
}
}
diff --git a/usr/local/pkg/miniupnpd.xml b/usr/local/pkg/miniupnpd.xml
index bac2337..dc3b057 100644
--- a/usr/local/pkg/miniupnpd.xml
+++ b/usr/local/pkg/miniupnpd.xml
@@ -123,10 +123,4 @@
<custom_php_resync_config_command>
sync_package_miniupnpd();
</custom_php_resync_config_command>
- <custom_php_install_command>
- sync_package_miniupnpd();
- </custom_php_install_command>
- <custom_php_deinstall_command>
- exec("rm -f /usr/local/etc/rc.d/miniupnpd*");
- </custom_php_deinstall_command>
</packagegui>
OpenPOWER on IntegriCloud