--- a/Makefile.openwrt +++ /dev/null @@ -1,95 +0,0 @@ -# $Id: Makefile.openwrt,v 1.12 2008/05/01 23:11:18 nanard Exp $ -# http://miniupnp.free.fr/ -# Author : Thomas Bernard -# for use with GNU Make -# This Makefile would probably need some modifications depending on -# your openwrt SDK/etc... -# http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=713 - -#include $(TOPDIR)/rules.mk -#CFLAGS = -Wall -O -D_GNU_SOURCE -g -#CFLAGS = -Wall -Os -D_GNU_SOURCE -#CC = mipsel-linux-gcc -CC = $(TARGET_CC) -CFLAGS = $(TARGET_CFLAGS) -CFLAGS += -D_GNU_SOURCE -CP = cp -RM = rm -f -INSTALL = install -IPTABLESINC=$(STAGING_DIR)/usr/include -#IPTABLESINC=$(BUILD_DIR)/iptables-1.3.3/include -#IPTABLESINC=$(TOPDIR)/../iptables-1.3.3/include - -BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \ - upnpreplyparse.o minixml.o \ - upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \ - options.o upnppermissions.o minissdp.o natpmp.o - -LNXOBJS = linux/getifstats.o -NETFILTEROBJS = netfilter/iptcrdr.o -ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) - -#LIBS = $(BUILD_DIR)/iptables-1.3.3/libiptc/libiptc.a -#LIBS = $(TOPDIR)/../iptables-1.3.3/libiptc/libiptc.a - -TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o - -EXECUTABLES = miniupnpd testupnpdescgen - -.PHONY: all clean install depend - -all: $(EXECUTABLES) - -clean: - $(RM) $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(EXECUTABLES) \ - testupnpdescgen.o - -install: miniupnpd - @echo no install for now... - -miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS) - -testupnpdescgen: $(TESTUPNPDESCGENOBJS) - -netfilter/iptcrdr.o: netfilter/iptcrdr.c - $(CC) $(CFLAGS) -I$(IPTABLESINC) -c -o $@ $< - -depend: config.h - makedepend -f$(MAKEFILE_LIST) -Y \ - $(ALLOBJS:.o=.c) $(TESTUPNPDESCGENOBJS:.o=.c) \ - 2>/dev/null - -config.h: genconfig.sh - ./genconfig.sh - -# DO NOT DELETE - -miniupnpd.o: config.h upnpglobalvars.h upnppermissions.h miniupnpdtypes.h -miniupnpd.o: upnphttp.h upnpdescgen.h miniupnpdpath.h getifaddr.h daemonize.h -miniupnpd.o: upnpsoap.h options.h minissdp.h upnpredirect.h natpmp.h -upnphttp.o: upnphttp.h config.h upnpdescgen.h miniupnpdpath.h upnpsoap.h -upnpdescgen.o: upnpdescgen.h miniupnpdpath.h upnpglobalvars.h -upnpdescgen.o: upnppermissions.h config.h miniupnpdtypes.h upnpdescstrings.h -upnpsoap.o: upnpglobalvars.h upnppermissions.h config.h miniupnpdtypes.h -upnpsoap.o: upnphttp.h upnpsoap.h upnpreplyparse.h upnpredirect.h getifaddr.h -upnpsoap.o: getifstats.h -upnpreplyparse.o: upnpreplyparse.h minixml.h -minixml.o: minixml.h -upnpredirect.o: config.h upnpredirect.h upnpglobalvars.h upnppermissions.h -upnpredirect.o: miniupnpdtypes.h netfilter/iptcrdr.h commonrdr.h -getifaddr.o: getifaddr.h -daemonize.o: daemonize.h -upnpglobalvars.o: upnpglobalvars.h upnppermissions.h config.h -upnpglobalvars.o: miniupnpdtypes.h -options.o: options.h upnppermissions.h config.h upnpglobalvars.h -options.o: miniupnpdtypes.h -upnppermissions.o: config.h upnppermissions.h -minissdp.o: config.h upnpdescstrings.h miniupnpdpath.h upnphttp.h -minissdp.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h minissdp.h -natpmp.o: config.h natpmp.h upnpglobalvars.h upnppermissions.h -natpmp.o: miniupnpdtypes.h getifaddr.h upnpredirect.h commonrdr.h -linux/getifstats.o: getifstats.h config.h -netfilter/iptcrdr.o: netfilter/iptcrdr.h commonrdr.h config.h -testupnpdescgen.o: upnpdescgen.h -upnpdescgen.o: upnpdescgen.h miniupnpdpath.h upnpglobalvars.h -upnpdescgen.o: upnppermissions.h config.h miniupnpdtypes.h upnpdescstrings.h --- /dev/null +++ b/Makefile.openwrt.old @@ -0,0 +1,95 @@ +# $Id: Makefile.openwrt,v 1.12 2008/05/01 23:11:18 nanard Exp $ +# http://miniupnp.free.fr/ +# Author : Thomas Bernard +# for use with GNU Make +# This Makefile would probably need some modifications depending on +# your openwrt SDK/etc... +# http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=713 + +#include $(TOPDIR)/rules.mk +#CFLAGS = -Wall -O -D_GNU_SOURCE -g +#CFLAGS = -Wall -Os -D_GNU_SOURCE +#CC = mipsel-linux-gcc +CC = $(TARGET_CC) +CFLAGS = $(TARGET_CFLAGS) +CFLAGS += -D_GNU_SOURCE +CP = cp +RM = rm -f +INSTALL = install +IPTABLESINC=$(STAGING_DIR)/usr/include +#IPTABLESINC=$(BUILD_DIR)/iptables-1.3.3/include +#IPTABLESINC=$(TOPDIR)/../iptables-1.3.3/include + +BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \ + upnpreplyparse.o minixml.o \ + upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o \ + options.o upnppermissions.o minissdp.o natpmp.o + +LNXOBJS = linux/getifstats.o +NETFILTEROBJS = netfilter/iptcrdr.o +ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) + +#LIBS = $(BUILD_DIR)/iptables-1.3.3/libiptc/libiptc.a +#LIBS = $(TOPDIR)/../iptables-1.3.3/libiptc/libiptc.a + +TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o + +EXECUTABLES = miniupnpd testupnpdescgen + +.PHONY: all clean install depend + +all: $(EXECUTABLES) + +clean: + $(RM) $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(EXECUTABLES) \ + testupnpdescgen.o + +install: miniupnpd + @echo no install for now... + +miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS) + +testupnpdescgen: $(TESTUPNPDESCGENOBJS) + +netfilter/iptcrdr.o: netfilter/iptcrdr.c + $(CC) $(CFLAGS) -I$(IPTABLESINC) -c -o $@ $< + +depend: config.h + makedepend -f$(MAKEFILE_LIST) -Y \ + $(ALLOBJS:.o=.c) $(TESTUPNPDESCGENOBJS:.o=.c) \ + 2>/dev/null + +config.h: genconfig.sh + ./genconfig.sh + +# DO NOT DELETE + +miniupnpd.o: config.h upnpglobalvars.h upnppermissions.h miniupnpdtypes.h +miniupnpd.o: upnphttp.h upnpdescgen.h miniupnpdpath.h getifaddr.h daemonize.h +miniupnpd.o: upnpsoap.h options.h minissdp.h upnpredirect.h natpmp.h +upnphttp.o: upnphttp.h config.h upnpdescgen.h miniupnpdpath.h upnpsoap.h +upnpdescgen.o: upnpdescgen.h miniupnpdpath.h upnpglobalvars.h +upnpdescgen.o: upnppermissions.h config.h miniupnpdtypes.h upnpdescstrings.h +upnpsoap.o: upnpglobalvars.h upnppermissions.h config.h miniupnpdtypes.h +upnpsoap.o: upnphttp.h upnpsoap.h upnpreplyparse.h upnpredirect.h getifaddr.h +upnpsoap.o: getifstats.h +upnpreplyparse.o: upnpreplyparse.h minixml.h +minixml.o: minixml.h +upnpredirect.o: config.h upnpredirect.h upnpglobalvars.h upnppermissions.h +upnpredirect.o: miniupnpdtypes.h netfilter/iptcrdr.h commonrdr.h +getifaddr.o: getifaddr.h +daemonize.o: daemonize.h +upnpglobalvars.o: upnpglobalvars.h upnppermissions.h config.h +upnpglobalvars.o: miniupnpdtypes.h +options.o: options.h upnppermissions.h config.h upnpglobalvars.h +options.o: miniupnpdtypes.h +upnppermissions.o: config.h upnppermissions.h +minissdp.o: config.h upnpdescstrings.h miniupnpdpath.h upnphttp.h +minissdp.o: upnpglobalvars.h upnppermissions.h miniupnpdtypes.h minissdp.h +natpmp.o: config.h natpmp.h upnpglobalvars.h upnppermissions.h +natpmp.o: miniupnpdtypes.h getifaddr.h upnpredirect.h commonrdr.h +linux/getifstats.o: getifstats.h config.h +netfilter/iptcrdr.o: netfilter/iptcrdr.h commonrdr.h config.h +testupnpdescgen.o: upnpdescgen.h +upnpdescgen.o: upnpdescgen.h miniupnpdpath.h upnpglobalvars.h +upnpdescgen.o: upnppermissions.h config.h miniupnpdtypes.h upnpdescstrings.h --- a/Makefile.linux +++ b/Makefile.linux @@ -17,11 +17,12 @@ # $ IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux # #CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG -CFLAGS = -Wall -Os -D_GNU_SOURCE -CC = gcc +CFLAGS ?= -Wall -Os -D_GNU_SOURCE +CC ?= gcc RM = rm -f INSTALL = install -STRIP = strip +STRIP ?= strip +CP = cp INSTALLPREFIX ?= $(PREFIX)/usr SBININSTALLDIR = $(INSTALLPREFIX)/sbin @@ -38,16 +39,17 @@ NETFILTEROBJS = netfilter/iptcrdr.o ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) -LIBS = -liptc +LIBS ?= -liptc # the following is better, at least on gentoo with iptables 1.4.6 # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=1618 #LIBS = -lip4tc -ARCH := $(shell uname -m | grep -q "x86_64" && echo 64) +ARCH ?= $(shell uname -m | grep -q "x86_64" && echo 64) ifdef IPTABLESPATH CFLAGS := $(CFLAGS) -I$(IPTABLESPATH)/include/ LDFLAGS := $(LDFLAFGS) -L$(IPTABLESPATH)/libiptc/ # get iptables version and set IPTABLES_143 macro if needed +ifeq ($(TARGET_OPENWRT),) IPTABLESVERSION := $(shell grep "\#define VERSION" $(IPTABLESPATH)/config.h | tr -d \" |cut -d" " -f3 ) IPTABLESVERSION1 := $(shell echo $(IPTABLESVERSION) | cut -d. -f1 ) IPTABLESVERSION2 := $(shell echo $(IPTABLESVERSION) | cut -d. -f2 ) @@ -74,6 +76,7 @@ LIBS = -liptc /usr/lib$(ARCH)/libiptc.a endif endif endif +endif TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o @@ -105,7 +108,11 @@ install: miniupnpd genuuid # genuuid is using the uuidgen CLI tool which is part of libuuid # from the e2fsprogs genuuid: +ifeq ($(TARGET_OPENWRT),) sed -i -e "s/^uuid=[-0-9a-f]*/uuid=`(genuuid||uuidgen) 2>/dev/null`/" miniupnpd.conf +else + sed -i -e "s/^uuid=[-0-9a-f]*/uuid=`($(STAGING_DIR_HOST)/bin/genuuid||$(STAGING_DIR_HOST)/bin/uuidgen) 2>/dev/null`/" miniupnpd.conf +endif miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS) --- a/README.openwrt +++ /dev/null @@ -1,76 +0,0 @@ -MiniUPnP Daemon -(c) 2006 Thomas Bernard -This software is subject to the conditions detailed in -the LICENCE file provided within the distribution. - -How to build and run miniupnpd for your router running openwrt. -These instructions apply to the OpenWRT WHITE RUSSIAN (RC6) version. -My device is a Linksys WRT54G v1, used in pppoe mode. -More information about OpenWRT on http://openwrt.org/ - -First make sure that openwrt white russian RC6 is up and running on your -router device. - -NOTES : Makefile.openwrt has been updated, following informations could - be inacurate. - The X-Wrt team made an ipk package out of miniupnpd, - check the webpage : http://www.x-wrt.org/ - -* A. COMPILATION * - -To Build, use your PC. I have been using the SDK but you might need -to compile the cross compiler yourself. - -1. Get the SDK from http://downloads.openwrt.org/whiterussian/rc6/ - I used http://downloads.openwrt.org/whiterussian/rc6/OpenWrt-SDK-Linux-ppc-1.tar.bz2 - unpack somewhere and add the bin directory to your PATH environement : - > tar xvjf OpenWrt-SDK-Linux-i686-1.tar.bz2 - > PATH=`pwd`/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin:$PATH - > mipsel-linux-gcc --version -mipsel-linux-gcc (GCC) 3.4.4 (OpenWrt-1.0) -[...] - -2. Get iptables 1.3.3 sources from http://downloads.openwrt.org/sources/iptables-1.3.3.tar.bz2 - unpack and compile libiptc.a - > tar xvjf iptables-1.3.3.tar.bz2 - > cd iptables-1.3.3/libiptc/ - > make CC=mipsel-linux-gcc - -3. Go to miniupnpd directory and edit the Makefile.openwrt to make - IPTABLESINC and LIBS variables point to the correct directory. - > make -f Makefile.openwrt - > mipsel-linux-strip miniupnpd - -That's it ! - - -* B. INSTALLATION - USAGE * - -1. copy miniupnpd and scripts to the device : - > scp miniupnpd root@192.168.1.1:. - > cd linux - > scp iptables_init.sh iptables_flush.sh root@192.168.1.1:. - > scp iptables_display.sh iptables_removall.sh root@192.168.1.1:. - -2. log onto your router and edit the scripts in order to adapt to your - configuration : EXTIF variable shoud be set to your external network - interface. In my case it is ppp0 - -3. init tables : - > ./iptables_init.sh - -4. run the daemon : - ./miniupnpd -i ppp0 -a 192.168.1.1 -p 5000 -U -d - -d option is a debug option to prevent the program from going to - background. It is usefull to see the debug messages and check if everything - is ok. - -5. Once you checked that everything is ok, - you can set up a script in /etc/init.d etc... - - If you can build an ipkg package for miniupnpd, I'll be glad ! - -Thomas -contact me by email : miniupnp@free.fr - - --- /dev/null +++ b/README.openwrt.old @@ -0,0 +1,76 @@ +MiniUPnP Daemon +(c) 2006 Thomas Bernard +This software is subject to the conditions detailed in +the LICENCE file provided within the distribution. + +How to build and run miniupnpd for your router running openwrt. +These instructions apply to the OpenWRT WHITE RUSSIAN (RC6) version. +My device is a Linksys WRT54G v1, used in pppoe mode. +More information about OpenWRT on http://openwrt.org/ + +First make sure that openwrt white russian RC6 is up and running on your +router device. + +NOTES : Makefile.openwrt has been updated, following informations could + be inacurate. + The X-Wrt team made an ipk package out of miniupnpd, + check the webpage : http://www.x-wrt.org/ + +* A. COMPILATION * + +To Build, use your PC. I have been using the SDK but you might need +to compile the cross compiler yourself. + +1. Get the SDK from http://downloads.openwrt.org/whiterussian/rc6/ + I used http://downloads.openwrt.org/whiterussian/rc6/OpenWrt-SDK-Linux-ppc-1.tar.bz2 + unpack somewhere and add the bin directory to your PATH environement : + > tar xvjf OpenWrt-SDK-Linux-i686-1.tar.bz2 + > PATH=`pwd`/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin:$PATH + > mipsel-linux-gcc --version +mipsel-linux-gcc (GCC) 3.4.4 (OpenWrt-1.0) +[...] + +2. Get iptables 1.3.3 sources from http://downloads.openwrt.org/sources/iptables-1.3.3.tar.bz2 + unpack and compile libiptc.a + > tar xvjf iptables-1.3.3.tar.bz2 + > cd iptables-1.3.3/libiptc/ + > make CC=mipsel-linux-gcc + +3. Go to miniupnpd directory and edit the Makefile.openwrt to make + IPTABLESINC and LIBS variables point to the correct directory. + > make -f Makefile.openwrt + > mipsel-linux-strip miniupnpd + +That's it ! + + +* B. INSTALLATION - USAGE * + +1. copy miniupnpd and scripts to the device : + > scp miniupnpd root@192.168.1.1:. + > cd linux + > scp iptables_init.sh iptables_flush.sh root@192.168.1.1:. + > scp iptables_display.sh iptables_removall.sh root@192.168.1.1:. + +2. log onto your router and edit the scripts in order to adapt to your + configuration : EXTIF variable shoud be set to your external network + interface. In my case it is ppp0 + +3. init tables : + > ./iptables_init.sh + +4. run the daemon : + ./miniupnpd -i ppp0 -a 192.168.1.1 -p 5000 -U -d + -d option is a debug option to prevent the program from going to + background. It is usefull to see the debug messages and check if everything + is ok. + +5. Once you checked that everything is ok, + you can set up a script in /etc/init.d etc... + + If you can build an ipkg package for miniupnpd, I'll be glad ! + +Thomas +contact me by email : miniupnp@free.fr + +