summaryrefslogtreecommitdiffstats
path: root/usr/local/pkg
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-03-02 00:18:12 +0000
committerErmal <eri@pfsense.org>2011-03-02 00:18:12 +0000
commit88cbd62a8261e20b6ce741fbb7a1f0d3872d6f0c (patch)
tree533a4d8f78ecebbb9bee56b46b7f565b4b28aca1 /usr/local/pkg
parent2816f43f5bcd32721423ae31b5ccea3201aae7e0 (diff)
downloadpfsense-88cbd62a8261e20b6ce741fbb7a1f0d3872d6f0c.zip
pfsense-88cbd62a8261e20b6ce741fbb7a1f0d3872d6f0c.tar.gz
More fixes to comments and code for upnpd. Also bring up to speed the stop/start logic.
Diffstat (limited to 'usr/local/pkg')
-rw-r--r--usr/local/pkg/miniupnpd.inc29
1 files changed, 11 insertions, 18 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc
index 5aba7c5..d7ba238 100644
--- a/usr/local/pkg/miniupnpd.inc
+++ b/usr/local/pkg/miniupnpd.inc
@@ -130,34 +130,29 @@
$ifaces_active = '';
/* since config is written before this file invoked we don't need to read post data */
- if($upnp_config['enable'] && $upnp_config['iface_array'])
+ if($upnp_config['enable'] && !empty($upnp_config['iface_array'])) {
$iface_array = explode(',', $upnp_config['iface_array']);
- if($iface_array) {
foreach($iface_array as $iface) {
$if = convert_friendly_interface_to_real_interface_name($iface);
/* above function returns iface if fail */
if($if!=$iface) {
$addr = find_interface_ip($if);
- /* non enabled interfaces are displayed in list on miniupnpd settings page */
/* check that the interface has an ip address before adding parameters */
- if($addr) {
+ if (is_ipaddr($addr)) {
$config_text .= "listening_ip={$addr}\n";
if(!$ifaces_active) {
$webgui_ip = $addr;
$ifaces_active = $iface;
- } else {
+ } else
$ifaces_active .= ", {$iface}";
- }
- } else {
+ } else
upnp_warn("Interface {$iface} has no ip address, ignoring");
- }
- } else {
+ } else
upnp_warn("Could not resolve real interface for {$iface}");
- }
}
- if($ifaces_active) {
+ if (!empty($ifaces_active)) {
/* override wan ip address, common for carp, etc */
if($upnp_config['overridewanip'])
$config_text .= "ext_ip={$upnp_config['overridewanip']}\n";
@@ -224,25 +219,23 @@
upnp_action('start');
}
/* or restart miniupnpd if settings were changed */
- elseif($_POST['iface_array']) {
+ else {
upnp_notice("Restarting service on interface: {$ifaces_active}");
upnp_action('restart');
}
}
- }
-
- if(!$iface_array || !$ifaces_active) {
- /* no parameters user does not want miniupnpd running */
+ } else {
+ /* user does not want miniupnpd running */
/* lets stop the service and remove the rc file */
- if(file_exists($config_file)) {
+ if (file_exists($config_file)) {
if(!$upnp_config['enable'])
upnp_notice('Stopping service: miniupnpd disabled');
else
upnp_notice('Stopping service: no interfaces selected');
upnp_action('stop');
- unlink($config_file);
+ @unlink($config_file);
}
}
}
OpenPOWER on IntegriCloud