summaryrefslogtreecommitdiffstats
path: root/net/linuxigd
diff options
context:
space:
mode:
authorleeym <leeym@FreeBSD.org>2007-06-16 12:49:58 +0000
committerleeym <leeym@FreeBSD.org>2007-06-16 12:49:58 +0000
commit2ee5b3026d3329df3ccb898e62a71fc20472000c (patch)
tree115a8ecdaa52559db2ee02c4a63e1549aeeea2c6 /net/linuxigd
parent4fa93d0e25e4f1a5f807a175343f0a33808a0364 (diff)
downloadFreeBSD-ports-2ee5b3026d3329df3ccb898e62a71fc20472000c.zip
FreeBSD-ports-2ee5b3026d3329df3ccb898e62a71fc20472000c.tar.gz
- update to 1.0
- drop maintainership Note: I myself no longer use linuxigd, and I don't have environment to test it. Now it builds and runs, but not sure if it works. Please test it by yourself.
Diffstat (limited to 'net/linuxigd')
-rw-r--r--net/linuxigd/Makefile21
-rw-r--r--net/linuxigd/distinfo6
-rw-r--r--net/linuxigd/files/linuxigd.in28
-rw-r--r--net/linuxigd/files/linuxigd.sh.sample25
-rw-r--r--net/linuxigd/files/patch-Makefile72
-rw-r--r--net/linuxigd/files/patch-config.c133
-rw-r--r--net/linuxigd/files/patch-etc__upnpd.conf58
-rw-r--r--net/linuxigd/files/patch-gateway.cpp18
-rw-r--r--net/linuxigd/files/patch-gateway.h11
-rw-r--r--net/linuxigd/files/patch-globals.h49
-rw-r--r--net/linuxigd/files/patch-main.c56
-rw-r--r--net/linuxigd/files/patch-pmlist.c142
-rw-r--r--net/linuxigd/files/patch-pmlist.cpp49
-rw-r--r--net/linuxigd/files/patch-util.c (renamed from net/linuxigd/files/patch-ipcon.cpp)10
-rw-r--r--net/linuxigd/pkg-plist7
15 files changed, 531 insertions, 154 deletions
diff --git a/net/linuxigd/Makefile b/net/linuxigd/Makefile
index 163f7f0..09d5679 100644
--- a/net/linuxigd/Makefile
+++ b/net/linuxigd/Makefile
@@ -6,27 +6,26 @@
#
PORTNAME= linuxigd
-PORTVERSION= 0.92
-PORTREVISION= 2
+PORTVERSION= 1.0
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= linux-igd
-EXTRACT_SUFX= .tgz
-MAINTAINER= leeym@FreeBSD.org
+MAINTAINER= ports@FreeBSD.org
COMMENT= Linux UPnP Internet Gateway Device
-LIB_DEPENDS= upnp.1:${PORTSDIR}/devel/upnp104
+LIB_DEPENDS= upnp.2:${PORTSDIR}/devel/upnp
+USE_RC_SUBR= linuxigd
USE_GMAKE= yes
-WRKSRC= ${WRKDIR}/linux-igd
MAKE_ENV= PTHREAD_LIBS=${PTHREAD_LIBS}
-post-patch:
- @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' ${WRKSRC}/gateway.h
+MAN8= upnpd.8
+
+post-extract:
+ @${RM} ${WRKSRC}/iptc.?
-post-install:
- @${MKDIR} ${PREFIX}/etc/rc.d
- @${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.sh.sample ${PREFIX}/etc/rc.d
+post-patch:
+ @${FIND} ${WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g"
.include <bsd.port.mk>
diff --git a/net/linuxigd/distinfo b/net/linuxigd/distinfo
index f4cee5e..a2c5810 100644
--- a/net/linuxigd/distinfo
+++ b/net/linuxigd/distinfo
@@ -1,3 +1,3 @@
-MD5 (linuxigd-0.92.tgz) = dcda2e1daf524927b1be91f06bc6a3af
-SHA256 (linuxigd-0.92.tgz) = 22fe36b4e8ba16c941c19a7f923a563ca7d11f1a9bbc55f63392eee09f2438e7
-SIZE (linuxigd-0.92.tgz) = 29519
+MD5 (linuxigd-1.0.tar.gz) = 929f5c4878c91d534613b7c7070215d9
+SHA256 (linuxigd-1.0.tar.gz) = f6335273fd6bfad7fb32e94e36461e8b74f9523e7994bad8be9fac29bee9f4cd
+SIZE (linuxigd-1.0.tar.gz) = 35396
diff --git a/net/linuxigd/files/linuxigd.in b/net/linuxigd/files/linuxigd.in
new file mode 100644
index 0000000..4715ecf
--- /dev/null
+++ b/net/linuxigd/files/linuxigd.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# PROVIDE: linuxigd
+# REQUIRE: NETWORKING SERVERS
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable linuxigd:
+#
+# linuxigd_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=linuxigd
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+command=%%PREFIX%%/sbin/upnpd
+required_files="%%PREFIX%%/etc/linuxigd/gatedesc.xml %%PREFIX%%/etc/upnpd.conf"
+
+: ${linuxigd_enable="NO"}
+: ${linuxigd_extif="fxp0"}
+: ${linuxigd_intif="fxp1"}
+: ${command_args="${linuxigd_extif} ${linuxigd_intif}"}
+
+run_rc_command "$1"
diff --git a/net/linuxigd/files/linuxigd.sh.sample b/net/linuxigd/files/linuxigd.sh.sample
deleted file mode 100644
index 280bb66..0000000
--- a/net/linuxigd/files/linuxigd.sh.sample
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-EXT_IF=fxp0 # external interface
-INT_IF=fxp1 # internal interface
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
- echo "$0: Cannot determine the PREFIX" >&2
- exit 1
-fi
-
-case "$1" in
-start)
- if [ -x ${PREFIX}/bin/upnpd ]; then
- ${PREFIX}/bin/upnpd ${EXT_IF} ${INT_IF} && echo -n ' upnpd'
- fi
- ;;
-stop)
- killall upnpd && echo -n ' upnpd'
- ;;
-*)
- echo "Usage: `basename $0` {start|stop}" >&2
- ;;
-esac
-
-exit 0
diff --git a/net/linuxigd/files/patch-Makefile b/net/linuxigd/files/patch-Makefile
index 22a6a43..63ac998 100644
--- a/net/linuxigd/files/patch-Makefile
+++ b/net/linuxigd/files/patch-Makefile
@@ -1,34 +1,50 @@
---- Makefile.orig Sat Dec 14 06:16:22 2002
-+++ Makefile Mon Apr 2 14:54:39 2007
-@@ -1,6 +1,5 @@
--CC=g++
--INCLUDES= -I/usr/include/upnp
--LIBS= -lpthread /usr/lib/libupnp.so
-+INCLUDES= -I$(LOCALBASE)/include
-+LIBS= $(PTHREAD_LIBS) $(LOCALBASE)/lib/libupnp.so
+--- Makefile.orig Wed May 24 06:16:36 2006
++++ Makefile Sat Jun 16 18:59:19 2007
+@@ -1,25 +1,11 @@
+-PREFIX=/usr
+-LIBUPNP_PREFIX=/usr
+-#LIBIPTC_PREFIX=/usr
++LIBUPNP_PREFIX=$(LOCALBASE)
+-CC=gcc
+ INCLUDES= -I$(LIBUPNP_PREFIX)/include -I../include
+-LIBS= -lpthread -lupnp -lixml -lthreadutil -L$(LIBUPNP_PREFIX)/lib -L../libs
++LIBS= $(PTHREAD_LIBS) -lupnp -lixml -lthreadutil -L$(LIBUPNP_PREFIX)/lib -L../libs
+ FILES= main.o gatedevice.o pmlist.o util.o config.o
- ifeq ($(DEBUG),1)
-@@ -16,17 +15,17 @@
- all: $(APPS)
+ CFLAGS += -Wall -g -O2
- upnpd: gate.o gateway.o sample_util.o ipcon.o portmap.o pmlist.o
-- $(CC) $(CFLAGS) gate.o gateway.o sample_util.o ipcon.o portmap.o pmlist.o $(LIBS) -o $@
-+ $(CXX) $(CFLAGS) gate.o gateway.o sample_util.o ipcon.o portmap.o pmlist.o $(LIBS) -o $@
- @echo "make $@ finished on `date`"
+-ifdef HAVE_LIBIPTC
+-ifdef LIBIPTC_PREFIX
+-LIBS += -L$(LIBIPTC_PREFIX)/lib
+-INCLUDES += -I$(LIBIPTC_PREFIX)/include
+-endif
+-
+-LIBS += -liptc
+-INCLUDES += -DHAVE_LIBIPTC
+-FILES += iptc.o
+-endif
+-
+ all: upnpd
- %.o: %.cpp
-- $(CC) $(CFLAGS) $(INCLUDES) -c $<
-+ $(CXX) $(CFLAGS) $(INCLUDES) -c $<
-
- clean:
- rm -f *.o $(APPS)
+ upnpd: $(FILES)
+@@ -33,11 +19,11 @@
+ rm -f *.o upnpd
install: upnpd
-- @install -d /etc/linuxigd
-- @install etc/* /etc/linuxigd
-- @install upnpd /usr/bin
-+ @install -d $(PREFIX)/etc/linuxigd
-+ @$(BSD_INSTALL_DATA) etc/* $(PREFIX)/etc/linuxigd
-+ @$(BSD_INSTALL_PROGRAM) upnpd $(PREFIX)/bin
-
+- install -d /etc/linuxigd
+- install etc/gatedesc.xml /etc/linuxigd
+- install etc/gateconnSCPD.xml /etc/linuxigd
+- install etc/gateicfgSCPD.xml /etc/linuxigd
+- install etc/dummy.xml /etc/linuxigd
+- install upnpd $(PREFIX)/sbin
+- install upnpd.8 $(PREFIX)/share/man/man8
+- if [ ! -f /etc/upnpd.conf ]; then install etc/upnpd.conf /etc; fi
++ install -d %%PREFIX%%/etc/linuxigd
++ $(BSD_INSTALL_DATA) etc/gatedesc.xml %%PREFIX%%/etc/linuxigd
++ $(BSD_INSTALL_DATA) etc/gateconnSCPD.xml %%PREFIX%%/etc/linuxigd
++ $(BSD_INSTALL_DATA) etc/gateicfgSCPD.xml %%PREFIX%%/etc/linuxigd
++ $(BSD_INSTALL_DATA) etc/dummy.xml %%PREFIX%%/etc/linuxigd
++ $(BSD_INSTALL_PROGRAM) upnpd $(PREFIX)/sbin
++ $(BSD_INSTALL_DATA) upnpd.8 $(PREFIX)/man/man8
++ if [ ! -f %%PREFIX%%/etc/upnpd.conf ]; then $(BSD_INSTALL_DATA) etc/upnpd.conf %%PREFIX%%/etc; fi
diff --git a/net/linuxigd/files/patch-config.c b/net/linuxigd/files/patch-config.c
new file mode 100644
index 0000000..a95bf31
--- /dev/null
+++ b/net/linuxigd/files/patch-config.c
@@ -0,0 +1,133 @@
+--- config.c.orig Sat Jun 16 20:37:40 2007
++++ config.c Sat Jun 16 20:39:05 2007
+@@ -43,6 +43,12 @@
+ return 0;
+ }
+
++size_t strnlen(const char *s, size_t maxlen)
++{
++ int len = strlen(s);
++ return (len < maxlen) ? len : maxlen;
++}
++
+ int parseConfigFile(globals_p vars)
+ {
+ FILE *conf_file;
+@@ -50,11 +56,8 @@
+
+ regex_t re_comment;
+ regex_t re_empty_row;
+- regex_t re_iptables_location;
++ regex_t re_ipnat_location;
+ regex_t re_debug_mode;
+- regex_t re_insert_forward_rules_yes;
+- regex_t re_forward_chain_name;
+- regex_t re_prerouting_chain_name;
+ regex_t re_upstream_bitrate;
+ regex_t re_downstream_bitrate;
+ regex_t re_duration;
+@@ -63,10 +66,7 @@
+
+ // Make sure all vars are 0 or \0 terminated
+ vars->debug = 0;
+- vars->forwardRules = 0;
+- strcpy(vars->iptables,"");
+- strcpy(vars->forwardChainName,"");
+- strcpy(vars->preroutingChainName,"");
++ strcpy(vars->ipnat,"");
+ strcpy(vars->upstreamBitrate,"");
+ strcpy(vars->downstreamBitrate,"");
+ vars->duration = DEFAULT_DURATION;
+@@ -78,14 +78,11 @@
+ regcomp(&re_empty_row,"^[[:blank:]]*\r?\n$",REG_EXTENDED);
+
+ // Regexps to match configuration file settings
+- regcomp(&re_iptables_location,"iptables_location[[:blank:]]*=[[:blank:]]*\"([^\"]+)\"",REG_EXTENDED);
++ regcomp(&re_ipnat_location,"ipnat_location[[:blank:]]*=[[:blank:]]*\"([^\"]+)\"",REG_EXTENDED);
+ regcomp(&re_debug_mode,"debug_mode[[:blank:]]*=[[:blank:]]*([[:digit:]])",REG_EXTENDED);
+- regcomp(&re_insert_forward_rules_yes,"insert_forward_rules[[:blank:]]*=[[:blank:]]*yes",REG_ICASE);
+- regcomp(&re_forward_chain_name,"forward_chain_name[[:blank:]]*=[[:blank:]]*([[:alpha:]_-]+)",REG_EXTENDED);
+- regcomp(&re_prerouting_chain_name,"prerouting_chain_name[[:blank:]]*=[[:blank:]]([[:alpha:]_-]+)",REG_EXTENDED);
+ regcomp(&re_upstream_bitrate,"upstream_bitrate[[:blank:]]*=[[:blank:]]*([[:digit:]]+)",REG_EXTENDED);
+ regcomp(&re_downstream_bitrate,"downstream_bitrate[[:blank:]]*=[[:blank:]]*([[:digit:]]+)",REG_EXTENDED);
+- regcomp(&re_duration,"duration[[:blank:]]*=[[:blank:]]*(@?)([[:digit:]]+|[[:digit:]]+{2}:[[:digit:]]+{2})",REG_EXTENDED);
++ regcomp(&re_duration,"duration[[:blank:]]*=[[:blank:]]*(@?)([[:digit:]]+|[[:digit:]]{2}:[[:digit:]]{2})",REG_EXTENDED);
+ regcomp(&re_desc_doc,"description_document_name[[:blank:]]*=[[:blank:]]*([[:alpha:].]{1,20})",REG_EXTENDED);
+ regcomp(&re_xml_path,"xml_document_path[[:blank:]]*=[[:blank:]]*([[:alpha:]_/.]{1,50})",REG_EXTENDED);
+
+@@ -99,21 +96,10 @@
+ if ( (0 != regexec(&re_comment,line,0,NULL,0) ) &&
+ (0 != regexec(&re_empty_row,line,0,NULL,0)) )
+ {
+- // Chec if iptables_location
+- if (regexec(&re_iptables_location,line,NMATCH,submatch,0) == 0)
+- {
+- getConfigOptionArgument(vars->iptables, PATH_LEN, line, submatch);
+- }
+-
+- // Check is insert_forward_rules
+- else if (regexec(&re_insert_forward_rules_yes,line,0,NULL,0) == 0)
+- {
+- vars->forwardRules = 1;
+- }
+- // Check forward_chain_name
+- else if (regexec(&re_forward_chain_name,line,NMATCH,submatch,0) == 0)
++ // Chec if ipnat_location
++ if (regexec(&re_ipnat_location,line,NMATCH,submatch,0) == 0)
+ {
+- getConfigOptionArgument(vars->forwardChainName, CHAIN_NAME_LEN, line, submatch);
++ getConfigOptionArgument(vars->ipnat, PATH_LEN, line, submatch);
+ }
+ else if (regexec(&re_debug_mode,line,NMATCH,submatch,0) == 0)
+ {
+@@ -121,10 +107,6 @@
+ getConfigOptionArgument(tmp,sizeof(tmp),line,submatch);
+ vars->debug = atoi(tmp);
+ }
+- else if (regexec(&re_prerouting_chain_name,line,NMATCH,submatch,0) == 0)
+- {
+- getConfigOptionArgument(vars->preroutingChainName, CHAIN_NAME_LEN, line, submatch);
+- }
+ else if (regexec(&re_upstream_bitrate,line,NMATCH,submatch,0) == 0)
+ {
+ getConfigOptionArgument(vars->upstreamBitrate, BITRATE_LEN, line, submatch);
+@@ -156,27 +138,13 @@
+ }
+ regfree(&re_comment);
+ regfree(&re_empty_row);
+- regfree(&re_iptables_location);
++ regfree(&re_ipnat_location);
+ regfree(&re_debug_mode);
+- regfree(&re_insert_forward_rules_yes);
+- regfree(&re_forward_chain_name);
+- regfree(&re_prerouting_chain_name);
+ regfree(&re_upstream_bitrate);
+ regfree(&re_downstream_bitrate);
+ regfree(&re_duration);
+ regfree(&re_desc_doc);
+ regfree(&re_xml_path);
+- // Set default values for options not found in config file
+- if (strnlen(vars->forwardChainName, CHAIN_NAME_LEN) == 0)
+- {
+- // No forward chain name was set in conf file, set it to default
+- snprintf(vars->forwardChainName, CHAIN_NAME_LEN, IPTABLES_DEFAULT_FORWARD_CHAIN);
+- }
+- if (strnlen(vars->preroutingChainName, CHAIN_NAME_LEN) == 0)
+- {
+- // No prerouting chain name was set in conf file, set it to default
+- snprintf(vars->preroutingChainName, CHAIN_NAME_LEN, IPTABLES_DEFAULT_PREROUTING_CHAIN);
+- }
+ if (strnlen(vars->upstreamBitrate, BITRATE_LEN) == 0)
+ {
+ // No upstream_bitrate was found in the conf file, set it to default
+@@ -195,8 +163,8 @@
+ {
+ snprintf(vars->xmlPath, PATH_LEN, XML_PATH_DEFAULT);
+ }
+- if (strnlen(vars->iptables, PATH_LEN) == 0) {
+- // Can't find the iptables executable, return -1 to
++ if (strnlen(vars->ipnat, PATH_LEN) == 0) {
++ // Can't find the ipnat executable, return -1 to
+ // indicate en error
+ return -1;
+ }
diff --git a/net/linuxigd/files/patch-etc__upnpd.conf b/net/linuxigd/files/patch-etc__upnpd.conf
new file mode 100644
index 0000000..c398a5f
--- /dev/null
+++ b/net/linuxigd/files/patch-etc__upnpd.conf
@@ -0,0 +1,58 @@
+--- etc/upnpd.conf.orig Thu Aug 17 02:19:30 2006
++++ etc/upnpd.conf Sat Jun 16 19:57:09 2007
+@@ -2,10 +2,10 @@
+ # /etc/sysconfig/upnpd
+
+ #
+-# The full path and name of the iptables executable,
++# The full path and name of the ipnat executable,
+ # (enclosed in quotes).
+ #
+-iptables_location = "/sbin/iptables"
++ipnat_location = "/sbin/ipnat"
+
+ #
+ # Daemon debug level. Messages are logged via syslog to debug.
+@@ -17,29 +17,6 @@
+ 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 = FORWARD
+-
+-#
+-# The name of the chain to put prerouting rules in.
+-# allowed values: a-z, A-Z, _, -
+-# default = PREROUTING
+-prerouting_chain_name = PREROUTING
+-
+-#
+ # The internet line upstream bit rate reported from
+ # the daemon. Value in bits per second
+ # default = 0
+@@ -67,9 +44,9 @@
+
+ # The path to the xml documents
+ # Do not include the trailing "/"
+-# default = /etc/linuxigd
++# default = %%PREFIX%%/etc/linuxigd
+ # WARNING! The make install does put the xml files
+-# in /etc/linuxigd, if you change this variable
++# in %%PREFIX%%/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
++xml_document_path = %%PREFIX%%/etc/linuxigd
diff --git a/net/linuxigd/files/patch-gateway.cpp b/net/linuxigd/files/patch-gateway.cpp
deleted file mode 100644
index ce5f110..0000000
--- a/net/linuxigd/files/patch-gateway.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
---- gateway.cpp.orig Sat May 18 05:11:23 2002
-+++ gateway.cpp Sat Aug 3 22:10:54 2002
-@@ -49,6 +49,7 @@
-
- // The global GATE object
- Gate gate;
-+char *ExtIf;
-
- // Callback Function wrapper. This is needed because ISO forbids a pointer to a bound
- // member function. This corrects the issue.
-@@ -140,6 +141,7 @@
- UpnpFinish();
- exit(1);
- }
-+ ExtIf = argv[1];
- gate.m_ipcon = new IPCon(argv[1]);
- syslog(LOG_DEBUG, "Registering the root device\n");
- if ((ret = UpnpRegisterRootDevice(desc_doc_url, GateDeviceCallbackEventHandler,
diff --git a/net/linuxigd/files/patch-gateway.h b/net/linuxigd/files/patch-gateway.h
deleted file mode 100644
index eccea79..0000000
--- a/net/linuxigd/files/patch-gateway.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- gateway.h.orig Fri May 3 00:14:57 2002
-+++ gateway.h Sat Aug 3 22:10:54 2002
-@@ -28,7 +28,7 @@
-
- #define INIT_PORT 2869
- #define INIT_DESC_DOC "gatedesc"
--#define INIT_CONF_DIR "/etc/linuxigd/"
-+#define INIT_CONF_DIR "%%PREFIX%%/etc/linuxigd/"
-
- #define GATE_SERVICE_SERVCOUNT 3
- #define GATE_SERVICE_OSINFO 0
diff --git a/net/linuxigd/files/patch-globals.h b/net/linuxigd/files/patch-globals.h
new file mode 100644
index 0000000..0308104
--- /dev/null
+++ b/net/linuxigd/files/patch-globals.h
@@ -0,0 +1,49 @@
+--- globals.h.orig Mon Nov 13 01:14:11 2006
++++ globals.h Sat Jun 16 19:53:23 2007
+@@ -1,6 +1,7 @@
+ #ifndef _GLOBALS_H_
+ #define _GLOBALS_H_
+
++#include <sys/socket.h>
+ #include <net/if.h>
+
+ #define CHAIN_NAME_LEN 32
+@@ -17,17 +18,15 @@
+ char extInterfaceName[IFNAMSIZ]; // The name of the external interface, picked up from the
+ // command line
+ char intInterfaceName[IFNAMSIZ]; // The name of the internal interface, picked from command line
++ char extIpAddress[16];
++ char intIpAddress[16];
+
+- // All vars below are read from /etc/upnpd.conf in main.c
++ // All vars below are read from %%PREFIX%%/etc/upnpd.conf in main.c
+ int debug; // 1 - print debug messages to syslog
+ // 0 - no debug messages
+- char iptables[PATH_LEN]; // The full name and path of the iptables executable, used in pmlist.c
++ char ipnat[PATH_LEN]; // The full name and path of the ipnat executable, used in pmlist.c
+ char upstreamBitrate[BITRATE_LEN]; // The upstream bitrate reported by the daemon
+ char downstreamBitrate[BITRATE_LEN]; // The downstream bitrate reported by the daemon
+- char forwardChainName[CHAIN_NAME_LEN]; // The name of the iptables chain to put FORWARD rules in
+- char preroutingChainName[CHAIN_NAME_LEN]; // The name of the chain to put PREROUTING rules in
+- int forwardRules; // 1 - forward rules are inserted
+- // 0 - no forward rules inserted
+ long int duration; // 0 - no duration
+ // >0 - duration in seconds
+ // <0 - expiration time
+@@ -38,14 +37,12 @@
+ typedef struct GLOBALS* globals_p;
+ extern struct GLOBALS g_vars;
+
+-#define CONF_FILE "/etc/upnpd.conf"
++#define CONF_FILE "%%PREFIX%%/etc/upnpd.conf"
+ #define MAX_CONFIG_LINE 256
+-#define IPTABLES_DEFAULT_FORWARD_CHAIN "FORWARD"
+-#define IPTABLES_DEFAULT_PREROUTING_CHAIN "PREROUTING"
+ #define DEFAULT_DURATION 0
+ #define DEFAULT_UPSTREAM_BITRATE "0"
+ #define DEFAULT_DOWNSTREAM_BITRATE "0"
+ #define DESC_DOC_DEFAULT "gatedesc.xml"
+-#define XML_PATH_DEFAULT "/etc/linuxigd"
++#define XML_PATH_DEFAULT "%%PREFIX%%/etc/linuxigd"
+
+ #endif // _GLOBALS_H_
diff --git a/net/linuxigd/files/patch-main.c b/net/linuxigd/files/patch-main.c
new file mode 100644
index 0000000..97561ae
--- /dev/null
+++ b/net/linuxigd/files/patch-main.c
@@ -0,0 +1,56 @@
+--- main.c.orig Wed Jul 26 04:45:13 2006
++++ main.c Sat Jun 16 19:49:25 2007
+@@ -2,12 +2,14 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <syslog.h>
++#include <pthread.h>
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <sys/resource.h>
+ #include <time.h>
++#include <sys/socket.h>
+ #include <net/if.h>
+ #include <upnp/upnp.h>
+ #include "globals.h"
+@@ -22,7 +24,6 @@
+ int main (int argc, char** argv)
+ {
+ char descDocUrl[7+15+1+5+1+sizeof(g_vars.descDocName)+1]; // http://ipaddr:port/docName<null>
+- char intIpAddress[16]; // Server internal ip address
+ sigset_t sigsToCatch;
+ int ret, signum, arg = 1, foreground = 0;
+
+@@ -46,11 +47,17 @@
+ strncpy(g_vars.intInterfaceName, argv[arg++], IFNAMSIZ);
+
+ // Get the internal ip address to start the daemon on
+- if (GetIpAddressStr(intIpAddress, g_vars.intInterfaceName) == 0) {
++ if (GetIpAddressStr(g_vars.intIpAddress, g_vars.intInterfaceName) == 0) {
+ fprintf(stderr, "Invalid internal interface name '%s'\n", g_vars.intInterfaceName);
+ exit(EXIT_FAILURE);
+ }
+
++ // Get the external ip address to start the daemon on
++ if (GetIpAddressStr(g_vars.extIpAddress, g_vars.extInterfaceName) == 0) {
++ fprintf(stderr, "Invalid external interface name '%s'\n", g_vars.extInterfaceName);
++ exit(EXIT_FAILURE);
++ }
++
+ if (!foreground) {
+ struct rlimit resourceLimit = { 0, 0 };
+ pid_t pid, sid;
+@@ -114,9 +121,9 @@
+
+ // Initialize UPnP SDK on the internal Interface
+ trace(3, "Initializing UPnP SDK ... ");
+- if ( (ret = UpnpInit(intIpAddress,0) ) != UPNP_E_SUCCESS)
++ if ( (ret = UpnpInit(g_vars.intIpAddress,0) ) != UPNP_E_SUCCESS)
+ {
+- syslog (LOG_ERR, "Error Initializing UPnP SDK on IP %s ",intIpAddress);
++ syslog (LOG_ERR, "Error Initializing UPnP SDK on IP %s ",g_vars.intIpAddress);
+ syslog (LOG_ERR, " UpnpInit returned %d", ret);
+ UpnpFinish();
+ exit(1);
diff --git a/net/linuxigd/files/patch-pmlist.c b/net/linuxigd/files/patch-pmlist.c
new file mode 100644
index 0000000..dc6e75d
--- /dev/null
+++ b/net/linuxigd/files/patch-pmlist.c
@@ -0,0 +1,142 @@
+--- pmlist.c.orig Sun Oct 1 23:58:32 2006
++++ pmlist.c Sat Jun 16 19:55:22 2007
+@@ -8,10 +8,6 @@
+ #include "gatedevice.h"
+ #include "util.h"
+
+-#if HAVE_LIBIPTC
+-#include "iptc.h"
+-#endif
+-
+ struct portMap* pmlist_NewNode(int enabled, long int duration, char *remoteHost,
+ char *externalPort, char *internalPort,
+ char *protocol, char *internalClient, char *desc)
+@@ -233,55 +229,18 @@
+ {
+ if (enabled)
+ {
+-#if HAVE_LIBIPTC
+- char *buffer = malloc(strlen(internalClient) + strlen(internalPort) + 2);
+- if (buffer == NULL) {
+- fprintf(stderr, "failed to malloc memory\n");
+- return 0;
+- }
+-
+- strcpy(buffer, internalClient);
+- strcat(buffer, ":");
+- strcat(buffer, internalPort);
+-
+- if (g_vars.forwardRules)
+- iptc_add_rule("filter", g_vars.forwardChainName, protocol, NULL, NULL, NULL, internalClient, NULL, internalPort, "ACCEPT", NULL, FALSE);
+-
+- iptc_add_rule("nat", g_vars.preroutingChainName, protocol, g_vars.extInterfaceName, NULL, NULL, NULL, NULL, externalPort, "DNAT", buffer, TRUE);
+- free(buffer);
+-#else
+ char command[COMMAND_LEN];
+- int status;
+
+- {
+- char dest[DEST_LEN];
+- char *args[] = {"iptables", "-t", "nat", "-I", g_vars.preroutingChainName, "-i", g_vars.extInterfaceName, "-p", protocol, "--dport", externalPort, "-j", "DNAT", "--to", dest, NULL};
+-
+- snprintf(dest, DEST_LEN, "%s:%s", internalClient, internalPort);
+- snprintf(command, COMMAND_LEN, "%s -t nat -I %s -i %s -p %s --dport %s -j DNAT --to %s:%s", g_vars.iptables, g_vars.preroutingChainName, g_vars.extInterfaceName, protocol, externalPort, internalClient, internalPort);
+- trace(3, "%s", command);
+- if (!fork()) {
+- int rc = execv(g_vars.iptables, args);
+- exit(rc);
+- } else {
+- wait(&status);
+- }
+- }
+-
+- if (g_vars.forwardRules)
+- {
+- char *args[] = {"iptables", "-A", g_vars.forwardChainName, "-p", protocol, "-d", internalClient, "--dport", internalPort, "-j", "ACCEPT", NULL};
+-
+- snprintf(command, COMMAND_LEN, "%s -A %s -p %s -d %s --dport %s -j ACCEPT", g_vars.iptables,g_vars.forwardChainName, protocol, internalClient, internalPort);
+- trace(3, "%s", command);
+- if (!fork()) {
+- int rc = execv(g_vars.iptables, args);
+- exit(rc);
+- } else {
+- wait(&status);
+- }
+- }
+-#endif
++ FILE *ipnat = popen("/sbin/ipnat -f -", "w");
++ sprintf(command, "rdr %s %s/32 port %s -> %s port %s %s\n",
++ g_vars.extInterfaceName, g_vars.extIpAddress, externalPort, internalClient, internalPort, protocol);
++ trace(3, "%s", command);
++ fprintf(ipnat, command);
++ sprintf(command, "rdr lo0 %s/32 port %s -> %s port %s %s\n",
++ g_vars.extIpAddress, externalPort, internalClient, internalPort, protocol);
++ trace(3, "%s", command);
++ fprintf(ipnat, command);
++ pclose(ipnat);
+ }
+ return 1;
+ }
+@@ -290,52 +249,18 @@
+ {
+ if (enabled)
+ {
+-#if HAVE_LIBIPTC
+- char *buffer = malloc(strlen(internalClient) + strlen(internalPort) + 2);
+- strcpy(buffer, internalClient);
+- strcat(buffer, ":");
+- strcat(buffer, internalPort);
+-
+- if (g_vars.forwardRules)
+- iptc_delete_rule("filter", g_vars.forwardChainName, protocol, NULL, NULL, NULL, internalClient, NULL, internalPort, "ACCEPT", NULL);
+-
+- iptc_delete_rule("nat", g_vars.preroutingChainName, protocol, g_vars.extInterfaceName, NULL, NULL, NULL, NULL, externalPort, "DNAT", buffer);
+- free(buffer);
+-#else
+ char command[COMMAND_LEN];
+- int status;
+
+- {
+- char dest[DEST_LEN];
+- char *args[] = {"iptables", "-t", "nat", "-D", g_vars.preroutingChainName, "-i", g_vars.extInterfaceName, "-p", protocol, "--dport", externalPort, "-j", "DNAT", "--to", dest, NULL};
+-
+- snprintf(dest, DEST_LEN, "%s:%s", internalClient, internalPort);
+- snprintf(command, COMMAND_LEN, "%s -t nat -D %s -i %s -p %s --dport %s -j DNAT --to %s:%s",
+- g_vars.iptables, g_vars.preroutingChainName, g_vars.extInterfaceName, protocol, externalPort, internalClient, internalPort);
+- trace(3, "%s", command);
+-
+- if (!fork()) {
+- int rc = execv(g_vars.iptables, args);
+- exit(rc);
+- } else {
+- wait(&status);
+- }
+- }
+-
+- if (g_vars.forwardRules)
+- {
+- char *args[] = {"iptables", "-D", g_vars.forwardChainName, "-p", protocol, "-d", internalClient, "--dport", internalPort, "-j", "ACCEPT", NULL};
+-
+- snprintf(command, COMMAND_LEN, "%s -D %s -p %s -d %s --dport %s -j ACCEPT", g_vars.iptables, g_vars.forwardChainName, protocol, internalClient, internalPort);
+- trace(3, "%s", command);
+- if (!fork()) {
+- int rc = execv(g_vars.iptables, args);
+- exit(rc);
+- } else {
+- wait(&status);
+- }
+- }
+-#endif
++ FILE *ipnat = popen("/sbin/ipnat -rf -", "w");
++ sprintf(command, "rdr %s %s/32 port %s -> %s port %s %s\n",
++ g_vars.extInterfaceName, g_vars.extIpAddress, externalPort, internalClient, internalPort, protocol);
++ trace(3, "%s", command);
++ fprintf(ipnat, command);
++ sprintf(command, "rdr lo0 %s/32 port %s -> %s port %s %s\n",
++ g_vars.extIpAddress, externalPort, internalClient, internalPort, protocol);
++ trace(3, "%s", command);
++ fprintf(ipnat, command);
++ pclose(ipnat);
+ }
+ return 1;
+ }
diff --git a/net/linuxigd/files/patch-pmlist.cpp b/net/linuxigd/files/patch-pmlist.cpp
deleted file mode 100644
index efaef03..0000000
--- a/net/linuxigd/files/patch-pmlist.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
---- pmlist.cpp.orig Fri Jan 3 04:14:24 2003
-+++ pmlist.cpp Wed May 26 10:37:36 2004
-@@ -31,6 +31,8 @@
- #include <unistd.h>
- #include <iostream>
-
-+extern char *ExtIf;
-+
- PortMapList::PortMapList()
- {
-
-@@ -182,8 +184,16 @@
- {
- char command[255];
-
-- sprintf(command,"/usr/sbin/iptables -t nat -A PREROUTING -p %s -d %s --dport %d -j DNAT --to %s:%d", Proto, ExtIP, ExtPort, IntIP, IntPort);
-- system(command);
-+ FILE *ipnat = popen("/sbin/ipnat -f -", "w");
-+ if (ipnat == NULL)
-+ return 0;
-+ sprintf(command, "rdr %s %s/32 port %d -> %s port %d %s\n",
-+ ExtIf, ExtIP, ExtPort, IntIP, IntPort, Proto);
-+ fprintf(ipnat, command);
-+ sprintf(command, "rdr lo0 %s/32 port %d -> %s port %d %s\n",
-+ ExtIP, ExtPort, IntIP, IntPort, Proto);
-+ fprintf(ipnat, command);
-+ pclose(ipnat);
-
- return (1);
- }
-@@ -218,8 +228,16 @@
- {
- char command[255];
-
-+ FILE *ipnat = popen("/sbin/ipnat -rf -", "w");
-+ if (ipnat == NULL)
-+ return 0;
-+ sprintf(command, "rdr %s %s/32 port %d -> %s port %d %s\n",
-+ ExtIf, ExtIP, ExtPort, IntIP, IntPort, Proto);
-+ fprintf(ipnat, command);
-+ sprintf(command, "rdr lo0 %s/32 port %d -> %s port %d %s\n",
-+ ExtIP, ExtPort, IntIP, IntPort, Proto);
-+ fprintf(ipnat, command);
-+ pclose(ipnat);
-
-- sprintf(command, "/usr/sbin/iptables -t nat -D PREROUTING -p %s -d %s --dport %d -j DNAT --to %s:%d", Proto, ExtIP, ExtPort, IntIP, IntPort);
-- system(command);
- return (1);
- }
diff --git a/net/linuxigd/files/patch-ipcon.cpp b/net/linuxigd/files/patch-util.c
index 1a0fd8d..0c5f4aa 100644
--- a/net/linuxigd/files/patch-ipcon.cpp
+++ b/net/linuxigd/files/patch-util.c
@@ -1,8 +1,8 @@
---- ipcon.cpp.orig Wed May 15 23:48:24 2002
-+++ ipcon.cpp Sat Aug 3 22:10:54 2002
-@@ -25,7 +25,8 @@
- #include <stdio.h>
- #include <unistd.h>
+--- util.c.orig Sat Jun 16 09:29:31 2007
++++ util.c Sat Jun 16 09:29:38 2007
+@@ -3,7 +3,8 @@
+ #include <stdarg.h>
+ #include <syslog.h>
#include <arpa/inet.h>
-#include <linux/sockios.h>
+#include <sys/sockio.h>
diff --git a/net/linuxigd/pkg-plist b/net/linuxigd/pkg-plist
index 6299e47..4225626 100644
--- a/net/linuxigd/pkg-plist
+++ b/net/linuxigd/pkg-plist
@@ -1,8 +1,7 @@
-bin/upnpd
+sbin/upnpd
+etc/linuxigd/dummy.xml
etc/linuxigd/gateconnSCPD.xml
-etc/linuxigd/gatedesc.skl
etc/linuxigd/gatedesc.xml
etc/linuxigd/gateicfgSCPD.xml
-etc/linuxigd/gateinfoSCPD.xml
-etc/rc.d/linuxigd.sh.sample
+etc/upnpd.conf
@dirrm etc/linuxigd
OpenPOWER on IntegriCloud