Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    UPnP support

    Scheduled Pinned Locked Moved Expired/Withdrawn Bounties
    363 Posts 28 Posters 412.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rsw686
      last edited by

      @bradenmcg:

      Actually, it looks like this…

      Executing rc.d items...
      Starting /usr/local/etc/rc.d/miniupnpd.sh...
      Starting /usr/local/etc/rc.d/miniupnpd.sh...
      done.
      There's no "done" between each invocation of the script, which I found a little odd (and why I considered it might be a problem at all).

      The "Terminated" thing makes sense though, I didn't really investigate it too hard as I've been playing Xbox instead (yay UPnP).  ;D

      Are you sure you just didn't miss the done. Check status.php at the bottom in the DMESG section. Its not really possible for it not to show done. Look at the code.

      for FILE in /usr/local/etc/rc.d/.sh; do
      echo -n " Starting ${FILE}…"
      sh $FILE stop >>/tmp/bootup_messages 2>&1 &
      echo "done."
          done
          for FILE in /usr/local/etc/rc.d/
      .sh; do
      echo -n " Starting ${FILE}..."
      sh $FILE start >>/tmp/bootup_messages 2>&1 &
      echo "done."
          done

      Reguardless your install seems to be working just fine as your playing xbox.  ;)

      1 Reply Last reply Reply Quote 0
      • R
        rsw686
        last edited by

        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)

        /* for some reason interface array is stored as lan,opt1 not lan opt1 */
        $interface_array = str_replace(","," ",$interface_array);

        1 Reply Last reply Reply Quote 0
        • S
          sullrich
          last edited by

          Are you sure you are on 1.0-RELEASE?  I fixed that bug recently…

          1 Reply Last reply Reply Quote 0
          • R
            rsw686
            last edited by

            @sullrich:

            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

            1 Reply Last reply Reply Quote 0
            • R
              rsw686
              last edited by

              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 pgrep

              If 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

              1 Reply Last reply Reply Quote 0
              • R
                rsw686
                last edited by

                @rsw686:

                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.

                1 Reply Last reply Reply Quote 0
                • B
                  billm
                  last edited by

                  @rsw686:

                  @rsw686:

                  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

                  pfSense core developer
                  blog - http://www.ucsecurity.com/
                  twitter - billmarquette

                  1 Reply Last reply Reply Quote 0
                  • R
                    rsw686
                    last edited by

                    @billm:

                    @rsw686:

                    @rsw686:

                    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.

                    1 Reply Last reply Reply Quote 0
                    • R
                      rsw686
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • S
                        Superman
                        last edited by

                        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

                        1 Reply Last reply Reply Quote 0
                        • B
                          billm
                          last edited by

                          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>

                          pfSense core developer
                          blog - http://www.ucsecurity.com/
                          twitter - billmarquette

                          1 Reply Last reply Reply Quote 0
                          • R
                            rsw686
                            last edited by

                            @billm:

                            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>

                            1 Reply Last reply Reply Quote 0
                            • R
                              rsw686
                              last edited by

                              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.

                              1 Reply Last reply Reply Quote 0
                              • R
                                rsw686
                                last edited by

                                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>

                                1 Reply Last reply Reply Quote 0
                                • B
                                  billm
                                  last edited by

                                  Haven't seen the latest changes, but I assume you're still accessing as:
                                  $config['installedpackages']['miniupnpd']['config'][0]

                                  ??

                                  –Bill

                                  pfSense core developer
                                  blog - http://www.ucsecurity.com/
                                  twitter - billmarquette

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    rsw686
                                    last edited by

                                    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.

                                    miniupnpd.inc.txt
                                    miniupnpd.xml.txt
                                    status_upnp.php.txt

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      rsw686
                                      last edited by

                                      @rsw686:

                                      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.

                                      miniupnpd.inc.txt

                                      1 Reply Last reply Reply Quote 0
                                      • R
                                        rsw686
                                        last edited by

                                        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>

                                        1 Reply Last reply Reply Quote 0
                                        • J
                                          jeroen234
                                          last edited by

                                          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

                                          1 Reply Last reply Reply Quote 0
                                          • R
                                            rsw686
                                            last edited by

                                            @jeroen234:

                                            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

                                            Well 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.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.