UPnP support
-
Are you sure you are on 1.0-RELEASE? I fixed that bug recently…
-
Are you sure you are on 1.0-RELEASE? I fixed that bug recently…
Yes I am on the 1.0-RELEASE.
1.0-RELEASE
built on Fri Oct 13 03:43:48 UTC 2006 -
I fixed multiple bugs in the miniupnpd.inc files. I have attached the complete file along with diff -rub
-no interfaces selected on miniupnpd settings page does not disable miniupnpd
-stop service then delete rc file as miniupnpd is not wanted
-since disabled interfaces are listed on the miniupnpd settings page a user can select one
-do not run miniupnpd on that interface if there is no ip address as parameters are invalid
-added status messages so users can see whats going on in the system log when syncing the package
-lets say user restores config with invalid interface convert_friendly_interface_to_real_interface_name will return the friendly name if it cant convert to the real interface
-if statement only checked if it was blank not for above case, fixed if statement
-my way of seeing if existing miniupnpd service running was long
-changed from ps -A | grep ….. to pgrepIf multiple interfaces are selected on the miniupnpd settings page miniupnpd will correctly run until reboot due to the bug I mentioned in the post above. Once that issue is fixed miniupnpd will work correctly on reboot with multiple interfaces.
Also in miniupnpd.xml we do not need the custom_add_php_command. We already have the custom_php_install_command and custom_php_resync_config_command sections. This just runs the sync_package_miniupnpd twice.
miniupnpd.inc.txt
miniupnpd.xml.diff.txt
miniupnpd.inc.diff.txt -
On miniupnpd settings page if I select two interfaces say LAN and OPT1 when it writes that setting to the config.xml file it stores it as lan,opt1 instead of lan opt1. Due to this the miniupnpd.inc script fails. Also when returning to the miniupnpd settings page it will not show any interfaces selected.
A temp fix I am using is putting the following code in miniupnpd.inc above if ($interface_array)
Look at this more I think the config file is correct being lan,opt1. However when it reads it back its not converting it into an array. Its just giving back the text. I'm assuming it looks for the xml field name being _array and then does this conversion. Otherwise it wouldn't know if the field is text or an array.
If its not suspossed to do a conversion then the pkg_edit page needs to conver the , delimited list into the list box and the miniupnpd.inc file will have to be modofied to convert the , delimited list into an array.
-
On miniupnpd settings page if I select two interfaces say LAN and OPT1 when it writes that setting to the config.xml file it stores it as lan,opt1 instead of lan opt1. Due to this the miniupnpd.inc script fails. Also when returning to the miniupnpd settings page it will not show any interfaces selected.
A temp fix I am using is putting the following code in miniupnpd.inc above if ($interface_array)
Look at this more I think the config file is correct being lan,opt1. However when it reads it back its not converting it into an array. Its just giving back the text. I'm assuming it looks for the xml field name being _array and then does this conversion. Otherwise it wouldn't know if the field is text or an array.
If its not suspossed to do a conversion then the pkg_edit page needs to conver the , delimited list into the list box and the miniupnpd.inc file will have to be modofied to convert the , delimited list into an array.
Look at how the snort, routed, and olsr packages handle interfaces.
–Bill
-
On miniupnpd settings page if I select two interfaces say LAN and OPT1 when it writes that setting to the config.xml file it stores it as lan,opt1 instead of lan opt1. Due to this the miniupnpd.inc script fails. Also when returning to the miniupnpd settings page it will not show any interfaces selected.
A temp fix I am using is putting the following code in miniupnpd.inc above if ($interface_array)
Look at this more I think the config file is correct being lan,opt1. However when it reads it back its not converting it into an array. Its just giving back the text. I'm assuming it looks for the xml field name being _array and then does this conversion. Otherwise it wouldn't know if the field is text or an array.
If its not suspossed to do a conversion then the pkg_edit page needs to conver the , delimited list into the list box and the miniupnpd.inc file will have to be modofied to convert the , delimited list into an array.
Look at how the snort, routed, and olsr packages handle interfaces.
–Bill
I'm assuming this is the key line to converting the , delimited list to an array
$ifarr = explode(",", $config['installedpackages']['routed']['config'][0]['iface_array']);
I will test this out.
-
I have miniupnpd working with multiple interfaces. I have attached the full file along with the diff -rub files. Not sure if you are going to, but it would be great if this could be committed to help others out.
The only issue left is if you select multiple interfaces when returning to the miniupnpd settigns page none are selected.
miniupnpd.inc.txt
miniupnpd.inc.diff.txt
miniupnpd.xml.txt
miniupnpd.xml.diff.txt -
In case anyone cares, I happened to pass by http://miniupnp.free.fr/files/ and noticed a new update (miniupnpd20061018.tar.gz), here's the relevant changes from the Changelog.
2006/10/18: Added an INSTALL file 2006/10/13: Added the possibility to change the notify interval
;D
-
Almost there rsw. <interface_array>is an array type in xmlparse.inc. Rename that variable to iface_array or somethig in both the .inc and .xml file and you should see the settings you save be reflected when you reload the config page.
–Bill</interface_array>
-
Almost there rsw. <interface_array>is an array type in xmlparse.inc. Rename that variable to iface_array or somethig in both the .inc and .xml file and you should see the settings you save be reflected when you reload the config page.
–Bill</interface_array>
I changed the name from interface_array to iface_array and now everytime I click change on the miniupnpd settings page it adds a section to the config instead of replacing the old. Theres probably something simple I am missing.
<miniupnpd><config><iface_array>lan</iface_array>
<overridewanip></overridewanip></config>
<config><iface_array>lan</iface_array>
<overridewanip></overridewanip></config></miniupnpd> -
You can ignore my above post. Not sure why it was doing that, but its not anymore. I made some more changes and rebooted. Must of missed something.
Everything works perfect now. The multiple interfaces selected show on the miniupnpd settings page. I want to test some things out further and will post the changes tonight or tomorrow morning.
-
In further testing I am still having the multiple config problem. Not sure why changing one variable name caused this. I even started over clean and remade the variable name changes. If I go back to my old files with interface_array the problem goes away.
** EDIT
Before with interface_array if the interfaces list box was blank the config xml file still had <interface_array></interface_array>. Now it goes to . This was probably due to it thinking there was data as interface_array conflicted with the data type.I believe this is a bug. If the first xml field in a given config differs it duplicate the config section per the below example. This doesn't happen for subsequent field. If I change the overide wan ip field from blank to an ip address and back it doesn't exhibit the above problem of duplicate config. ** END EDIT
I've comapred my files to snort and olsr and can't see anything that would cause this. Its seem to only be occuring if no interfaces are selected and then an interface is selected.
It thinks <iface_array>config section is different and appends a new section below. I even have the config path defined as in the olsr package.
<configpath>['installedpackages']['miniupnpd']['config']</configpath>
<miniupnpd><config><iface_array><overridewanip></overridewanip></iface_array></config>
<config><iface_array>lan</iface_array>
<overridewanip></overridewanip></config></miniupnpd></iface_array> -
Haven't seen the latest changes, but I assume you're still accessing as:
$config['installedpackages']['miniupnpd']['config'][0]??
–Bill
-
Like this
if($config['installedpackages']['miniupnpd']['config'][0]['iface_array'])
$iface_array = explode(",",$config['installedpackages']['miniupnpd']['config'][0]['iface_array']);I've attached the files. I'm soo confused with this. Everything works perfect if it would only not duplicate the config section if no interfaces are selected. The package doesn't even do the writing of the config.
Also attached the status_upnp.php as the page will always redirect to setup page due to changing iface_array.
-
Like this
if($config['installedpackages']['miniupnpd']['config'][0]['iface_array'])
$iface_array = explode(",",$config['installedpackages']['miniupnpd']['config'][0]['iface_array']);I've attached the files. I'm soo confused with this. Everything works perfect if it would only not duplicate the config section if no interfaces are selected. The package doesn't even do the writing of the config.
Also attached the status_upnp.php as the page will always redirect to setup page due to changing iface_array.
If nobody sees the problem causing the above issue I have a workaround I am currently using. As seen below it will only rebuild the miniupnpd config section if you unselect all interfaces on the settings page, click change and then go back and renable miniupnpd on an interface.
Everything works. Multiple interface selection, selections are shown when returning to the settings page. Unselecting all interfaces and clicking change disables miniupnpd from running. When clicking miniupnpd on the menu you will receive the settings page where you can select an interface to enable it on.
If anybody would like to test it out I have the latest for embedded http://wgnrs.dynalias.com:81/pfsense/pfSense-Embedded-1.0-RELEASE-Miniupnpd.img.gz
if($_POST['iface_array'] && count($config['installedpackages']['miniupnpd']['config'])>1) { $config_array = &$config['installedpackages']['miniupnpd']['config']; /* delete every item leaving the array itself intact */ foreach ($config_array as $i => $value) { unset($config_array[$i]); } /* reindex the array */ $config_array = array_values($config_array); /* rebuild with correct values */ $config_array[0]['iface_array'] = implode(",", $_POST['iface_array']); $config_array[0]['overridewanip'] = $_POST['overridewanip']; /* make the changes final */ write_config(); log_error("miniupnpd: Rebuilt config as it contained duplicate information"); }
Attached is full miniupnpd.inc file. Once I get an answer on this I can make the appropriate changes.
-
Okay so I think the bug is in pfsense itself. It's not assigned the correct id in the form on pkg_edit.php
When interfaces are selcted and the settings page shown it shows id=0 which matches that config section in the xml file
<option value="lan" selected="">LAN</option>
….However when viewing the page when no interface is selected then the value is blank, which means when the config is changed it will add to the next available index in the config array.
<option value="lan">LAN</option>
....Maybe converting <iface_array>to the an array causes it to show null so pkg_edit.php thinks theres no exisitng data. Figuring out exactly the problem in pkg_edit.php would take me awhile since I don't know the code. Hopefully some of this makes sense and I am on the right track and one of the devs can correct the code.</iface_array>
-
if there is no interface selected then there need to be no config
so that when you select the page can make a new config section -
if there is no interface selected then there need to be no config
so that when you select the page can make a new config sectionWell the issue is not the new config, but that the new config is placed below the previous config instead of replacing it. You are correct that if there is no existing config it should make a new one. However the function in pkg_edit.php doesn't seem to realize there is an exisiting config.
-
I know others were having a problem with miniupnpd using close to 100% CPU before. For the first time I have had this error with the latest package. Here's the error that I noticed scattered throughout the log:
miniupnpd[85816]: recv (state0): Operation timed out
I guess its similar to what was posted earlier:
Oct 5 17:09:05 last message repeated 23845 times
Oct 5 17:08:34 miniupnpd[1359]: Unsupported HTTP Command SUBSCRIBE
Oct 5 17:08:34 miniupnpd[1359]: recv (state0): Connection reset by peer
Oct 5 17:08:34 last message repeated 5583 times
Oct 5 17:08:27 miniupnpd[1359]: Unsupported HTTP Command SUBSCRIBE
Oct 5 17:08:27 miniupnpd[1359]: recv (state0): Connection reset by peerIt's funny, I've never had that error before. This is on a fresh install of 1.0-RELEASE with the latest miniupnpd package installed from the package manager.
-
I know others were having a problem with miniupnpd using close to 100% CPU before. For the first time I have had this error with the latest package. Here's the error that I noticed scattered throughout the log:
miniupnpd[85816]: recv (state0): Operation timed out
I guess its similar to what was posted earlier:
Oct 5 17:09:05 last message repeated 23845 times
Oct 5 17:08:34 miniupnpd[1359]: Unsupported HTTP Command SUBSCRIBE
Oct 5 17:08:34 miniupnpd[1359]: recv (state0): Connection reset by peer
Oct 5 17:08:34 last message repeated 5583 times
Oct 5 17:08:27 miniupnpd[1359]: Unsupported HTTP Command SUBSCRIBE
Oct 5 17:08:27 miniupnpd[1359]: recv (state0): Connection reset by peerIt's funny, I've never had that error before. This is on a fresh install of 1.0-RELEASE with the latest miniupnpd package installed from the package manager.
Oct 5 17:08:27 miniupnpd[1359]: Unsupported HTTP Command SUBSCRIBE
Oct 5 17:08:27 miniupnpd[1359]: recv (state0): Connection reset by peerThis error was from a later version, but was rolledback to the previous version which is 20060924.