OpenWrt Forum Archive

Topic: UPnP and RC5

The content of this topic has been archived between 27 Mar 2018 and 25 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Can someone put all of the last few posts into a concise, complete "cookbook" style post for those of us who are loosing track of what installs with what and needs what added or not added?

Jim

BoAustin wrote:

stcoulon, I also am having problems with RC5 and upnp (both linksys' and yani's) and I tried to install the two packages you provided, the libupnp 1.2.1a installed successfully, but the linux-igd failed:

root@OpenWrt:~# ipkg install http://perso.wanadoo.fr/Stephane.Coulon … -linux.ipk
Downloading http://perso.wanadoo.fr/Stephane.Coulon … -linux.ipk
Clearing state_want and state_flag for pkg=linux-igd (arch_priority=0 flag=16 want=2)
Nothing to be done
An error ocurred, return value: 4.
Collected errors:
Cannot find package linux-igd.
Check the spelling or perhaps run 'ipkg update'

I was able to replicate this bug. It installed 0.92 version of linux-igd. If I removed repository with this version from my ipkg.conf and did ipkg update then it refused to install cvs version. I got little frustrated.. So I just renamed ipk to tar.gz did tar xvzf to it and then did

#cd /
#tar xvzf /tmp/data.tar.gz

to install this. Thanks, works great, just a shame that it could had been this easy in the first place with ipkg install smile

Hi,

Everything seems to work all right, after having to install it manually with tar... Here's the same error message with verbosity=3, if it can help someone figure out what's wrong:

root@OpenWrt:~# ipkg -V 3 install linux-igd_1.0.1-cvs_mipsel-linux.ipk
pkg_info_preinstall_check: updating arch priority for each package
Clearing state_want and state_flag for pkg=linux-igd (arch_priority=0 flag=16 want=2)
pkg_info_preinstall_check: update file owner list
best installation candidate for linux-igd
adding linux-igd to providers
  linux-igd arch=mipsel-linux arch_priority=0 constraint=1
Configuring unpacked packages
Nothing to be done
An error ocurred, return value: 4.
Collected errors:
Cannot find package linux-igd.
Check the spelling or perhaps run 'ipkg update'
hash_table[pkg-hash] n_buckets=0 n_elements=488 max_conflicts=0 n_conflicts=0
hash_table[file-hash] n_buckets=0 n_elements=307 max_conflicts=0 n_conflicts=0
hash_table[obs-file-hash] n_buckets=0 n_elements=0 max_conflicts=0 n_conflicts=0

I don't add the the link to my ipkg.conf
just use the url..
it works here quite good.
Just standard. micro version + nas etc smile

A quick how to ...

ipkg install http://perso.wanadoo.fr/Stephane.Coulon … mipsel.ipk http://perso.wanadoo.fr/Stephane.Coulon … -linux.ipk libpthread

(btw for the links... rightclick copy ... otherwise you got '.' (dots) into your url line...)

then
vim /etc/upnpd.conf
edit the lines
#
# The internet line upstream bit rate reported from
# the daemon. Value in bits per second
# default = 0
upstream_bitrate = 1000000

#
# The internet line downstream bit rate reported from
# the daemon. Value in bits per second
# default = 0
downstream_bitrate = 12000000

then :

ln -s /etc/linuxigd/upnpd.rc /etc/init.d/S65upnpd

after that:

/etc/init.d/S65upnpd start

now it starts smile

Good luck and this is how I got it work.

I've a WRT54GS

(Last edited by combro2k on 18 Jul 2006, 17:02)

There's a bug in stop part of init script, here's a fix:

stop() {
    echo -n "Stopping $prog: "
    killall `echo $UPNPD|cut -d "/" -f 3`
    route del -net 239.0.0.0 netmask 255.0.0.0 $INTIFACE
    echo "OK"
}

killall /sbin/upnpd just doesn't work, because killall on openwrt doesn't like paths, this fix strips $UPNPD from "/sbin/upnpd" to just "upnpd"

Second thing.. I have ADSL2MUE setup as a bridge, I changed my upnp setup a little so speed settings are acquired from the modem and set inside upnpd.conf during upnpd startup.
To make this work, you need your ADSL2MUE to be reachable from your router, I wrote a howto on that subject, it's here: http://forum.openwrt.org/viewtopic.php?pid=30739

Okay, now you can reach your ADSL2MUE, right? I use firmware 4.22EU (Plain linksys firmware) but I assume that this works with all linksys's adsl2mue firmware's (expect 2.17TI, I bet it doesn't work with that).

Happy with this and still reading? Okay, let's make changes then..
Move your /etc/upnpd.conf to /etc/config/upnpd.conf

then edit file, remove everything about speed (well, lines containing downstream_bitrate and upstream_bitrate is enough)

My script also writes original comments in upnpd.conf just because.. Well, I just made it do so smile
Then do a symlink from /tmp/upnpd.conf to /etc/upnpd.conf

#ln -s /tmp/upnpd.conf /etc/upnpd.conf

Yeah, I know, file doesn't exist, but ln doesn't complain about that. My startup script will write file /tmp/upnpd.conf.

Okay, now we are ready to go. Here's a new /etc/init.d/S65upnpd:

#!/bin/sh
#
#       /etc/linux-igd/upnpd
#
# Starts the upnpd daemon
#
# description: Internet Gateway Device
# processname: upnpd

# Setup Internal and External interfaces

#Put your DSL Modem's IP or hostname in this variable.
#If you use hostname, make sure that it resolves correctly.

MODEM_IP="10.0.0.9"

#Also make sure that route to your modem exists BEFORE
#upnpd starts.

nvram=/usr/sbin/nvram
INTIFACE=$($nvram get lan_ifname)
EXTIFACE=$($nvram get wan_ifname)

UPNPD=/sbin/upnpd

test -x "$UPNPD" || exit 1

#
#       See how we were called.
#

prog="upnpd"

start() {

    echo -n "Acquiring link speed: "
    wget -q -O - "http://${MODEM_IP}/cgi-bin/webcm?getpage=../html/StatusModem.htm&var:conid=connection0" | grep "var dsl_" > /tmp/.speedreport
    DOWNSTREAM=`grep 'dsl_ds_rate = "' /tmp/.speedreport | cut -d '"' -f 2`
    UPSTREAM=`grep 'dsl_us_rate = "' /tmp/.speedreport | cut -d '"' -f 2`
    rm /tmp/.speedreport
    echo "OK"
    echo Downstream: ${DOWNSTREAM}
    echo Upstream: ${UPSTREAM}

    echo -n "Generating upnpd.conf: "

    cp /etc/config/upnpd.conf /tmp/upnpd.conf
    echo -n "#
# The internet line upstream bit rate reported from
# the daemon. Value in bits per second
# default = 0
upstream_bitrate = ">>/tmp/upnpd.conf
    echo $(( $UPSTREAM * 1000))>>/tmp/upnpd.conf
echo >>/tmp/upnpd.conf
echo -n "#
# The internet line downstream bit rate reported from
# the daemon. Value in bits per second
# default = 0
downstream_bitrate = ">>/tmp/upnpd.conf
echo $(( $DOWNSTREAM * 1000))>>/tmp/upnpd.conf
echo >>/tmp/upnpd.conf

    echo "OK"

    echo -n "Starting $prog: "
    route add -net 239.0.0.0 netmask 255.0.0.0 $INTIFACE
    "$UPNPD" $EXTIFACE $INTIFACE
    echo "OK"
}

stop() {
    echo -n "Stopping $prog: "
    killall `echo $UPNPD|cut -d "/" -f 3`
    route del -net 239.0.0.0 netmask 255.0.0.0 $INTIFACE
    echo "OK"
}


restart() {
        stop
        sleep 10
        start
}

reload() {
        restart
}

case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload|restart)
        restart
        ;;
*)
        echo $"Usage: $0 {start|stop|reload|restart}"
        exit 1
esac

There you go. In windows XP, it says Speed: 8.0 Mbps to me. Works just as it shoulds smile

EDIT: It doesn't seem to work so fine. After I rebooted both devices, adsl2mue wants me to login and I can't do this with wget utility of busybox. But hang on.. I am working on a solution, hard part in this is that password needs to be sent as encrypted (encryption is quite simple as it is done with javascript, but maybe I'll just skip that part since propably nobody has changed from default "admin" password.. or then they have:)

I'll continue tomorrow.. Too tired now..

(Last edited by jake1981 on 19 Jul 2006, 00:59)

btw. in ADSL2MUE, if you need to know what is current DSL speed..

You can find it in /proc/avalanche/avsar_modem_stats

To get correct line..

cat /proc/avalanche/avsar_modem_stats| grep "Connection Rate:"

I tried to make another init script, which would had utilized scp to acquire speed information from that file, but unfortunately I was reported that file doesn't exist when it does exist and I didn't do a typo or anything. Maybe /proc/* is protected somehow, who knows about montavista..

Peoples,

I have fixed Stephane's Linux IGD Package so that it now installs correctly.  I also altered the package so that it notifies you that libupnp and libpthread are prerequisites.

To fix the installation I made two changes to the control file:

1. I set the dependencies value to include libpthread and libupnp
2. I altered the architecture value, changing it back to "mipsel" rather than "mipsel-linux"

Change #2 is what fixed the installation problem, whilst change #1 provides the notification of the dependencies.

I have asked Stephane if he would also like to include the symbolic link to the startup file in the package as well, but until then the current version of the fixed package can be obtained here: http://members.optusnet.com.au/edwardlu … _1.0.1.ipk

Note that all credit still goes to Stephane for getting this package up - I've just added a couple of tweaks to help the installation!

Kaldek

kaldek wrote:

I have asked Stephane if he would also like to include the symbolic link to the startup file in the package as wel
Kaldek

I have spoken with Stephane and he is happy for me to apply all the fixes including the startup file.  I'll generate a new package that contains all three of the modifications and re-post it to my website.  This basically means that the current supported version of upnp is the one hosted on my site, until the next release of OpenWRT when Stephane thinks he will get involved again.

I did add one final change to the package - the bandwidth in the /etc/upnpd.conf file has now been set to 10Mb/s for both upload and download.  I figure this is a good default value.  Not that it actually affects how fast you can download anything - it's effectively meant to be informative more than anything else.

P.S.  I would have edited the previous posts rather than keep adding new ones but there appears to be a problem with posting edits to this thread.

Sorry guys that I had no time to spend fixing the package, as I was very busy at work. Anyway it belongs to the community, and thanks to Kaldek for doing the job. Stéphane.

kaldek thanks for the effort.

I am compelled to ask one question, does this Upnp support work well enough to turn loose my widely scattered family (mostly non-technical) on MSN Messenger using video as well as audio and text?

Some member have an OpenWRT based router (to have this support installed) and others have vanilla Linksys routers with UPnP enabled.

Jim

obrienj wrote:

kaldek thanks for the effort.

I am compelled to ask one question, does this Upnp support work well enough to turn loose my widely scattered family (mostly non-technical) on MSN Messenger using video as well as audio and text?
Jim

Absolutely - it's the first thing I tested on this new package and it's working fine.  Needing MSN video & audio was the original reason I personally got involved with the package in the first place (way back in early 2005).

Since there has been so many updates to this thread I thought I'd provide an updated installation procedure for everyone. 

First, log on to your router as root, then enter the following commands:

cd /tmp
wget http://members.optusnet.com.au/edwardluck/openwrt/packages/libupnp_1.2.1a_mipsel.ipk
ipkg install libupnp_1.2.1a_mipsel.ipk
wget http://members.optusnet.com.au/edwardluck/openwrt/packages/linux-igd_1.0.1.ipk
ipkg install linux-igd_1.0.1.ipk
/etc/init.d/S65upnpd start

Installing the linux-igd package will automatically also install the libpthread package (which is part of the indexed package tree).  Other than these above steps, you don't need to do anything; after any further system reboots, the uPnP daemon will start automatically.

As a Windows XP user, you can tell that the uPnP daemon is working by looking at your Network Connections control panel.  There will be an entry titled "Internet Gateway" which you can double-click on to see the network stats.  You can also right-click on this and manually open any ports - these changes will be applied to IPTables on the router on the fly.  Do note that as soon as you reboot those ports will no longer be open.

As a final note, I do suggest that any newcomers to using uPnP read the security warning section of the uPnP documentation so that you know the risks. http://wiki.openwrt.org/OpenWrtDocs/upnp

(Last edited by kaldek on 31 Jul 2006, 23:55)

kaldek,

Again, many thanks. I will install tomorrow using the wiki doc.  oops, I mean the post that preceeded this one.

Jim

(Last edited by obrienj on 31 Jul 2006, 23:50)

Thanks to kaldek, stcoulon and all others who have contributed to this.

Finally I should be able to use Remote Assistance to help fixing my friend's PC again.

Have a nice week to all!

kaldek wrote:

Since there has been so many updates to this thread I thought I'd provide an updated installation procedure for everyone. 

First, log on to your router as root, then enter the following commands:

cd /tmp
wget http://members.optusnet.com.au/edwardluck/openwrt/packages/libupnp_1.2.1a_mipsel.ipk
ipkg install libupnp_1.2.1a_mipsel.ipk
wget http://members.optusnet.com.au/edwardluck/openwrt/packages/linux-igd_1.0.1.ipk
ipkg install linux-igd_1.0.1.ipk
/etc/init.d/S65upnpd start

Installing the linux-igd package will automatically also install the libpthread package (which is part of the indexed package tree).  Other than these above steps, you don't need to do anything; after any further system reboots, the uPnP daemon will start automatically.

As a Windows XP user, you can tell that the uPnP daemon is working by looking at your Network Connections control panel.  There will be an entry titled "Internet Gateway" which you can double-click on to see the network stats.  You can also right-click on this and manually open any ports - these changes will be applied to IPTables on the router on the fly.  Do note that as soon as you reboot those ports will no longer be open.

As a final note, I do suggest that any newcomers to using uPnP read the security warning section of the uPnP documentation so that you know the risks. http://wiki.openwrt.org/OpenWrtDocs/upnp

I set-up this upnp package on a couple of my openwrts.  I've noticed a few things I thought I'd suggest though;
1) the default setting for upnp.conf doesn't match the way the default way the openwrt crew set-up their firewall; changing these veriables brings that back into sync;
    forward_chain_name = forwarding_rule
    prerouting_chain_name = prerouting_rule
2) One of the openwrts I set this up on has an xbox 360 behind it.  The 360 addes the rules it needs, then no longer and access XBL.  The rules look correct, dnat anything on 3074 to LANIPOF360:3074-0 
  I'm not sure what the -0 means, but I tried removing that rules from iptables and adding with out it, and that made no difference.  My RV042 does not have any issues with the 360, upnp, and XBL.

hi,

I tried to install linux-igd as you describe and it seems some rules are added (no extensive tests yet).

However, several upnpd instances are running (ps)... can you observe the same thing ?

thanks.

yes

I'm seeing them too on Kamikaze, and there's also fail2ban which eat 5 times 9% of my WL-700gE memory..
On my Gentoo machine I have only one instance of upnpd and fail2ban running, what could this be due to ?

(Last edited by Cyberlullaby on 24 Aug 2007, 06:10)

The discussion might have continued from here.