UPnP support
-
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(); }
-
Commited. Thanks.
-
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 -
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
-
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
-
@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
-
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?
-
@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.
-
Upgrades are available at the mirrors too: http://pfsense.com/mirror.php?section=updates
-
I thought I saw an upgrade, but honestly since your going from prerelease to an actual release I would just flash it.
On your recommendation I reflashed with your pre-built embedded miniupnp image…
It's working, but I'm getting a couple odd behaviors on startup.
During boot, the synching packages/startup scripts runs miniupnp.sh twice in a row. Is this by design?
The other thing I'm seeing is that on the console, the menu system comes up and sits for a while, and then I see the message "Terminated" and the menu redisplays itself.
I imagine there's something going on behind the scenes but i'm not seeing anything in the syslog, at least not through the web.
-
@bradenmcg:
I thought I saw an upgrade, but honestly since your going from prerelease to an actual release I would just flash it.
On your recommendation I reflashed with your pre-built embedded miniupnp image…
It's working, but I'm getting a couple odd behaviors on startup.
During boot, the synching packages/startup scripts runs miniupnp.sh twice in a row. Is this by design?
The other thing I'm seeing is that on the console, the menu system comes up and sits for a while, and then I see the message "Terminated" and the menu redisplays itself.
I imagine there's something going on behind the scenes but i'm not seeing anything in the syslog, at least not through the web.
The two miniupnp.sh scripts starting is a bug in 1.0-RELEASE. See http://cvstrac.pfsense.com/tktview?tn=1124 It should say stopping miniupnpd.sh and then starting miniupnpd.sh. The stop / start code is right but the message displayed is wrong.
Looks like this right
Executing rc.d items…
Starting /usr/local/etc/rc.d/miniupnpd.sh...
done.
Starting /usr/local/etc/rc.d/miniupnpd.sh...
done.Not sure on the menu issue, but thats not from miniupnpd. Everything is the same as the 1.0-RELEASE image except for the miniupnpd files and the miniupnpd installed packages section in the config. The files don't modify the system files, they are just added to the proper directorys just as if you installed it from the package manager.
How long does it take to say terminated. I'm assuming this is on the serial console as its the embedded image. You using hyperterminal in windows or some other terminal program. I am actually curious if mine does that as well. I just never leave it open.
EDIT:
I just looked at status.php in DMESG. I am getting the terminated. Must be something changed in 1.0-RELEASE as I don't remember seeing that before.
Enter an option:
TerminatedThe Terminated is the /etc/rc.initial script being terminated and then restarted since it is in a loop. Something is killing the process.
-
You know the terminated on the console issue isn't a bug. Mine shows terminated 4 times in dmesg on the status.php page. However it looks to be linked to the dhcp renewal on the wan interface. Which makes sense as the menu shows the current ip address for the WAN interface so it gets termianted and restarted to reflect the current WAN IP.
-
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
-
@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.That's a typo. It's purely cosmetic and is already fixed in CVS. I wouldn't waste your time on chasing down a bug there ;) Thanks
–Bill
-
@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."
doneReguardless your install seems to be working just fine as your playing xbox. ;)
-
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); -
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.