UPnP support
-
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.
-
So I installed the last embedded image that was posted here and the following syslog results are obtained. I stopped the process via removing all interfaces in the Settings page after the soap errors.
10-20-2006 00:05:16 User.Notice 192.168.1.1 Oct 20 00:05:10 miniupnpd[3060]: received signal 15, exiting
10-20-2006 00:05:16 User.Warning 192.168.1.1 Oct 20 00:05:10 php: /pkg_edit.php: miniupnpd: No interfaces stopping service
10-20-2006 00:05:16 User.Warning 192.168.1.1 Oct 20 00:05:10 php: /pkg_edit.php: miniupnpd: Syncing package
10-20-2006 00:04:40 User.Notice 192.168.1.1 Oct 20 00:03:44 miniupnpd[3060]: Unknown soap method
10-20-2006 00:03:48 User.Notice 192.168.1.1 Oct 20 00:03:42 miniupnpd[3060]: Unknown soap method
10-20-2006 00:03:46 User.Warning 192.168.1.1 Oct 20 00:03:39 php: /pkg_edit.php: miniupnpd: Starting service
10-20-2006 00:03:45 User.Warning 192.168.1.1 Oct 20 00:03:39 php: /pkg_edit.php: miniupnpd: Active on lan interface
10-20-2006 00:03:45 User.Warning 192.168.1.1 Oct 20 00:03:39 php: /pkg_edit.php: miniupnpd: Syncing package -
So I installed the last embedded image that was posted here and the following syslog results are obtained. I stopped the process via removing all interfaces in the Settings page after the soap errors.
10-20-2006 00:05:16 User.Notice 192.168.1.1 Oct 20 00:05:10 miniupnpd[3060]: received signal 15, exiting
10-20-2006 00:05:16 User.Warning 192.168.1.1 Oct 20 00:05:10 php: /pkg_edit.php: miniupnpd: No interfaces stopping service
10-20-2006 00:05:16 User.Warning 192.168.1.1 Oct 20 00:05:10 php: /pkg_edit.php: miniupnpd: Syncing package
10-20-2006 00:04:40 User.Notice 192.168.1.1 Oct 20 00:03:44 miniupnpd[3060]: Unknown soap method
10-20-2006 00:03:48 User.Notice 192.168.1.1 Oct 20 00:03:42 miniupnpd[3060]: Unknown soap method
10-20-2006 00:03:46 User.Warning 192.168.1.1 Oct 20 00:03:39 php: /pkg_edit.php: miniupnpd: Starting service
10-20-2006 00:03:45 User.Warning 192.168.1.1 Oct 20 00:03:39 php: /pkg_edit.php: miniupnpd: Active on lan interface
10-20-2006 00:03:45 User.Warning 192.168.1.1 Oct 20 00:03:39 php: /pkg_edit.php: miniupnpd: Syncing packagethe user.warning messages can be ignored. I had them set to send out status message of the package process. I need to change the function call so they don't appear as warnings.
The unknown soap method is a normal occurance. I receive it every once in awhile. Something on the network is sending out a request to upnp thats unsupported. I get these multiple times per day. Its coming from my windows boxes. The message appears if I right click internet connection in my network places and click enable. I think windows tries to enable this through the day as well.
I think you will find dispite the soap method occurance that upnp works fine. You can always check the current mapped upnp ports on the status page for miniupnpd.
Also the miniupnpd image that I posted on here is just my compilation of 1.0-RELEASE and miniupnpd. I personally use this version, however packages on embedded systems arn't exactly supported.
-
Yeah, I included all the syslogs as a group rather than cherry picking.
The only important ones were the soap messages.
I do not see any mapped ports being setup no matter what I start on the LAN side.(all apps on XP, azureus, messenger, polling for upnp devices in network neighborhood). I'm running embedded on a nexcom box (Via C3 proc, 3xfxp interfaces) and everything else seems to be fine. I"m really just getting up to speed on pfsense and miniupnpd so I'm fighting a learning curve a bit as well. I was working with miniupnp on openbsd on the same box but was attracted by the nice featureset available out of the gate with pfsense. -
Yeah, I included all the syslogs as a group rather than cherry picking.
The only important ones were the soap messages.
I do not see any mapped ports being setup no matter what I start on the LAN side.(all apps on XP, azureus, messenger, polling for upnp devices in network neighborhood). I'm running embedded on a nexcom box (Via C3 proc, 3xfxp interfaces) and everything else seems to be fine. I"m really just getting up to speed on pfsense and miniupnpd so I'm fighting a learning curve a bit as well. I was working with miniupnp on openbsd on the same box but was attracted by the nice featureset available out of the gate with pfsense.Hmm I'm running the exact same image and on the status page with Azureus open I have ports being mapped. As a matter of fact I just reflashed the box this morning.
If you changed your lan interface IP address you either need to restart the box or goto the miniunpd settings page and click change to rebuild the startup file as it uses your lan ip. Maybe this is the problem in your case.
If your still having issues under diagnostics -> edit file open /usr/local/etc/rc.d/miniupnpd.sh and let me see the line similar to the following. It should be -i WANinterfacename -a LANipaddress
/usr/local/sbin/miniupnpd -p 2869 -i fxp2 -a 10.10.1.1
Also in Azureus goto the Plugins menu -> Log Views -> UpnP should look similar to the below.
[13:43:58] UPnP: root discovered: usn=uuid:00000000-0000-0000-0000-000000000000::upnp:rootdevice, location=http://10.10.1.1:2869/rootDesc.xml, ni=eth2,local=/10.10.1.150 [13:43:58] Device 'http://10.10.1.1:2869/rootDesc.xml' is ok: discover=0,found=0,read_ok=0,read_bad=0,map_ok=0,map_bad=0 [13:43:59] Downloading: http://10.10.1.1:2869/rootDesc.xml [13:43:59] Relative URL base is unspecified [13:43:59] BSD/pf router [13:43:59] dummy:desc=http://10.10.1.1:2869/dummy.xml, control=http://10.10.1.1:2869/dummy [13:43:59] WANDevice [13:43:59] urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1:desc=http://10.10.1.1:2869/WANCfg.xml, control=http://10.10.1.1:2869/control/WANCommonInterfaceConfig [13:43:59] WANConnectionDevice * [13:43:59] urn:schemas-upnp-org:service:WANIPConnection:1:desc=http://10.10.1.1:2869/WANIPCn.xml, control=http://10.10.1.1:2869/control/WANIPConnection [13:43:59] Found WANIPConnection [13:43:59] Downloading: http://10.10.1.1:2869/WANIPCn.xml [13:43:59] UPnP: Mapping 'Incoming Peer Data Port (UDP/6881)' established [13:43:59] Mapping UDP Tracker Client Port (UDP/6881) already established [13:43:59] UPnP: Mapping 'Incoming Peer Data Port (TCP/6881)' established [13:43:59] Mapping Distributed DB (UDP/6881) already established