diff --git a/pkg/+POST_INSTALL b/pkg/+POST_INSTALL index 0927f6f28..4b65ab4b4 100644 --- a/pkg/+POST_INSTALL +++ b/pkg/+POST_INSTALL @@ -22,4 +22,5 @@ cat /etc/rc.bak >> /etc/rc rm -f /etc/rc.bak echo "Writing OPNsense version" -echo "%%REPO_VERSION%%-%%REPO_COMMENT%%" > /usr/local/etc/version +mkdir -p /usr/local/opnsense/version +echo "%%REPO_VERSION%%-%%REPO_COMMENT%%" > /usr/local/opnsense/version/opnsense diff --git a/pkg/+PRE_DEINSTALL b/pkg/+PRE_DEINSTALL index b1a0cf2ad..7bb2fe305 100644 --- a/pkg/+PRE_DEINSTALL +++ b/pkg/+PRE_DEINSTALL @@ -15,4 +15,4 @@ echo "Enabling FreeBSD mirror" sed -i "" -e "s/^ enabled: no$/ enabled: yes/" /etc/pkg/FreeBSD.conf echo "Removing OPNsense version" -rm -f /usr/local/etc/version +rm -f /usr/local/opnsense/version/opnsense diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index fbdc1c75f..4dec8e8bb 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -1,15 +1,9 @@ array("version" => trim(file_get_contents('/usr/local/etc/version'))), + $rawparams = array("firmware" => array("version" => trim(file_get_contents('/usr/local/opnsense/version/opnsense'))), "kernel" => array("version" => $version[0]), "base" => array("version" => $version[0]), "platform" => trim(file_get_contents('/usr/local/etc/platform')), @@ -763,7 +750,7 @@ function host_firmware_version($tocheck = "") { $os_version = trim(substr(php_uname("r"), 0, strpos(php_uname("r"), '-'))); return array( - "firmware" => array("version" => trim(file_get_contents('/usr/local/etc/version', " \n"))), + "firmware" => array("version" => trim(file_get_contents('/usr/local/opnsense/version/opnsense', " \n"))), "kernel" => array("version" => $os_version), "base" => array("version" => $os_version), "platform" => trim(file_get_contents('/usr/local/etc/platform', " \n")), @@ -1618,7 +1605,7 @@ function download_file($url, $destination, $verify_ssl = false, $connect_timeout curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/usr/local/etc/version"))); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/usr/local/opnsense/version/opnsense"))); if (!empty($config['system']['proxyurl'])) { curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']); @@ -1660,7 +1647,7 @@ function download_file_with_progress_bar($url_file, $destination_file, $readbody curl_setopt($ch, CURLOPT_NOPROGRESS, '1'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/usr/local/etc/version"))); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/usr/local/opnsense/version/opnsense"))); if (!empty($config['system']['proxyurl'])) { curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']); diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index fe39bad83..1656a1151 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -1,16 +1,10 @@ = 0); @@ -1311,7 +1299,7 @@ function package_skip_tests($index,$requested_version){ global $config, $g; /* Get pfsense version*/ - $version = rtrim(file_get_contents("/usr/local/etc/version")); + $version = rtrim(file_get_contents("/usr/local/opnsense/version/opnsense")); if($g['platform'] == "nanobsd") if($index['noembedded']) @@ -1396,7 +1384,7 @@ function check_package_server_ssl() { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '30'); curl_setopt($ch, CURLOPT_TIMEOUT, 60); - curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/usr/local/etc/version"))); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/usr/local/opnsense/version/opnsense"))); $result_page = curl_exec($ch); $verifyfail = curl_getinfo($ch, CURLINFO_SSL_VERIFYRESULT); curl_close($ch); diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 39bf0ac58..37003a315 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -1906,7 +1906,7 @@ trap := "{$config['snmpd']['trapstring']}" EOD; } - $version = trim(file_get_contents('/usr/local/etc/version')); + $version = trim(file_get_contents('/usr/local/opnsense/version/opnsense')); $platform = trim(file_get_contents('/usr/local/etc/platform')); if (($platform == "pfSense") && ($g['product_name'] != "pfSense")) $platform = $g['product_name']; diff --git a/src/etc/rc.initial.banner b/src/etc/rc.initial.banner index ceb226ddb..edfd611db 100755 --- a/src/etc/rc.initial.banner +++ b/src/etc/rc.initial.banner @@ -33,7 +33,7 @@ require_once("config.inc"); require_once("gwlb.inc"); require_once("interfaces.inc"); -$version = trim(file_get_contents("/usr/local/etc/version")); +$version = trim(file_get_contents('/usr/local/opnsense/version/opnsense')); $hostname = $config['system']['hostname']; $product = $g['product_name']; $machine = trim(`uname -m`); diff --git a/src/opnsense/scripts/pkg_updatecheck.sh b/src/opnsense/scripts/pkg_updatecheck.sh index cb1966ce3..ca8a9ddae 100755 --- a/src/opnsense/scripts/pkg_updatecheck.sh +++ b/src/opnsense/scripts/pkg_updatecheck.sh @@ -63,7 +63,6 @@ timeout=30 # Wait for a maximum number of seconds to determine connection issues package_json_output="/tmp/pkg_status.json" tmp_pkg_output_file="/tmp/packages.output" tmp_pkg_update_file="/tmp/pkg_updates.output" -version_file="/usr/local/etc/version" # Check if pkg is already runnig pkg_running=`ps -x | grep "pkg " | grep -v "grep"` diff --git a/src/pkg/miniupnpd.inc b/src/pkg/miniupnpd.inc index b4123c495..7bbe86cdd 100644 --- a/src/pkg/miniupnpd.inc +++ b/src/pkg/miniupnpd.inc @@ -1,261 +1,261 @@ 0) - return true; +function upnp_notice ($msg) { log_error("miniupnpd: {$msg}"); } +function upnp_warn ($msg) { log_error("miniupnpd: {$msg}"); } + +function upnp_running () { + if((int)exec('/bin/pgrep -a miniupnpd | /usr/bin/wc -l') > 0) + return true; + return false; +} + +function upnp_write_config($file, $text) { + $handle = fopen($file, 'w'); + if(!$handle) { + upnp_warn("Could not open {$file} for writing."); + return; + } + fwrite($handle, $text); + fclose($handle); +} + +function upnp_uuid() { + /* md5 hash of wan mac */ + $uuid = md5(get_interface_mac(get_real_interface("wan"))); + /* put uuid in correct format 8-4-4-4-12 */ + return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12); +} + +function upnp_validate_queue($qname) { + read_altq_config(); + $qlist = get_altq_name_list(); + if (is_array($qlist)) { + return in_array($qname, $qlist); + } else { return false; } +} - function upnp_write_config($file, $text) { - $handle = fopen($file, 'w'); - if(!$handle) { - upnp_warn("Could not open {$file} for writing."); - return; - } - fwrite($handle, $text); - fclose($handle); - } - - function upnp_uuid() { - /* md5 hash of wan mac */ - $uuid = md5(get_interface_mac(get_real_interface("wan"))); - /* put uuid in correct format 8-4-4-4-12 */ - return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12); - } - - function upnp_validate_queue($qname) { - read_altq_config(); - $qlist = get_altq_name_list(); - if (is_array($qlist)) { - return in_array($qname, $qlist); - } else { - return false; - } - } - - function upnp_validate_ip($ip, $check_cdir) { - /* validate cidr */ - $ip_array = array(); - if($check_cdir) { - $ip_array = explode('/', $ip); - if(count($ip_array) == 2) { - if($ip_array[1] < 1 || $ip_array[1] > 32) - return false; - } else - if(count($ip_array) != 1) - return false; - } else - $ip_array[] = $ip; - - /* validate ip */ - if (!is_ipaddr($ip_array[0])) - return false; - return true; - } - - function upnp_validate_port($port) { - foreach(explode('-', $port) as $sub) - if($sub < 0 || $sub > 65535) +function upnp_validate_ip($ip, $check_cdir) { + /* validate cidr */ + $ip_array = array(); + if($check_cdir) { + $ip_array = explode('/', $ip); + if(count($ip_array) == 2) { + if($ip_array[1] < 1 || $ip_array[1] > 32) return false; - return true; - } + } else + if(count($ip_array) != 1) + return false; + } else + $ip_array[] = $ip; - function before_form_miniupnpd(&$pkg) { - global $config; + /* validate ip */ + if (!is_ipaddr($ip_array[0])) + return false; + return true; +} - } +function upnp_validate_port($port) { + foreach(explode('-', $port) as $sub) + if($sub < 0 || $sub > 65535) + return false; + return true; +} - function validate_form_miniupnpd($post, &$input_errors) { - if($post['enable'] && (!$post['enable_upnp'] && !$post['enable_natpmp'])) - $input_errors[] = 'At least one of \'UPnP\' or \'NAT-PMP\' must be allowed'; - if($post['iface_array']) - foreach($post['iface_array'] as $iface) { - if($iface == 'wan') - $input_errors[] = 'It is a security risk to specify WAN in the \'Interface\' field'; - elseif ($iface == $post['ext_iface']) - $input_errors[] = 'You cannot select the external interface as an internal interface.'; - } - if($post['overridewanip'] && !upnp_validate_ip($post['overridewanip'],false)) - $input_errors[] = 'You must specify a valid ip address in the \'Override WAN address\' field'; - if(($post['download'] && !$post['upload']) || ($post['upload'] && !$post['download'])) - $input_errors[] = 'You must fill in both \'Maximum Download Speed\' and \'Maximum Upload Speed\' fields'; - if($post['download'] && $post['download'] <= 0) - $input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Download Speed\' field'; - if($post['upload'] && $post['upload'] <= 0) - $input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Upload Speed\' field'; - if($post['upnpqueue'] && !upnp_validate_queue($post['upnpqueue'])) - $input_errors[] = 'You must specify a valid traffic shaping queue.'; +function before_form_miniupnpd(&$pkg) { + global $config; - /* user permissions validation */ - for($i=1; $i<=4; $i++) { - if($post["permuser{$i}"]) { - $perm = explode(' ',$post["permuser{$i}"]); - /* should explode to 4 args */ - if(count($perm) != 4) { - $input_errors[] = "You must follow the specified format in the 'User specified permissions {$i}' field"; - } else { - /* must with allow or deny */ - if(!($perm[0] == 'allow' || $perm[0] == 'deny')) - $input_errors[] = "You must begin with allow or deny in the 'User specified permissions {$i}' field"; - /* verify port or port range */ - if(!upnp_validate_port($perm[1]) || !upnp_validate_port($perm[3])) - $input_errors[] = "You must specify a port or port range between 0 and 65535 in the 'User specified - permissions {$i}' field"; - /* verify ip address */ - if(!upnp_validate_ip($perm[2],true)) - $input_errors[] = "You must specify a valid ip address in the 'User specified permissions {$i}' field"; - } +} + +function validate_form_miniupnpd($post, &$input_errors) { + if($post['enable'] && (!$post['enable_upnp'] && !$post['enable_natpmp'])) + $input_errors[] = 'At least one of \'UPnP\' or \'NAT-PMP\' must be allowed'; + if($post['iface_array']) + foreach($post['iface_array'] as $iface) { + if($iface == 'wan') + $input_errors[] = 'It is a security risk to specify WAN in the \'Interface\' field'; + elseif ($iface == $post['ext_iface']) + $input_errors[] = 'You cannot select the external interface as an internal interface.'; + } + if($post['overridewanip'] && !upnp_validate_ip($post['overridewanip'],false)) + $input_errors[] = 'You must specify a valid ip address in the \'Override WAN address\' field'; + if(($post['download'] && !$post['upload']) || ($post['upload'] && !$post['download'])) + $input_errors[] = 'You must fill in both \'Maximum Download Speed\' and \'Maximum Upload Speed\' fields'; + if($post['download'] && $post['download'] <= 0) + $input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Download Speed\' field'; + if($post['upload'] && $post['upload'] <= 0) + $input_errors[] = 'You must specify a value greater than 0 in the \'Maximum Upload Speed\' field'; + if($post['upnpqueue'] && !upnp_validate_queue($post['upnpqueue'])) + $input_errors[] = 'You must specify a valid traffic shaping queue.'; + + /* user permissions validation */ + for($i=1; $i<=4; $i++) { + if($post["permuser{$i}"]) { + $perm = explode(' ',$post["permuser{$i}"]); + /* should explode to 4 args */ + if(count($perm) != 4) { + $input_errors[] = "You must follow the specified format in the 'User specified permissions {$i}' field"; + } else { + /* must with allow or deny */ + if(!($perm[0] == 'allow' || $perm[0] == 'deny')) + $input_errors[] = "You must begin with allow or deny in the 'User specified permissions {$i}' field"; + /* verify port or port range */ + if(!upnp_validate_port($perm[1]) || !upnp_validate_port($perm[3])) + $input_errors[] = "You must specify a port or port range between 0 and 65535 in the 'User specified + permissions {$i}' field"; + /* verify ip address */ + if(!upnp_validate_ip($perm[2],true)) + $input_errors[] = "You must specify a valid ip address in the 'User specified permissions {$i}' field"; } } } +} - function sync_package_miniupnpd() { - global $config; - global $input_errors; +function sync_package_miniupnpd() { + global $config; + global $input_errors; - $upnp_config = $config['installedpackages']['miniupnpd']['config'][0]; - $config_file = '/var/etc/miniupnpd.conf'; + $upnp_config = $config['installedpackages']['miniupnpd']['config'][0]; + $config_file = '/var/etc/miniupnpd.conf'; - if (!isset($upnp_config['ext_iface']) || empty($upnp_config['ext_iface'])) - $ext_ifname = get_real_interface(); + if (!isset($upnp_config['ext_iface']) || empty($upnp_config['ext_iface'])) + $ext_ifname = get_real_interface(); + else { + $if = convert_friendly_interface_to_real_interface_name($upnp_config['ext_iface']); + if ($if != $upnp_config['ext_iface']) + $ext_ifname = $if; else { - $if = convert_friendly_interface_to_real_interface_name($upnp_config['ext_iface']); - if ($if != $upnp_config['ext_iface']) - $ext_ifname = $if; - else { - $ext_ifname = get_real_interface(); - upnp_warn("Could not resolve real interface for {$upnp_config['ext_iface']}, defaulting to WAN"); - } - } - - $config_text = "ext_ifname={$ext_ifname}\n"; - $config_text .= "port=2189\n"; - - $ifaces_active = ''; - - /* since config is written before this file invoked we don't need to read post data */ - if($upnp_config['enable'] && !empty($upnp_config['iface_array'])) { - $iface_array = explode(',', $upnp_config['iface_array']); - - foreach($iface_array as $iface) { - /* Setting the same internal and external interface is not allowed. */ - if ($iface == $upnp_config['ext_iface']) - continue; - $if = convert_friendly_interface_to_real_interface_name($iface); - /* above function returns iface if fail */ - if($if!=$iface) { - $addr = find_interface_ip($if); - $bits = find_interface_subnet($if); - /* check that the interface has an ip address before adding parameters */ - if (is_ipaddr($addr)) { - $config_text .= "listening_ip={$if}\n"; - if(!$ifaces_active) { - $webgui_ip = $addr; - $ifaces_active = $iface; - } else - $ifaces_active .= ", {$iface}"; - } else - upnp_warn("Interface {$iface} has no ip address, ignoring"); - } else - upnp_warn("Could not resolve real interface for {$iface}"); - } - - if (!empty($ifaces_active)) { - /* override wan ip address, common for carp, etc */ - if($upnp_config['overridewanip']) - $config_text .= "ext_ip={$upnp_config['overridewanip']}\n"; - - $download = $upnp_config['download']*1000; - $upload = $upnp_config['upload']*1000; - - /* set upload and download bitrates */ - if(!empty($download) && !empty($upload)) { - $config_text .= "bitrate_down={$download}\n"; - $config_text .= "bitrate_up={$upload}\n"; - } - - /* enable logging of packets handled by miniupnpd rules */ - if($upnp_config['logpackets']) - $config_text .= "packet_log=yes\n"; - - /* enable system uptime instead of miniupnpd uptime */ - if($upnp_config['sysuptime']) - $config_text .= "system_uptime=yes\n"; - - /* set webgui url */ - if(!empty($config['system']['webgui']['protocol'])) { - $config_text .= "presentation_url={$config['system']['webgui']['protocol']}://{$webgui_ip}"; - if(!empty($config['system']['webgui']['port'])) - $config_text .= ":{$config['system']['webgui']['port']}"; - $config_text .= "/\n"; - } - - /* set uuid and serial */ - $config_text .= "uuid=".upnp_uuid()."\n"; - $config_text .= "serial=".strtoupper(substr(upnp_uuid(),0,8))."\n"; - - /* set model number */ - $config_text .= "model_number=".file_get_contents("/usr/local/etc/version")."\n"; - - /* upnp access restrictions */ - for($i=1; $i<=4; $i++) { - if($upnp_config["permuser{$i}"]) - $config_text .= "{$upnp_config["permuser{$i}"]}\n"; - } - - if($upnp_config['permdefault']) - $config_text .= "deny 0-65535 0.0.0.0/0 0-65535\n"; - - /* Recheck if queue is valid */ - if (!upnp_validate_queue($upnp_config['upnpqueue'])) - unset($upnp_config['upnpqueue']); - - /* Add shaper queue */ - if($upnp_config['upnpqueue']) - $config_text .= "queue={$upnp_config['upnpqueue']}\n"; - - /* Allow UPnP or NAT-PMP as requested */ - $config_text .= "enable_upnp=" . ( $upnp_config['enable_upnp'] ? "yes\n" : "no\n" ); - $config_text .= "enable_natpmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\n" ); - - /* write out the configuration */ - upnp_write_config($config_file, $config_text); - - /* if miniupnpd not running start it */ - if(!upnp_running()) { - upnp_notice("Starting service on interface: {$ifaces_active}"); - upnp_action('start'); - } - /* or restart miniupnpd if settings were changed */ - else { - upnp_notice("Restarting service on interface: {$ifaces_active}"); - upnp_action('restart'); - } - } - } else { - /* user does not want miniupnpd running */ - /* lets stop the service and remove the rc 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); - } + $ext_ifname = get_real_interface(); + upnp_warn("Could not resolve real interface for {$upnp_config['ext_iface']}, defaulting to WAN"); } } -?> + + $config_text = "ext_ifname={$ext_ifname}\n"; + $config_text .= "port=2189\n"; + + $ifaces_active = ''; + + /* since config is written before this file invoked we don't need to read post data */ + if($upnp_config['enable'] && !empty($upnp_config['iface_array'])) { + $iface_array = explode(',', $upnp_config['iface_array']); + + foreach($iface_array as $iface) { + /* Setting the same internal and external interface is not allowed. */ + if ($iface == $upnp_config['ext_iface']) + continue; + $if = convert_friendly_interface_to_real_interface_name($iface); + /* above function returns iface if fail */ + if($if!=$iface) { + $addr = find_interface_ip($if); + $bits = find_interface_subnet($if); + /* check that the interface has an ip address before adding parameters */ + if (is_ipaddr($addr)) { + $config_text .= "listening_ip={$if}\n"; + if(!$ifaces_active) { + $webgui_ip = $addr; + $ifaces_active = $iface; + } else + $ifaces_active .= ", {$iface}"; + } else + upnp_warn("Interface {$iface} has no ip address, ignoring"); + } else + upnp_warn("Could not resolve real interface for {$iface}"); + } + + if (!empty($ifaces_active)) { + /* override wan ip address, common for carp, etc */ + if($upnp_config['overridewanip']) + $config_text .= "ext_ip={$upnp_config['overridewanip']}\n"; + + $download = $upnp_config['download']*1000; + $upload = $upnp_config['upload']*1000; + + /* set upload and download bitrates */ + if(!empty($download) && !empty($upload)) { + $config_text .= "bitrate_down={$download}\n"; + $config_text .= "bitrate_up={$upload}\n"; + } + + /* enable logging of packets handled by miniupnpd rules */ + if($upnp_config['logpackets']) + $config_text .= "packet_log=yes\n"; + + /* enable system uptime instead of miniupnpd uptime */ + if($upnp_config['sysuptime']) + $config_text .= "system_uptime=yes\n"; + + /* set webgui url */ + if(!empty($config['system']['webgui']['protocol'])) { + $config_text .= "presentation_url={$config['system']['webgui']['protocol']}://{$webgui_ip}"; + if(!empty($config['system']['webgui']['port'])) + $config_text .= ":{$config['system']['webgui']['port']}"; + $config_text .= "/\n"; + } + + /* set uuid and serial */ + $config_text .= "uuid=".upnp_uuid()."\n"; + $config_text .= "serial=".strtoupper(substr(upnp_uuid(),0,8))."\n"; + + /* set model number */ + $config_text .= "model_number=".file_get_contents("/usr/local/opnsense/version/opnsense")."\n"; + + /* upnp access restrictions */ + for($i=1; $i<=4; $i++) { + if($upnp_config["permuser{$i}"]) + $config_text .= "{$upnp_config["permuser{$i}"]}\n"; + } + + if($upnp_config['permdefault']) + $config_text .= "deny 0-65535 0.0.0.0/0 0-65535\n"; + + /* Recheck if queue is valid */ + if (!upnp_validate_queue($upnp_config['upnpqueue'])) + unset($upnp_config['upnpqueue']); + + /* Add shaper queue */ + if($upnp_config['upnpqueue']) + $config_text .= "queue={$upnp_config['upnpqueue']}\n"; + + /* Allow UPnP or NAT-PMP as requested */ + $config_text .= "enable_upnp=" . ( $upnp_config['enable_upnp'] ? "yes\n" : "no\n" ); + $config_text .= "enable_natpmp=" . ( $upnp_config['enable_natpmp'] ? "yes\n" : "no\n" ); + + /* write out the configuration */ + upnp_write_config($config_file, $config_text); + + /* if miniupnpd not running start it */ + if(!upnp_running()) { + upnp_notice("Starting service on interface: {$ifaces_active}"); + upnp_action('start'); + } + /* or restart miniupnpd if settings were changed */ + else { + upnp_notice("Restarting service on interface: {$ifaces_active}"); + upnp_action('restart'); + } + } + } else { + /* user does not want miniupnpd running */ + /* lets stop the service and remove the rc 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); + } + } +} diff --git a/src/www/pkg_mgr.php b/src/www/pkg_mgr.php index 7905eec84..339731914 100644 --- a/src/www/pkg_mgr.php +++ b/src/www/pkg_mgr.php @@ -1,4 +1,5 @@ @@ -123,7 +124,7 @@ include("head.inc"); "" ? false : true, "pkg_mgr.php"); @@ -136,7 +137,7 @@ include("head.inc");