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

    UPnP support

    Scheduled Pinned Locked Moved Expired/Withdrawn Bounties
    363 Posts 28 Posters 417.1k 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.
    • S
      sullrich
      last edited by

      Try to reinstall the package.  I just commited a change.

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

        @sullrich:

        Try to reinstall the package.  I just commited a change.

        Well were making progress. I figured it was something as simple as including a file. Although now it stops here.

        Warning: Invalid argument supplied for foreach() in /usr/local/pkg/miniupnpd.inc on line 28

        foreach($_POST['interface_array'] as $iface) {

        The issue is there is no post data. However it really comes down to an overthoght in the coding. Since the inferface_array is either pulled form the post data or the config. My thought is it should just read

        foreach($interface_array as $iface) {

        Since the if statement above is setting $interface_array = $_POST['interface_array']; it should still contain the array and properly go through each interface.

        Also shouldn't the start_service("miniupnpd"); line be included in the if statment. If theres no interface array and no file is generated why should we start the service?

        I'm going to make these changes on mine and see what happens. Will report back soon.

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

          Alright with the above changes it works great now. No errors. I can see why pfSense takes so long to get to release 1.0. Lots of easily overlooked things that show up and to have to track them down and fix them all has go to be a major pain.

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

            There is still a bug where it is resyncing packages twice causing issues. It you look at the log it takes longer for miniupnpd to exit than it does for the new one to start. Is there a way to make killall miniupnpd in the miniupnpd.sh file wait until it actually exits before proceeding?

            Oct 7 00:58:56 check_reload_status: updating dyndns
            Oct 7 00:58:42 check_reload_status: reloading filter
            Oct 7 00:58:42 miniupnpd[1106]: Failed to open socket for SSDP. EXITING
            Oct 7 00:58:42 miniupnpd[1106]: bind(udp): Address already in use

            Oct 7 00:58:42 miniupnpd[1092]: received signal 15, exiting
            Oct 7 00:58:35 php: : Resyncing configuration for all packages.
            Oct 7 00:58:30 php: : Creating rrd graph index
            Oct 7 00:58:30 php: : Creating rrd update script
            Oct 7 00:58:30 php: : Informational: DHClient spawned /etc/rc.newwanip and the new ip is wan - 68.100.53.135.
            Oct 7 00:58:21 login: login on console as root
            Oct 7 00:58:01 sshlockout[868]: sshlockout starting up
            Oct 7 00:58:01 sshlockout[868]: sshlockout starting up
            Oct 7 00:58:01 login: login on console as root
            Oct 7 00:57:50 check_reload_status: rc.newwanip starting
            Oct 7 00:57:50 check_reload_status: check_reload_status is starting

            Oct 7 00:57:44 miniupnpd[804]: received signal 15, exiting
            Oct 7 00:57:44 miniupnpd[820]: Failed to open socket for SSDP. EXITING
            Oct 7 00:57:44 miniupnpd[820]: bind(udp): Address already in use

            Oct 7 00:57:43 miniupnpd[804]: Unknown soap method
            Oct 7 00:57:43 miniupnpd[804]: Unknown soap method
            Oct 7 00:57:37 dnsmasq[567]: reading /var/dhcpd/var/db/dhcpd.leases
            Oct 7 00:57:36 php: : Resyncing configuration for all packages.

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

              Hopefully both problems have been addressed now.

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

                Yep you got them. Works great.

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

                  I was wondering if you'd be willing to commit this to the miniupnpd.inc file. Instead of just waiting blindly it checks and loops until all the miniupnpd processes are killed. I have tested it and it works.

                  It counts the number of lines returned by ps relating to /usr/local/sbin/miniupnpd. If its not equal to 0 then we know miniupnpd is still running.

                  $start = "# Clear existing rules and rdr entries \n";
                  $start .= "/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null\n";
                  $start .= "/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null\n";
                  $start .= "/usr/bin/killall miniupnpd\n";
                  $start .= "while [ ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l != 0 ]; do sleep 1; done\n";
                  $start .= "/usr/local/sbin/miniupnpd -p 2869{$ifaces_final}";

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

                    One more adition to miniupnpd.inc that I found usefull on mine. We only need to run the start_service command if the serivce is not running or if the user changes the settings.

                    Othewise everytime the wan dhcp is updated the service is restarted. This is unecessary as only the wan interface NAME is used not the IP. For the -o override the ip is going to be static so it won't change. Plus it causes downtime with apps and game consoles, which can be bothersome.

                    Also this speeds up the boot process as the service won't be restarted numerous times. It starts once and gets restarted once when the rc file is called.

                    /* if not ONE instance running lets start /
                    /
                    or if $_POST data as user is changing settings */
                    if((int)exec("ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l") != 1 || $_POST['interface_array']) {
                    start_service("miniupnpd");
                    }

                    EDIT – I spoke to soon its still restarting when dhcp renewed. Wonder where it is getting called from? I'm using the following code

                    /* if not ONE instance running lets start /
                    /
                    or if $_POST data as user is changing settings */
                    if((int)exec("ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l") != 1 || $_POST['interface_array']) {
                    log_error("miniupnpd resync package: start");
                    start_service("miniupnpd");
                    } else {
                    log_error("miniupnpd resync package: none");
                    }

                    and am getting this in my log

                    Oct 7 16:08:19 miniupnpd[4067]: Unknown soap method
                    Oct 7 16:08:17 check_reload_status: reloading filter
                    Oct 7 16:08:16 miniupnpd[3242]: received signal 15, exiting
                    Oct 7 16:08:15 php: : miniupnpd resync package: none
                    So I wonder where its getting called from. Reguardless it would've restarted twice instead of once without it

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

                      Provide a patch in diff -rub format for all of your recent posts.  At this point its becoming hard to follow you.

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

                        @sullrich:

                        Provide a patch in diff -rub format for all of your recent posts.  At this point its becoming hard to follow you.

                        I think this is what you want.

                        miniupnpd.inc

                        
                        36a37
                        > 	
                        40c41,43
                        < 			$start .= "killall miniupnpd; sleep 3; /usr/local/sbin/miniupnpd -p 2869{$ifaces_final}";
                        ---
                        > 			$start .= "/usr/bin/killall miniupnpd\n";
                        > 			$start .= "while [ `ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l` != 0 ]; do sleep 1; done\n";
                        > 			$start .= "/usr/local/sbin/miniupnpd -p 2869{$ifaces_final}";
                        57c60,66
                        < 		start_service("miniupnpd");
                        ---
                        > 
                        > 		/* if not ONE instance running lets start */
                        > 		/* or if $_POST data as user is changing settings */
                        > 		if((int)exec("ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l") != 1 || $_POST['interface_array']) {
                        > 			start_service("miniupnpd");
                        > 		} 
                        > 		
                        61c70
                        < ?>
                        \ No newline at end of file
                        ---
                        > ?>	
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • S
                          sullrich
                          last edited by

                          diff -rub

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

                            @sullrich:

                            diff -rub

                            Sorry here it is again.

                            
                            --- miniupnpd.inc	2006-10-07 16:23:47.000000000 -0400
                            +++ miniupnpdnew.inc	2006-10-07 16:28:13.000000000 -0400
                            @@ -37,7 +37,9 @@
                             			$start = "# Clear existing rules and rdr entries \n";
                             			$start .= "/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null\n";
                             			$start .= "/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null\n";
                            -			$start .= "killall miniupnpd; sleep 3; /usr/local/sbin/miniupnpd -p 2869{$ifaces_final}";
                            +			$start .= "/usr/bin/killall miniupnpd\n";
                            +			$start .= "while [ `ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l` != 0 ]; do sleep 1; done\n";
                            +			$start .= "/usr/local/sbin/miniupnpd -p 2869{$ifaces_final}";
                            
                             			/* override wan ip address, common for carp, etc */
                             			if($overridewanip)
                            @@ -54,7 +56,13 @@
                             			    )
                             			);
                             		}
                            +
                            +		/* if not ONE instance running lets start */
                            +		/* or if $_POST data as user is changing settings */
                            +		if((int)exec("ps -A | grep /usr/local/sbin/miniupnpd | grep -v grep | wc -l") != 1 || $_POST['interface_array']) {
                             		start_service("miniupnpd");
                            +		} 
                            +		
                             		config_unlock();
                             		conf_mount_ro();
                             	}
                            
                            
                            1 Reply Last reply Reply Quote 0
                            • S
                              sullrich
                              last edited by

                              Commited.  Thanks.

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

                                Excellent work everybody.

                                I've paid my $50 through bradenmcg. It was sent to the general project with the instructions to distribute it as seen fit.

                                I've yet to try the latest miniupnpd builds or even RC3 for that matter. At the moment my main PC and server/domain controller are in peices all over my living room floor being upgraded. Hopefully this weekend it'll be up and running and I can give the latest code a try.

                                Keep up the good work!!

                                UPnP support is going to be a huge feature for the DIY crowd.

                                Thanks!!
                                Riley

                                1 Reply Last reply Reply Quote 0
                                • Z
                                  ZPrime
                                  last edited by

                                  I also donated another $50 as promised in the initial post…  I sent both mine and Skud's to the project since I know there have been several people working on this now after databeestje did the initial stuff and I wanted to let you guys distribute it as you see fit.  :)

                                  It's still a pain in the ass to install on embedded though - that's the last thing I'd like to see resolved but I understand if it doesn't make it to 1.0 final.  As long as there is some way (even unsupported) to make it work on embedded I stay happy.  :D

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

                                    i just used this script to update my miniupnp on my soekris to the 13 oct 18:30 uhr version
                                    it will get the files from the pfsense packages server and move them to the correct maps

                                    /etc/rc.conf_mount_rw
                                    cd /tmp/
                                    mkdir upnp
                                    cd upnp
                                    fetch http://pfsense.org/packages/config/miniupnpd/miniupnpd.inc 
                                    mv -f miniupnpd.inc /usr/local/pkg/miniupnpd.inc
                                    chmod 755 /usr/local/pkg/miniupnpd.inc
                                    fetch http://pfsense.org/packages/config/miniupnpd/miniupnpd.xml 
                                    mv -f miniupnpd.xml /usr/local/pkg/miniupnpd.xml
                                    chmod 755 /usr/local/pkg/miniupnpd.xml
                                    fetch http://pfsense.org/packages/config/miniupnpd/status_upnp.php 
                                    mv -f status_upnp.php /usr/local/www/status_upnp.php
                                    chmod 755 /usr/local/www/status_upnp.php
                                    fetch http://pfsense.org/packages/config/miniupnpd/sbin/miniupnpd 
                                    mv -f miniupnpd /usr/local/sbin/miniupnpd
                                    chmod 755 /usr/local/sbin/miniupnpd
                                    cd ..
                                    rmdir upnp
                                    /etc/rc.conf_mount_ro
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      rsw686
                                      last edited by

                                      @bradenmcg:

                                      It's still a pain in the ass to install on embedded though - that's the last thing I'd like to see resolved but I understand if it doesn't make it to 1.0 final.  As long as there is some way (even unsupported) to make it work on embedded I stay happy.  :D

                                      I added the miniupnpd files to the 1.0-RELEASE image.

                                      http://wgnrs.dynalias.com:81/pfsense/pfSense-Embedded-1.0-RELEASE-Miniupnpd.img.gz

                                      I also updated the script sh-custom-image.sh for 1.0-RELEASE see

                                      http://forum.pfsense.org/index.php/topic,1788.msg13972.html#msg13972

                                      1 Reply Last reply Reply Quote 0
                                      • Z
                                        ZPrime
                                        last edited by

                                        Very cool, thanks rsw686!

                                        I'm guessing that from RC3 I can't upgrade to 1.0 final, right?  Need to pull the CF out of the box again and flash?

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

                                          @bradenmcg:

                                          Very cool, thanks rsw686!

                                          I'm guessing that from RC3 I can't upgrade to 1.0 final, right?  Need to pull the CF out of the box again and flash?

                                          I thought I saw an upgrade, but honestly since your going from prerelease to an actual release I would just flash it.

                                          1 Reply Last reply Reply Quote 0
                                          • H
                                            hoba
                                            last edited by

                                            Upgrades are available at the mirrors too: http://pfsense.com/mirror.php?section=updates

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