aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/miniupnpd/miniupnpd.inc56
-rw-r--r--packages/miniupnpd/miniupnpd.xml5
-rwxr-xr-xpackages/miniupnpd/sbin/miniupnpdbin45100 -> 44587 bytes
-rw-r--r--pkg_config.xml2
4 files changed, 40 insertions, 23 deletions
diff --git a/packages/miniupnpd/miniupnpd.inc b/packages/miniupnpd/miniupnpd.inc
index fa5160c6..a8721c8b 100644
--- a/packages/miniupnpd/miniupnpd.inc
+++ b/packages/miniupnpd/miniupnpd.inc
@@ -2,7 +2,7 @@
require_once("config.inc");
require_once("functions.inc");
- /* Miniupnp */
+ /* Miniupnpd */
function upnp_notice ($msg) { syslog(LOG_NOTICE, "miniupnpd: $msg"); return; }
function upnp_warn ($msg) { syslog(LOG_WARNING, "miniupnpd: $msg"); return; }
@@ -27,6 +27,8 @@
function before_form_miniupnpd($pkg) {
global $config;
+ config_lock();
+
/* if shaper connection speed defined hide fields */
if($config['ezshaper']['step2']['download'] && $config['ezshaper']['step2']['upload']) {
$i=0;
@@ -36,6 +38,8 @@
$i++;
}
}
+
+ config_unlock();
}
function validate_form_miniupnpd($post, $input_errors) {
@@ -56,13 +60,10 @@
function sync_package_miniupnpd() {
global $config;
global $input_errors;
- $ifaces_final = "";
+ $ifaces_final = "";
$wanif = get_real_wan_interface();
- upnp_notice("Syncing package");
-
- conf_mount_rw();
- config_lock();
+ config_lock();
/* since config is written before this file invoked we don't need to read post data */
if(upnp_config("iface_array"))
@@ -77,13 +78,16 @@
/* non enabled interfaces are displayed in list on miniupnpd settings page */
/* check that the interface has an ip address before adding parameters */
if($addr) {
- upnp_notice("Active on {$iface} interface");
$ifaces_final .= " -a {$addr}";
+ if(!$ifaces_active)
+ $ifaces_active = "{$iface}";
+ else
+ $ifaces_active .= ", {$iface}";
} else {
- upnp_warn("Interface {$iface} has no ip address");
+ upnp_warn("Interface {$iface} has no ip address, ignoring");
}
} else {
- upnp_warn("Could not resolve real interface {$iface}");
+ upnp_warn("Could not resolve real interface for {$iface}");
}
}
@@ -136,20 +140,28 @@ EOD;
/* enable system uptime instead of miniupnpd uptime */
if($sysuptime)
$start .= " -U";
-
+
+ conf_mount_rw();
+
write_rcfile(array(
"file" => "miniupnpd.sh",
"start" => $start,
"stop" => $stop
)
);
+
+ conf_mount_ro();
- /* 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 miniupnpd not running start it */
+ if(!is_service_running("miniupnpd")) {
+ upnp_notice("Starting service on interface: {$ifaces_active}");
+ start_service("miniupnpd");
+ }
+ /* or restart miniupnpd if settings were changed */
+ elseif($_POST['iface_array']) {
+ upnp_notice("Restarting service on interface: {$ifaces_active}");
+ restart_service("miniupnpd");
+ }
}
}
@@ -157,12 +169,16 @@ EOD;
/* 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*");
+ if(file_exists("/usr/local/etc/rc.d/miniupnpd.sh")) {
+ upnp_notice("Stopping service, no interfaces selected");
+ stop_service("miniupnpd");
+
+ conf_mount_rw();
+ unlink("/usr/local/etc/rc.d/miniupnpd.sh");
+ conf_mount_ro();
+ }
}
config_unlock();
- conf_mount_ro();
}
?>
diff --git a/packages/miniupnpd/miniupnpd.xml b/packages/miniupnpd/miniupnpd.xml
index fbe61f66..058e472d 100644
--- a/packages/miniupnpd/miniupnpd.xml
+++ b/packages/miniupnpd/miniupnpd.xml
@@ -2,7 +2,7 @@
<packagegui>
<title>Services: Miniupnpd</title>
<name>miniupnpd</name>
- <version>20061129</version>
+ <version>20061214</version>
<savetext>Change</savetext>
<include_file>/usr/local/pkg/miniupnpd.inc</include_file>
<aftersaveredirect>status_upnp.php</aftersaveredirect>
@@ -45,7 +45,8 @@
</tabs>
<fields>
<field>
- <fielddescr>Interface (generally LAN)</fielddescr>
+ <fielddescr>Interface (generally LAN)&lt;br&gt;
+ NOTE: If no interfaces are selected miniupnpd is disabled</fielddescr>
<fieldname>iface_array</fieldname>
<value>lan</value>
<multiple>true</multiple>
diff --git a/packages/miniupnpd/sbin/miniupnpd b/packages/miniupnpd/sbin/miniupnpd
index 011db00a..5d5a85f9 100755
--- a/packages/miniupnpd/sbin/miniupnpd
+++ b/packages/miniupnpd/sbin/miniupnpd
Binary files differ
diff --git a/pkg_config.xml b/pkg_config.xml
index fdcbd84e..28dc5c60 100644
--- a/pkg_config.xml
+++ b/pkg_config.xml
@@ -160,7 +160,7 @@
<website>http://miniupnp.free.fr/</website>
<category>Network Management</category>
<maintainer>seth.mos@xs4all.nl ryan@wgnrs.dynu.com</maintainer>
- <version>20061129</version>
+ <version>20061214</version>
<required_version>1.0</required_version>
<status>Stable</status>
<config_file>http://www.pfsense.com/packages/config/miniupnpd/miniupnpd.xml</config_file>