miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compile and build for Ti AR7 NSP ADSL Router
Goto page 1, 2  Next
 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation
View previous topic :: View next topic  
Author Message
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Mon Dec 17, 2007 12:33 am    Post subject: Compile and build for Ti AR7 NSP ADSL Router Reply with quote

Hi,

Thanks for the software - and support for small devices - mine definitely needs it!

I have built a version of miniupnpd to run on my Ti AR7 ADSL router running Routertech firmware, it runs a Ti/Montavista 2.4.17 kernel and I've used a combination of OpenWrt, Tarifa and Routertech scripts to build - but have a couple of initial questions.

I compiled/built and am running a version from 20071103 The version of iptables running is v1.2.6a which doesn't seem to have ipt_free. So I added a dummy function to just free the handle - is this likely to be a big problem? The compiler also objected to the str declaration

netfilter/iptcrdr.c:46: field `str' has incomplete type

so I patched this with str[32] is this big enough? Maybe 64 would be safer?

To compile the latest RC12 I also had to take out a #if 0 in

netfilter/iptcrdr.h to get rid of

"upnpredirect.c:76: warning: implicit declaration of function `get_redirect_rule'" etc

I guess this is a debug patch?

Edit: seems to work...



Last edited by mstombs on Sat Jan 12, 2008 2:46 am; edited 1 time in total
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Dec 18, 2007 8:47 am    Post subject: Re: Compile and buid for Ti AR7 NSP ADSL Router Reply with quote

mstombs wrote:
Hi,

Thanks for the software - and support for small devices - mine definitely needs it!

I have built a version of miniupnpd to run on my Ti AR7 ADSL router running Routertech firmware, it runs a Ti/Montavista 2.4.17 kernel and I've used a combination of OpenWrt, Tarifa and Routertech scripts to build - but have a couple of initial questions.

First of all, thanks a lot for your feedback !
mstombs wrote:
I compiled/built and am running a version from 20071103 The version of iptables running is v1.2.6a which doesn't seem to have ipt_free. So I added a dummy function to just free the handle - is this likely to be a big problem?

You should check for memory leaks Sad In case There is a leak, you would need to kill and restart miniupnpd periodically.
mstombs wrote:
The compiler also objected to the str declaration

netfilter/iptcrdr.c:46: field `str' has incomplete type

so I patched this with str[32] is this big enough? Maybe 64 would be safer?

in fact str[0] should be ok !
Code:
                l = strlen(desc) + 1;
                p = malloc(sizeof(struct rdr_desc) + l);
takes care of allocating enough bytes, whatever the length of the string is.
mstombs wrote:
To compile the latest RC12 I also had to take out a #if 0 in

netfilter/iptcrdr.h to get rid of

"upnpredirect.c:76: warning: implicit declaration of function `get_redirect_rule'" etc

I guess this is a debug patch?

I forgot to include the new commonrdr.h in upnpredirect.c...
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Dec 18, 2007 9:00 am    Post subject: Reply with quote

what compiler are you using ?
Seems like it doesn't like the "extern" declarations in commonrdr.h
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Tue Dec 18, 2007 10:20 pm    Post subject: Reply with quote

miniupnp wrote:
what compiler are you using ?


I think it comes from the Montavista preview kit, via the Russian Acorp site - used by Routertech to compile the Ti AR7 kernel etc, has filename

/opt/hardhat/previewkit/mips/mipsel-linux-uclibc/bin/mipsel-uclibc-gcc

and seems to be:-

mips_fp_le-gcc:v 2.95.3

Quote:
Seems like it doesn't like the "extern" declarations in commonrdr.h


fixed by including commonrdr.h as you indicated above.

I've now built a version which uses my old "upnpd" command line parameters (in the router upnpd is started by binary module 'core logic' from the web interface, and this can't be changed).

I've also added a lookup of the downstream ADSL connect rate, but have run into another problem:- Just servicing the windows IGD status display takes up over 5% of the router CPU. It seems windows is continuously requesting data and the file/string handling in getifstatis.c is slow. Is there any way to reduce this update rate - or should I add a counter and only look-up the values 1 in 10 times asked, say? Edit - looks like a 'feature' for the Linux getifstats - it does the file/string handling for every variable requested from upnpsoap so at least 5 times more often than needed!
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Dec 19, 2007 9:18 am    Post subject: Reply with quote

ok, so you are using gcc 2.95, that could explain some minor compilation problems. Thanks !

About getifstat, yes, Windows is polling when the status windows is open.
That should not happen very often !
I think there is indeed some improvement possible for that code but it is not my priority : 99% of the time thoses functions are not called. Most applications just use addPortMapping and DeletePortMapping.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Wed Dec 19, 2007 4:31 pm    Post subject: Reply with quote

My Windoze PC seems to poll twice per second! I slowed down the file read/parse but it didn't make a big difference to CPU load - I suspect windows just polls faster! - must just remember not to leave that status window open (and must check another PC!).

I do have a memory leak though, if I run the Microsoft IGD test program many times "top" reports that Miniupnp increases from 2.5% to 7.5% of the router ram (I have 16MB, but other similar devices only have 6 or 8MB). Looks like the lipitc library was extensively revised since my current version.

Do you have minimum recommended Linux iptables/netfilter version?

I've also put my init/end scripts into my main code to make the binary self contained - is there any reason why they would be better as external bash scripts (note I don't have 'awk'!)?
Back to top
View user's profile Send private message
jchuit



Joined: 15 Apr 2007
Posts: 9
Location: Netherlands

PostPosted: Wed Dec 19, 2007 5:20 pm    Post subject: iptables 1.3.5 Reply with quote

The Tarifa firmware uses iptables 1.3.5, I tested different iptables versions, example 1.2.7a and 1.3.3.
Iptables 1.2.7a gave me compile problems too.

It seems that some UPnP deamons cannot operate with iptables 1.3.x and others not with iptables 1.2.x, but why??

An other sollution is to compile the firmware with iptables 1.2.x and Link miniUPnPd to iptables 1.3.5.
Just copy iptables in a map called iptables_1.3.5 and Link miniUPnPd to this map.

Greetings,
jchuit
http://tarifa.sourceforge.net/
Back to top
View user's profile Send private message Visit poster's website
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Wed Dec 19, 2007 6:26 pm    Post subject: Reply with quote

Hi jchuit,

I have your firmware source on my PC although I don't currently use it on my wrt54gs -sorry! - I really like how you identify your changes to the Linksys source clearly!

I assumed that to change the iptables version meant the kernel netfilter code had to change with all the potential issues that might cause with the chain reaction of updating all dependencies?

There's a thread here which discusses the introduction of ipt_free

http://lists.netfilter.org/pipermail/netfilter-devel/2003-May/011325.html

and it seems the libiptc library was extensively rewritten in ~2004.

The original upnpd on my modem is based on a Ti version of Intel linux_igd code and doesn't use the the libiptc library - it uses iptables commands via shell commands. It's also 3 times the size of miniupnpd, launches 6 processes and takes 6 times the ram to run (it starts with double my memory leaking miniupnpd version got to!).
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Dec 19, 2007 6:43 pm    Post subject: Reply with quote

mstombs wrote:
My Windoze PC seems to poll twice per second! I slowed down the file read/parse but it didn't make a big difference to CPU load - I suspect windows just polls faster! - must just remember not to leave that status window open (and must check another PC!).

I think I will code some netinfo caching in order to improve things on devices like yours. It won't be difficult. I keep you updated !
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Wed Dec 19, 2007 10:23 pm    Post subject: Reply with quote

That'll be great - I also have an upstream connect rate I can harvest from the ADSL stats - but it doesn't have anywhere to go - windows only seems to display one rate. You can specify two rates on the command line, does windows ask for both?

[edit] Following jchuit's advice I have now built my version of miniupnpd against a previously built version of iptables v1.3.7 (as included with tomato, built using Linksys toolchain). This includes ipt_free and no sign of a memory leak so far. The microsoft test here adds and removes 20 port maps each time

http://www.microsoft.com/windows/using/tools/igd/results.mspx

I've now run it 3 times and memory usage solid at 2.5%. I'll now try building into a version of the Routertech filesystem (I'm currently running from ramdisk)
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Dec 20, 2007 12:15 pm    Post subject: Reply with quote

mstombs wrote:
That'll be great - I also have an upstream connect rate I can harvest from the ADSL stats - but it doesn't have anywhere to go - windows only seems to display one rate. You can specify two rates on the command line, does windows ask for both?

Indeed windows only display the downstream rate. It asks for both because both values are returned by the same GetCommonLinkProperties UPnP method.
getifstats() with caching capability is here : miniupnpd-20071220.tar.gz.
Dont forget to
Code:
make -f Makefile.linux config.h
edit config.h to uncomment the #define ENABLE_GETIFSTATS_CACHING
make -f Makefile.linux

_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Thu Dec 20, 2007 7:13 pm    Post subject: Reply with quote

Many thanks only parsing those text files every 2 seconds seems sensible.

I will also see if I can use your Makefile properly, I currently have a custom Makefile called from a custom script... and I'm not sure where the config.h came from.... can't remember why probably due to the need to cross-compile for Linux 2.4 on misple on Linux 2.6 on 586 - similar to OpenWrt or Tarifa.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Dec 20, 2007 7:29 pm    Post subject: Reply with quote

mstombs wrote:
Many thanks only parsing those text files every 2 seconds seems sensible.

I will also see if I can use your Makefile properly, I currently have a custom Makefile called from a custom script... and I'm not sure where the config.h came from.... can't remember why probably due to the need to cross-compile for Linux 2.4 on misple on Linux 2.6 on 586 - similar to OpenWrt or Tarifa.

well in fact you can make your own config.h file by hand, that would be the right thing to do if you cross compile !
In that case you can just run genconfig.sh on a linux host to generate a config.h for linux and see if it needs changes.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
mstombs



Joined: 16 Dec 2007
Posts: 23

PostPosted: Sat Dec 22, 2007 3:08 pm    Post subject: Reply with quote

OK I'm up and running using latest miniupnpd as a binary replacement for an older upnpd in my router firmware. Faster reading of the interface stats just seemed to encourage my windows pc to poll faster so I added a small delay which seems to limit the router load. In a bigger LAN I can see it would be beneficial to be able to disable the IGD presentation mode - this can be done in tomato - is there an easy way to do this in miniupnpd?

I have one further issue, the uptime reported to windows is wrong (200+ days) this is because miniupnp records the router start time before the router has had a chance to contact a timeserver. The uptime reported by /proc/uptime is correct and I guess could be used in the future. I'll try just delaying the start of upnp processes by say 30 seconds to work around this.

I also have an issue with the WAN IP changing during operation. I can use ppp-up and ppp-down scripts to change the nat PREROUTING diversion, but I can't see an easy way to re-insert the rule with the new WAN IP address in the ideal place. Ideally it would be between custom portforwards and a DMZ rule. Adding the new rule after the DMZ rule would break upnp services (I've seen this in forum comment re OpenWRT) so I've opted to Insert the new rule. Only issue I see is that upnp diversions would take precedence over any other port fowards - but if upnp is enable users would expect it to work (and accept the security concerns?).
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Sat Dec 22, 2007 4:22 pm    Post subject: Reply with quote

mstombs wrote:
OK I'm up and running using latest miniupnpd as a binary replacement for an older upnpd in my router firmware. Faster reading of the interface stats just seemed to encourage my windows pc to poll faster so I added a small delay which seems to limit the router load.

I guess a usleep() at the right place is the thing to do Wink
mstombs wrote:
In a bigger LAN I can see it would be beneficial to be able to disable the IGD presentation mode - this can be done in tomato - is there an easy way to do this in miniupnpd?

What do you call "IGD presentation mode" ?
If it is the sending of SSDP Notify messages, I think you can edit the minissdp.c file and play with functions like SendSSDPNotifies() or SendSSDPNotifies2()

mstombs wrote:
I have one further issue, the uptime reported to windows is wrong (200+ days) this is because miniupnp records the router start time before the router has had a chance to contact a timeserver. The uptime reported by /proc/uptime is correct and I guess could be used in the future. I'll try just delaying the start of upnp processes by say 30 seconds to work around this.

maybe the simplest thing to do in your case is to change the GetStatusInfo() function in upnpsoap.c to directly read /proc/uptime and totally forget startup_time Smile GetStatusInfo() could also be improved to return accurate informations about the connection status.
mstombs wrote:
I also have an issue with the WAN IP changing during operation. I can use ppp-up and ppp-down scripts to change the nat PREROUTING diversion, but I can't see an easy way to re-insert the rule with the new WAN IP address in the ideal place. Ideally it would be between custom portforwards and a DMZ rule. Adding the new rule after the DMZ rule would break upnp services (I've seen this in forum comment re OpenWRT) so I've opted to Insert the new rule. Only issue I see is that upnp diversions would take precedence over any other port fowards - but if upnp is enable users would expect it to work (and accept the security concerns?).

you can use --insert (-I) or --replace (-R) instead of --append (-A) as command to iptables to be able to set the right rule at the right place.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.