From: Tim Yardley Date: Sun, 26 Nov 2006 23:44:09 +0000 (+0000) Subject: miniupnpd ported to kamikaze from xwrts whiterussian package X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=53a037105e5d792a821ed99bd9fd7bfb87758832;p=openwrt%2Fsvn-archive%2Fpackages.git miniupnpd ported to kamikaze from xwrts whiterussian package SVN-Revision: 5653 --- diff --git a/net/miniupnpd/Makefile b/net/miniupnpd/Makefile new file mode 100644 index 000000000..da0a8f489 --- /dev/null +++ b/net/miniupnpd/Makefile @@ -0,0 +1,46 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=miniupnpd +PKG_VERSION:=0.1 +PKG_RELEASE:=2 +PKG_MD5SUM:=4ba2a49c593d0c1088cc5791b8c6a985 + +PKG_SOURCE_URL:=http://ftp.berlios.de/pub/xwrt/storage/ +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/miniupnpd + SECTION:=net + CATEGORY:=Network + DEPENDS:=+iptables + TITLE:=Lightweight UPnP daemon + DESCRIPTION:=\ + Lightweight UPnP daemon + URL:=http://miniupnp.tuxfamily.org/ +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.openwrt +endef + +define Build/Clean + # remove the client dir since the build system doesnt know about it + rm -rf $(PKG_BUILD_DIR)/../miniupnpc +endef + +define Package/miniupnpd/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux/*.sh $(1)/usr/bin/ + $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd + $(STRIP) $(1)/usr/bin/miniupnpd +endef + +$(eval $(call BuildPackage,miniupnpd)) diff --git a/net/miniupnpd/files/miniupnpd.init b/net/miniupnpd/files/miniupnpd.init new file mode 100644 index 000000000..4dd2df056 --- /dev/null +++ b/net/miniupnpd/files/miniupnpd.init @@ -0,0 +1,17 @@ +#!/bin/sh +upnpd_enabled=$(nvram get upnp_enabled) +if [ "$upnpd_enabled" = "1" ]; then + echo "miniupnpd starting ..." + iptables_flush.sh 2>&- >&- + killall miniupnpd 2>&- + iptables_removeall.sh 2>&- >&- + iptables_init.sh + upnpd_log=$(nvram get upnpd_log_output) + if [ "$upnpd_log" = "1" ]; then + miniupnpd -i $(nvram get wan_ifname) -a $(nvram get lan_ipaddr) -p 5000 -U -d | logger -t miniupnpd & + else + miniupnpd -i $(nvram get wan_ifname) -a $(nvram get lan_ipaddr) -p 5000 -U + fi +else + echo "miniupnpd service is disabled. Set nvram upnp_enabled to '1' to enable." +fi diff --git a/net/miniupnpd/patches/001-makefile-tweaks.patch b/net/miniupnpd/patches/001-makefile-tweaks.patch new file mode 100644 index 000000000..7b57a059e --- /dev/null +++ b/net/miniupnpd/patches/001-makefile-tweaks.patch @@ -0,0 +1,37 @@ +--- miniupnpd.orig/Makefile.openwrt 2006-11-23 06:31:06.000000000 -0600 ++++ miniupnpd/Makefile.openwrt 2006-11-26 17:16:20.000000000 -0600 +@@ -2,12 +2,13 @@ + # http://miniupnp.free.fr/ + # Author : Thomas Bernard + # for use with GNU Make +-#CFLAGS = -Wall -O -D_GNU_SOURCE -g +-CFLAGS = -Wall -Os -D_GNU_SOURCE +-CC = mipsel-linux-gcc ++include $(TOPDIR)/rules.mk ++CC = $(TARGET_CC) ++CFLAGS = $(TARGET_CFLAGS) ++CFLAGS += -D_GNU_SOURCE + RM = rm -f + INSTALL = install +-IPTABLESINC=/home/nanard/code/openwrt/iptables-1.3.3/include ++IPTABLESINC=$(STAGING_DIR)/usr/include + + BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \ + ../miniupnpc/upnpreplyparse.o ../miniupnpc/minixml.o \ +@@ -15,7 +16,7 @@ + + LNXOBJS = linux/getifstats.o linux/iptcrdr.o + +-LIBS = /home/nanard/code/openwrt/iptables-1.3.3/libiptc/libiptc.a ++LIBS = $(STAGING_DIR)/usr/lib/libiptc.a + + TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o + +@@ -32,6 +33,7 @@ + @echo no install for now... + + miniupnpd: $(BASEOBJS) $(LNXOBJS) $(LIBS) ++ $(CC) $(CFLAGS) -o $@ $(BASEOBJS) $(LNXOBJS) $(LIBS) + + testupnpdescgen: $(TESTUPNPDESCGENOBJS) + diff --git a/net/miniupnpd/patches/100-iptables-wan-device-name.patch b/net/miniupnpd/patches/100-iptables-wan-device-name.patch new file mode 100644 index 000000000..b0a1b9831 --- /dev/null +++ b/net/miniupnpd/patches/100-iptables-wan-device-name.patch @@ -0,0 +1,26 @@ +diff -urN miniupnpd.orig/linux/iptables_init.sh miniupnpd/linux/iptables_init.sh +--- miniupnpd.orig/linux/iptables_init.sh 2006-11-23 07:56:34.000000000 -0500 ++++ miniupnpd/linux/iptables_init.sh 2006-11-24 18:57:43.000000000 -0500 +@@ -2,8 +2,7 @@ + # $Id: iptables_init.sh,v 1.3 2006/11/23 12:32:57 nanard Exp $ + IPTABLES=iptables + +-#change this parameters : +-EXTIF=eth0 ++EXTIF=$(nvram get wan_device) + EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`" + echo "External IP = $EXTIP" + +diff -urN miniupnpd.orig/linux/iptables_removeall.sh miniupnpd/linux/iptables_removeall.sh +--- miniupnpd.orig/linux/iptables_removeall.sh 2006-11-23 07:56:34.000000000 -0500 ++++ miniupnpd/linux/iptables_removeall.sh 2006-11-24 19:00:47.000000000 -0500 +@@ -2,8 +2,7 @@ + # $Id: iptables_removeall.sh,v 1.3 2006/11/23 12:32:57 nanard Exp $ + IPTABLES=iptables + +-#change this parameters : +-EXTIF=eth0 ++EXTIF=$(nvram get wan_device) + EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`" + + #removing the MINIUPNPD chain for nat