MiniUPnPd Web Installer - Available For Testing

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
edrikk
DD-WRT User


Joined: 31 Oct 2009
Posts: 186
Location: Canada

PostPosted: Sat Dec 26, 2009 20:18    Post subject: Reply with quote
Hi Autobot,

Looks like I have fixed the problem. I don't think it had anything to do with the miniupnpd executable itself, but instead with the iptables rules that you had (which you may have modified a little if I remember correctly at some point).

Please see updated rules based on a merge between your code, and what works in Tomato:



Code:


#!/bin/sh

################| December 26 2009 |################
####################################################
# DD-WRT MiniUPnP Daemon Installation Script #
####################################################

# set the script variables to be called
UPNP_DIR=/tmp
UPNP=/tmp/miniupnpd
MINI=/tmp/miniupnpd.gz
WAN="$(nvram get wan_iface)"
LAN="$(nvram get lan_ipaddr)"
IPT=/usr/sbin/iptables
GETMINIUPNPD="wget http://hackthecode.googlecode.com/files/miniupnpd.gz -O /tmp/miniupnpd.gz"
FLUSH="killall TERM miniupnpd"
FLUSHPNP="killall TERM upnp"

# flush the DD-WRT upnp daemon
$FLUSHPNP

# flush the old miniupnpd and hope he does his job re-forwarding previous ports
$FLUSH

# wget the miniupnpd daemon and decompress
cd $UPNP_DIR


$GETMINIUPNPD

#Error check to ensure wget worked.  If not, just exit now.
if [[ $? != 0 ]]; then
   echo "wget error or wget not installed"
   exit
fi
echo "miniupnpd downloaded successfully"


gunzip -f $MINI

#Error check to ensure gunzip worked.  If not, just exit now.
if [[ $? != 0 ]]; then
   echo "gunzip error or gunzip not installed"
   rm $MINI
   exit
fi

chmod 744 $UPNP

echo "miniupnpd unzipped successfully"


#removing the MINIUPNPD chain for nat
$IPT -t nat -F MINIUPNPD
$IPT -t nat -D PREROUTING -i $WAN -j MINIUPNPD
$IPT -t nat -X MINIUPNPD

#removing the MINIUPNPD chain for filter
$IPT -t filter -F MINIUPNPD
$IPT -t filter -D FORWARD -i $WAN -o ! $WAN -j MINIUPNPD
$IPT -t filter -X MINIUPNPD




#adding the MINIUPNPD chain for nat
$IPT -t nat -N MINIUPNPD
$IPT -t nat -A PREROUTING -i $WAN -j MINIUPNPD

#adding the MINIUPNPD chain for filter
$IPT -t filter -N MINIUPNPD
$IPT -t filter -A FORWARD -i $WAN -o ! $WAN -j MINIUPNPD



# run miniupnpd then sleep two seconds
cd $UPNP_DIR
./miniupnpd -i $WAN -a $LAN
sleep 2

# finish up with a message
echo '#########################################################

To test, run the command:
     iptables -L MINIUPNPD
and all new forwarded ports should show up once you have
launched an applicaton that uses upnp.

#########################################################'


echo "######################| Checking |#######################"

# see if its running
TEN4="$(cat /var/run/miniupnpd.pid)"
echo "MiniUPnP Daemon running on PID# :" $TEN4

# remove downloaded gzip as it's no longer needed
rm $MINI

# end script
exit






The above works (for me). Note the main changes are:

1) Changing the -I (insert) flag to -A (append). Note that this by itself did not fix it. You may want to leave this as -I if you have other reasons for that. -A seems "safer" to me though.

2) Additional iptables cleanup rules (-D)

3) Enhancement of the "-A" items to include the additional external interface information.




With the above changes, COD:MW2 connects to the servers *immediately* and shows "NAT Type" as "Open" as it should. :)


If you want, I think you can put back the "newer" executable on the google servers.



EDIT:
Added a small error check for the most error prone portion of this code (which is the download from the external server).

Added an error check for gunzip as well.

Added "-f" option to gunzip to ensure that the file is unziped even if it's not the first run of the shell script (i.e. non-empty directory).

Added rm $MINI in case of gunzip error
Sponsor
autobot
DD-WRT Guru


Joined: 07 May 2009
Posts: 1596

PostPosted: Sat Dec 26, 2009 22:11    Post subject: Reply with quote
Thanks edrikk, I'm still not back from shopping. On my way back.
_________________
Eko Builds

BrainSlayer Builds

DD-WRT Changelog RSS Feed
autobot
DD-WRT Guru


Joined: 07 May 2009
Posts: 1596

PostPosted: Sat Dec 26, 2009 22:14    Post subject: Reply with quote
This was supposed to be temporary, that's why no logic exists in the shell script. I can't check your additions, but I appreciate your effort.
_________________
Eko Builds

BrainSlayer Builds

DD-WRT Changelog RSS Feed
autobot
DD-WRT Guru


Joined: 07 May 2009
Posts: 1596

PostPosted: Sat Dec 26, 2009 23:44    Post subject: Reply with quote
I will change the script to your additions, put the new build back up and see what happens....Give me a few minutes.
_________________
Eko Builds

BrainSlayer Builds

DD-WRT Changelog RSS Feed
edrikk
DD-WRT User


Joined: 31 Oct 2009
Posts: 186
Location: Canada

PostPosted: Sun Dec 27, 2009 0:18    Post subject: Reply with quote
Awesome Autobot!

Happy holidays!
autobot
DD-WRT Guru


Joined: 07 May 2009
Posts: 1596

PostPosted: Sun Dec 27, 2009 0:36    Post subject: Reply with quote
Its going to take me a while, my brother is playing fantasy football....ugh.

I will post back when its done, thank you edrikk for making improvements.

Happy holidays.

_________________
Eko Builds

BrainSlayer Builds

DD-WRT Changelog RSS Feed
autobot
DD-WRT Guru


Joined: 07 May 2009
Posts: 1596

PostPosted: Sun Dec 27, 2009 1:33    Post subject: Reply with quote
The script is updated, if it doesn't work it's edrikks' fault ;)

I can't seem to figure out where my depreciated miniupnpd.gz has gone, the googlecode site is very cryptic in how it works.

_________________
Eko Builds

BrainSlayer Builds

DD-WRT Changelog RSS Feed
latinpapie
DD-WRT User


Joined: 01 May 2009
Posts: 274
Location: San Jose, Ca

PostPosted: Sun Dec 27, 2009 1:42    Post subject: Reply with quote
thanks for the update im going to run mini upnp and see how it runs
_________________
E3000 K2.6 Eko 16758 Mega
E3000 CB K2.6 EKO 16758 STD USB NAS
WRT610N V2 CB K2.6 Eko15337 STD Nokaid
WRT310N V2 CB K2.6 BS 15362 STD Nokaid
edrikk
DD-WRT User


Joined: 31 Oct 2009
Posts: 186
Location: Canada

PostPosted: Sun Dec 27, 2009 2:01    Post subject: Reply with quote
Guys please report back if it works for you!

Its on my head if it doesn't!
Smile
latinpapie
DD-WRT User


Joined: 01 May 2009
Posts: 274
Location: San Jose, Ca

PostPosted: Sun Dec 27, 2009 2:05    Post subject: Reply with quote
ummm im not sure if its working but a few hours i removed miniupnp so im adding it again but when i add the code:

sleep 10
wget http://hackthecode.googlecode.com/files/miniupnpd.sh -O /tmp/miniupnpd.sh
chmod +x /tmp/miniupnpd.sh
sh /tmp/miniupnpd.sh

then save firewall... then i run this command:

iptables -L MINIUPNPD

nothing pops up as if i type the code wrong in command prompt....so not sure if its me lol

_________________
E3000 K2.6 Eko 16758 Mega
E3000 CB K2.6 EKO 16758 STD USB NAS
WRT610N V2 CB K2.6 Eko15337 STD Nokaid
WRT310N V2 CB K2.6 BS 15362 STD Nokaid


Last edited by latinpapie on Sun Dec 27, 2009 2:11; edited 1 time in total
edrikk
DD-WRT User


Joined: 31 Oct 2009
Posts: 186
Location: Canada

PostPosted: Sun Dec 27, 2009 2:10    Post subject: Reply with quote
Did you reboot your router?

Also, are you sure you have upnp items running after the reboot?


The iptables -L MINIUPNPD command shows my ports open.
latinpapie
DD-WRT User


Joined: 01 May 2009
Posts: 274
Location: San Jose, Ca

PostPosted: Sun Dec 27, 2009 2:15    Post subject: Reply with quote
iuno my router is being dumb for some reason its not accepting the iptables -L MINIUPNPD so its not showing anything at all
_________________
E3000 K2.6 Eko 16758 Mega
E3000 CB K2.6 EKO 16758 STD USB NAS
WRT610N V2 CB K2.6 Eko15337 STD Nokaid
WRT310N V2 CB K2.6 BS 15362 STD Nokaid
edrikk
DD-WRT User


Joined: 31 Oct 2009
Posts: 186
Location: Canada

PostPosted: Sun Dec 27, 2009 2:24    Post subject: Reply with quote
All I can say is reboot your router.

THEN run some upnp apps and finally check.
latinpapie
DD-WRT User


Joined: 01 May 2009
Posts: 274
Location: San Jose, Ca

PostPosted: Sun Dec 27, 2009 2:26    Post subject: Reply with quote
i think i need to do a 30/30/30 ive been messing with the settings and stuff all day ill do it a little later and see it works on my end...
_________________
E3000 K2.6 Eko 16758 Mega
E3000 CB K2.6 EKO 16758 STD USB NAS
WRT610N V2 CB K2.6 Eko15337 STD Nokaid
WRT310N V2 CB K2.6 BS 15362 STD Nokaid
edrikk
DD-WRT User


Joined: 31 Oct 2009
Posts: 186
Location: Canada

PostPosted: Sun Dec 27, 2009 2:58    Post subject: Reply with quote
Hi Autobot, I think you put up the file through windows without proper FTP or something.

I just checked, and in dd-wrt all lines end in "^M".

This won't work as it stands, as it will fail to load anything.

I have attached my working copy.



miniupnpd.zip
 Description:

Download
 Filename:  miniupnpd.zip
 Filesize:  1021 Bytes
 Downloaded:  929 Time(s)

Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next Display posts from previous:    Page 6 of 8
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum