+++ /dev/null
-#
-# Copyright (C) 2006-2012 OpenWrt.org
-# Copyright (C) 2006 loswillios
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=linuxigd
-PKG_VERSION:=1.0
-PKG_RELEASE:=3
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=@SF/linux-igd
-PKG_MD5SUM:=929f5c4878c91d534613b7c7070215d9
-
-PKG_BUILD_DEPENDS:=iptables libupnp
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/linuxigd
- SECTION:=net
- CATEGORY:=Network
- TITLE:=UPnP daemon
- SUBMENU:=Firewall
- DEPENDS:=+libip4tc +libupnp +libpthread @BROKEN
- URL:=http://linux-igd.sourceforge.net/
-endef
-
-define Package/linuxigd/description
- It implements the UPnP Internet Gateway Device specification (IGD)
- and allows UPnP aware clients, such as MSN Messenger, Azureus or
- Miranda to work properly from behind a NAT firewall.
-
- Please edit /etc/upnpd.conf before using upnpd!
-endef
-
-define Build/Compile
- $(MAKE) -C $(PKG_BUILD_DIR) \
- $(TARGET_CONFIGURE_OPTS) \
- CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -DIPTABLES_143 -Wl,-rpath-link=$(STAGING_DIR)/usr/lib" \
- BINDIR="/usr/sbin" \
- MANDIR="/usr/man" \
- HAVE_LIBIPTC=1 \
- LIBIPTC_PREFIX="$(STAGING_DIR)/usr" \
- LIBUPNP_PREFIX="$(STAGING_DIR)/usr" \
- LIBS="-lpthread -lupnp -lixml -lthreadutil -lip4tc -L../lib" \
- all
-endef
-
-define Package/linuxigd/conffiles
-/etc/upnpd.conf
-endef
-
-define Package/linuxigd/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/upnpd $(1)/usr/sbin/
- $(INSTALL_DIR) $(1)/etc/linuxigd
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/*.gif $(1)/etc/linuxigd/
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/*.xml $(1)/etc/linuxigd/
- $(INSTALL_DIR) $(1)/etc
- $(INSTALL_DATA) ./files/upnpd.conf $(1)/etc/
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) ./files/upnpd.init $(1)/etc/init.d/upnpd
-endef
-
-$(eval $(call BuildPackage,linuxigd))
+++ /dev/null
-#
-# The full path and name of the iptables executable,
-# (enclosed in quotes).
-#
-iptables_location = "/usr/sbin/iptables"
-
-#
-# Daemon debug level. Messages are logged via syslog to debug.
-# 0 - no debug messages
-# 1 - log errors
-# 2 - log errors and basic info
-# 3 - log errors and verbose info
-# default = 0
-debug_mode = 2
-
-#
-# Should the daemon insert rules in the forward chain
-# This is necessary if your firewall has a drop or reject
-# policy in your forward chain.
-# allowed values: yes,no
-# default = no
-insert_forward_rules = yes
-
-#
-# The name of the chain to put the forward rules in.
-# This directive is only activ if "insert_forward_rules = yes"
-# above.
-# allowed values: a-z, A-Z, _, -
-# default = FORWARD
-forward_chain_name = forwarding_wan
-
-#
-# The name of the chain to put prerouting rules in.
-# allowed values: a-z, A-Z, _, -
-# default = PREROUTING
-prerouting_chain_name = prerouting_wan
-
-#
-# The internet line upstream bit rate reported from
-# the daemon. Value in bits per second
-# default = 0
-upstream_bitrate = 512000
-
-#
-# The internet line downstream bit rate reported from
-# the daemon. Value in bits per second
-# default = 0
-downstream_bitrate = 512000
-
-#
-# The default duration of port mappings, used when the client
-# doesn't specify a duration.
-# Can have the following values:
-# 0 - no default duration specified
-# seconds | HH:MM - duration from the time of addition
-# @seconds | @HH:MM - expire mapping at the specified time of day
-# default = 0
-duration = 0
-
-# The name of the igd device xml description document
-# default = gatedesc.xml
-description_document_name = gatedesc.xml
-
-# The path to the xml documents
-# Do not include the trailing "/"
-# default = /etc/linuxigd
-# WARNING! The make install does put the xml files
-# in /etc/linuxigd, if you change this variable
-# you have to make sure the xml docs are in the
-# right place
-xml_document_path = /etc/linuxigd
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2006-2012 OpenWrt.org
-# Copyright (C) 2006 loswillios
-
-START=65
-
-start() {
- . /lib/functions/network.sh
-
- network_get_device wan_if 'wan' || return 1
- network_get_device lan_if 'lan' || return 1
-
- route add -net 239.0.0.0 netmask 255.0.0.0 $lan_if
- service_start /usr/sbin/upnpd $wan_if $lan_if
-}
-
-stop() {
- . /lib/functions/network.sh
-
- service_stop /usr/sbin/upnpd
-
- network_get_device lan_if 'lan' && \
- route del -net 239.0.0.0 netmask 255.0.0.0 $lan_if
-}
+++ /dev/null
-diff -urN linuxigd-1.0/iptc.c linuxigd-1.0.new/iptc.c
---- linuxigd-1.0/iptc.c 2006-09-11 17:55:48.000000000 +0200
-+++ linuxigd-1.0.new/iptc.c 2007-06-02 12:24:34.000000000 +0200
-@@ -22,9 +22,9 @@
- struct ipt_entry_match *get_udp_match(const char *sports, const char *dports, unsigned int *nfcache);
- struct ipt_entry_target *get_dnat_target(const char *input, unsigned int *nfcache);
-
--static u_int16_t parse_port(const char *port);
--static void parse_ports(const char *portstring, u_int16_t *ports);
--static int service_to_port(const char *name);
-+static u_int16_t igd_parse_port(const char *port);
-+void parse_ports(const char *portstring, u_int16_t *ports);
-+static int igd_service_to_port(const char *name);
-
- static void parse_range(const char *input, struct ip_nat_range *range);
- static struct ipt_natinfo *append_range(struct ipt_natinfo *info, const struct ip_nat_range *range);
-@@ -336,13 +336,12 @@
- }
-
- /* Copied and modified from libipt_tcp.c and libipt_udp.c */
--
- static u_int16_t
--parse_port(const char *port)
-+igd_parse_port(const char *port)
- {
- unsigned int portnum;
-
-- if ((portnum = service_to_port(port)) != -1) {
-+ if ((portnum = igd_service_to_port(port)) != -1) {
- return (u_int16_t)portnum;
- }
- else {
-@@ -350,7 +349,7 @@
- }
- }
-
--static void
-+void
- parse_ports(const char *portstring, u_int16_t *ports)
- {
- char *buffer;
-@@ -358,19 +357,18 @@
-
- buffer = strdup(portstring);
- if ((cp = strchr(buffer, ':')) == NULL)
-- ports[0] = ports[1] = parse_port(buffer);
-+ ports[0] = ports[1] = igd_parse_port(buffer);
- else {
- *cp = '\0';
- cp++;
-
-- ports[0] = buffer[0] ? parse_port(buffer) : 0;
-- ports[1] = cp[0] ? parse_port(cp) : 0xFFFF;
-+ ports[0] = buffer[0] ? igd_parse_port(buffer) : 0;
-+ ports[1] = cp[0] ? igd_parse_port(cp) : 0xFFFF;
- }
- free(buffer);
- }
--
- static int
--service_to_port(const char *name)
-+igd_service_to_port(const char *name)
- {
- struct servent *service;
-
-@@ -382,7 +380,6 @@
-
-
-
--
- /* Copied and modified from libipt_DNAT.c */
-
- static void
+++ /dev/null
-diff -urN linuxigd-1.0/iptc.c linuxigd-1.0.new/iptc.c
---- linuxigd-1.0/iptc.c 2006-09-11 17:55:48.000000000 +0200
-+++ linuxigd-1.0.new/iptc.c 2007-07-13 14:50:23.000000000 +0200
-@@ -6,7 +6,12 @@
- #include <string.h>
- #include <iptables.h>
- #include <libiptc/libiptc.h>
-+#include <linux/version.h>
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-+#include <linux/netfilter/nf_nat.h>
-+#else
- #include <linux/netfilter_ipv4/ip_nat.h>
-+#endif
- #include <arpa/inet.h> /* inet_addr */
- #include "globals.h"
- #include "util.h"
+++ /dev/null
-Index: linuxigd-1.0/Makefile
-===================================================================
---- linuxigd-1.0.orig/Makefile 2008-02-27 10:45:26.000000000 +0100
-+++ linuxigd-1.0/Makefile 2008-02-27 10:45:54.000000000 +0100
-@@ -27,7 +27,7 @@
- @echo "make $@ finished on `date`"
-
- %.o: %.c
-- $(CC) $(CFLAGS) $(INCLUDES) -c $<
-+ $(CC) $(CFLAGS) $(INCLUDES) -D_GNU_SOURCE -c $<
-
- clean:
- rm -f *.o upnpd
+++ /dev/null
-diff -ur linuxigd-1.0.orig/iptc.c linuxigd-1.0/iptc.c
---- linuxigd-1.0.orig/iptc.c 2009-05-05 14:01:59.000000000 +0200
-+++ linuxigd-1.0/iptc.c 2009-05-05 14:05:48.000000000 +0200
-@@ -7,16 +7,24 @@
- #include <iptables.h>
- #include <libiptc/libiptc.h>
- #include <linux/version.h>
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
--#include <linux/netfilter/nf_nat.h>
-+#ifdef IPTABLES_143
-+# include <net/netfilter/nf_nat.h>
-+# define ip_nat_multi_range nf_nat_multi_range_compat
-+# define ip_nat_range nf_nat_range
- #else
--#include <linux/netfilter_ipv4/ip_nat.h>
-+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-+# include <linux/netfilter/nf_nat.h>
-+# else
-+# include <linux/netfilter_ipv4/ip_nat.h>
-+# endif
- #endif
- #include <arpa/inet.h> /* inet_addr */
- #include "globals.h"
- #include "util.h"
- #include "iptc.h"
-
-+#define IPTC_HANDLE struct iptc_handle *
-+
- struct ipt_natinfo
- {
- struct ipt_entry_target t;
-@@ -49,7 +57,7 @@
- const char *dnat_to,
- const int append)
- {
-- iptc_handle_t handle;
-+ IPTC_HANDLE handle;
- struct ipt_entry *chain_entry;
- struct ipt_entry_match *entry_match = NULL;
- struct ipt_entry_target *entry_target = NULL;
-@@ -126,15 +134,15 @@
- return;
- }
- if (append)
-- result = iptc_append_entry(labelit, chain_entry, &handle);
-+ result = iptc_append_entry(labelit, chain_entry, handle);
- else
-- result = iptc_insert_entry(labelit, chain_entry, 0, &handle);
-+ result = iptc_insert_entry(labelit, chain_entry, 0, handle);
-
- if (!result) {
- trace(1, "libiptc error: Can't add, %s", iptc_strerror(errno));
- return;
- }
-- result = iptc_commit(&handle);
-+ result = iptc_commit(handle);
- if (!result) {
- trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
- return;
-@@ -159,7 +167,7 @@
- const char *target,
- const char *dnat_to)
- {
-- iptc_handle_t handle;
-+ IPTC_HANDLE handle;
- const struct ipt_entry *e;
- ipt_chainlabel labelit;
- int i, result;
-@@ -182,7 +190,7 @@
- }
-
- /* check through rules to find match */
-- for (e = iptc_first_rule(chain, &handle), i=0; e; e = iptc_next_rule(e, &handle), i++) {
-+ for (e = iptc_first_rule(chain, handle), i=0; e; e = iptc_next_rule(e, handle), i++) {
- if (s_src != INADDR_NONE && e->ip.src.s_addr != s_src) continue;
- if (s_dest != INADDR_NONE && e->ip.dst.s_addr != s_dest) continue;
- if (iniface && strcmp(e->ip.iniface, iniface) != 0) continue;
-@@ -190,7 +198,7 @@
- if (protocol && strcmp(protocol, "TCP") == 0 && e->ip.proto != IPPROTO_TCP) continue;
- if (protocol && strcmp(protocol, "UDP") == 0 && e->ip.proto != IPPROTO_UDP) continue;
- if ((srcports || destports) && IPT_MATCH_ITERATE(e, matchcmp, srcports, destports) == 0) continue;
-- if (target && strcmp(target, iptc_get_target(e, &handle)) != 0) continue;
-+ if (target && strcmp(target, iptc_get_target(e, handle)) != 0) continue;
- if (dnat_to && strcmp(target, "DNAT") == 0) {
- struct ipt_entry_target *t;
- struct ip_nat_multi_range *mr;
-@@ -214,12 +222,12 @@
- break;
- }
- if (!e) return;
-- result = iptc_delete_num_entry(chain, i, &handle);
-+ result = iptc_delete_num_entry(chain, i, handle);
- if (!result) {
- trace(1, "libiptc error: Delete error, %s", iptc_strerror(errno));
- return;
- }
-- result = iptc_commit(&handle);
-+ result = iptc_commit(handle);
- if (!result) {
- trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
- return;
+++ /dev/null
---- a/gatedevice.c
-+++ b/gatedevice.c
-@@ -1,5 +1,6 @@
- #include <syslog.h>
- #include <stdlib.h>
-+#include <stdio.h>
- #include <upnp/ixml.h>
- #include <string.h>
- #include <time.h>
---- a/main.c
-+++ b/main.c
-@@ -10,6 +10,7 @@
- #include <time.h>
- #include <net/if.h>
- #include <upnp/upnp.h>
-+#include <string.h>
- #include "globals.h"
- #include "config.h"
- #include "gatedevice.h"
---- a/pmlist.c
-+++ b/pmlist.c
-@@ -2,6 +2,8 @@
- #include <sys/wait.h>
- #include <unistd.h>
- #include <upnp/upnp.h>
-+#include <stdio.h>
-+#include <string.h>
- #include "globals.h"
- #include "config.h"
- #include "pmlist.h"