aboutsummaryrefslogtreecommitdiff
path: root/net/linuxigd
diff options
context:
space:
mode:
authorClive Lin <clive@FreeBSD.org>2002-08-04 07:37:39 +0000
committerClive Lin <clive@FreeBSD.org>2002-08-04 07:37:39 +0000
commitaf66874f38783fd619cc9b725409496d06308801 (patch)
tree370e03814869f348b033aff35eef9ad8dd8ff4c6 /net/linuxigd
parent2711126f9a505638a6988c2ce3a5dac2c2b1824d (diff)
New port: linuxigd, Linux UPnP Internet Gateway Device.
This project is a deamon that emulates Microsoft's Internet Connection Service (ICS). It implements the UPnP Internet Gateway Device specification (IGD) and allows UPnP aware clients, such as MSN Messenger to work properly from behind a NAT firewall. PR: ports/41295 Submitted by: Yen-Ming Lee <leeym@utopia.leeym.com> Submitter sponsored by: Miss WeiWei.
Notes
Notes: svn path=/head/; revision=63954
Diffstat (limited to 'net/linuxigd')
-rw-r--r--net/linuxigd/Makefile35
-rw-r--r--net/linuxigd/distinfo1
-rw-r--r--net/linuxigd/files/linuxigd.sh.sample25
-rw-r--r--net/linuxigd/files/patch-Makefile22
-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-ipcon.cpp12
-rw-r--r--net/linuxigd/files/patch-pmlist.cpp45
-rw-r--r--net/linuxigd/pkg-comment1
-rw-r--r--net/linuxigd/pkg-descr4
-rw-r--r--net/linuxigd/pkg-message6
-rw-r--r--net/linuxigd/pkg-plist8
12 files changed, 188 insertions, 0 deletions
diff --git a/net/linuxigd/Makefile b/net/linuxigd/Makefile
new file mode 100644
index 000000000000..54a45ee6a73c
--- /dev/null
+++ b/net/linuxigd/Makefile
@@ -0,0 +1,35 @@
+# New ports collection makefile for: linuxigd
+# Date created: 02 August 2002
+# Whom: Yen-Ming Lee <leeym@leeym.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= linuxigd
+PORTVERSION= 0.75
+CATEGORIES= net
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= linux-igd
+DISTNAME= gateway-${PORTVERSION}
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= leeym@leeym.com
+
+LIB_DEPENDS= upnp.1:${PORTSDIR}/devel/upnp
+
+USE_GMAKE= yes
+USE_REINPLACE= yes
+MAKE_ENV= PTHREAD_LIBS=${PTHREAD_LIBS}
+
+post-extract:
+ @${CHMOD} 755 ${WRKSRC}/etc
+
+post-patch:
+ @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' ${WRKSRC}/gateway.h
+
+post-install:
+ @${MKDIR} ${PREFIX}/etc/rc.d
+ @${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.sh.sample ${PREFIX}/etc/rc.d
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.mk>
diff --git a/net/linuxigd/distinfo b/net/linuxigd/distinfo
new file mode 100644
index 000000000000..acd653f07189
--- /dev/null
+++ b/net/linuxigd/distinfo
@@ -0,0 +1 @@
+MD5 (gateway-0.75.tgz) = d2d69493fb0ccfaf02f278a065623d48
diff --git a/net/linuxigd/files/linuxigd.sh.sample b/net/linuxigd/files/linuxigd.sh.sample
new file mode 100644
index 000000000000..280bb66cf6ac
--- /dev/null
+++ b/net/linuxigd/files/linuxigd.sh.sample
@@ -0,0 +1,25 @@
+#!/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
new file mode 100644
index 000000000000..d2297bebb078
--- /dev/null
+++ b/net/linuxigd/files/patch-Makefile
@@ -0,0 +1,22 @@
+--- Makefile.orig Thu May 2 23:53:12 2002
++++ Makefile Sat Aug 3 22:10:53 2002
+@@ -1,6 +1,6 @@
+ CC=g++
+-INCLUDES= -I/usr/include/upnp
+-LIBS= -lpthread /usr/lib/libupnp.so
++INCLUDES= -I$(PREFIX)/include
++LIBS= $(PTHREAD_LIBS) $(PREFIX)/lib/libupnp.so
+
+
+ ifeq ($(DEBUG),1)
+@@ -26,7 +26,7 @@
+ rm -f *.o $(APPS)
+
+ 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
+
diff --git a/net/linuxigd/files/patch-gateway.cpp b/net/linuxigd/files/patch-gateway.cpp
new file mode 100644
index 000000000000..ce5f1109014d
--- /dev/null
+++ b/net/linuxigd/files/patch-gateway.cpp
@@ -0,0 +1,18 @@
+--- 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
new file mode 100644
index 000000000000..eccea7967c0d
--- /dev/null
+++ b/net/linuxigd/files/patch-gateway.h
@@ -0,0 +1,11 @@
+--- 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-ipcon.cpp b/net/linuxigd/files/patch-ipcon.cpp
new file mode 100644
index 000000000000..1a0fd8d5da31
--- /dev/null
+++ b/net/linuxigd/files/patch-ipcon.cpp
@@ -0,0 +1,12 @@
+--- 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>
+ #include <arpa/inet.h>
+-#include <linux/sockios.h>
++#include <sys/sockio.h>
++#include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <sys/ioctl.h>
diff --git a/net/linuxigd/files/patch-pmlist.cpp b/net/linuxigd/files/patch-pmlist.cpp
new file mode 100644
index 000000000000..b0301c18f168
--- /dev/null
+++ b/net/linuxigd/files/patch-pmlist.cpp
@@ -0,0 +1,45 @@
+--- pmlist.cpp.orig Fri May 3 00:16:28 2002
++++ pmlist.cpp Sat Aug 3 22:11:41 2002
+@@ -30,6 +30,9 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <iostream.h>
++
++extern char *ExtIf;
++
+ PortMapList::PortMapList()
+ {
+
+@@ -190,9 +193,12 @@
+ else
+ strcpy (prt, "udp");
+
+- sprintf(command,"/usr/sbin/iptables -t nat -A PREROUTING -p %s -d %s --dport %d -j DNAT --to %s:%d", prt, 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", ExtIf, ExtIP, ExtPort, IntIP, IntPort, prt);
++ fprintf(ipnat, command);
++ pclose(ipnat);
+
+ ret=1;
+ return (ret);
+@@ -234,9 +240,13 @@
+ else
+ strcpy (prt, "udp");
+
+- sprintf(command, "/usr/sbin/iptables -t nat -D PREROUTING -p %s -d %s --dport %d -j DNAT --to %s:%d", prt, ExtIP, ExtPort, IntIP, IntPort);
+-
+- system(command);
++ FILE *ipnat = popen("/sbin/ipnat -rf -", "w");
++ if (ipnat == NULL)
++ return 0;
++ sprintf(command, "rdr %s %s/32 port %d -> %s port %d %s", ExtIf, ExtIP, ExtPort, IntIP, IntPort, prt);
++ fprintf(ipnat, command);
++ pclose(ipnat);
++
+ ret = 1;
+
+ return (ret);
diff --git a/net/linuxigd/pkg-comment b/net/linuxigd/pkg-comment
new file mode 100644
index 000000000000..d57f740711ad
--- /dev/null
+++ b/net/linuxigd/pkg-comment
@@ -0,0 +1 @@
+Linux UPnP Internet Gateway Device
diff --git a/net/linuxigd/pkg-descr b/net/linuxigd/pkg-descr
new file mode 100644
index 000000000000..6c4a8fb9bfae
--- /dev/null
+++ b/net/linuxigd/pkg-descr
@@ -0,0 +1,4 @@
+This project is a deamon that emulates Microsoft's Internet Connection
+Service (ICS). It implements the UPnP Internet Gateway Device specification
+(IGD) and allows UPnP aware clients, such as MSN Messenger to work properly
+from behind a NAT firewall.
diff --git a/net/linuxigd/pkg-message b/net/linuxigd/pkg-message
new file mode 100644
index 000000000000..c1f40eca33a0
--- /dev/null
+++ b/net/linuxigd/pkg-message
@@ -0,0 +1,6 @@
+*********************************************************************
+
+Please modify ${PREFIX}/etc/linuxigd/gatedesc.xml
+and replace 192.168.0.254 with the IP of your internal interface.
+
+*********************************************************************
diff --git a/net/linuxigd/pkg-plist b/net/linuxigd/pkg-plist
new file mode 100644
index 000000000000..6299e47b8e9e
--- /dev/null
+++ b/net/linuxigd/pkg-plist
@@ -0,0 +1,8 @@
+bin/upnpd
+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
+@dirrm etc/linuxigd