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.
This commit is contained in:
parent
2711126f9a
commit
af66874f38
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=63954
13 changed files with 189 additions and 0 deletions
|
@ -257,6 +257,7 @@
|
|||
SUBDIR += linpopup
|
||||
SUBDIR += linux-edonkey-gui-gtk
|
||||
SUBDIR += linux-edonkey-server
|
||||
SUBDIR += linuxigd
|
||||
SUBDIR += lla
|
||||
SUBDIR += lmd
|
||||
SUBDIR += loadd
|
||||
|
|
35
net/linuxigd/Makefile
Normal file
35
net/linuxigd/Makefile
Normal file
|
@ -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>
|
1
net/linuxigd/distinfo
Normal file
1
net/linuxigd/distinfo
Normal file
|
@ -0,0 +1 @@
|
|||
MD5 (gateway-0.75.tgz) = d2d69493fb0ccfaf02f278a065623d48
|
25
net/linuxigd/files/linuxigd.sh.sample
Normal file
25
net/linuxigd/files/linuxigd.sh.sample
Normal file
|
@ -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
|
22
net/linuxigd/files/patch-Makefile
Normal file
22
net/linuxigd/files/patch-Makefile
Normal file
|
@ -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
|
||||
|
18
net/linuxigd/files/patch-gateway.cpp
Normal file
18
net/linuxigd/files/patch-gateway.cpp
Normal file
|
@ -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,
|
11
net/linuxigd/files/patch-gateway.h
Normal file
11
net/linuxigd/files/patch-gateway.h
Normal file
|
@ -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
|
12
net/linuxigd/files/patch-ipcon.cpp
Normal file
12
net/linuxigd/files/patch-ipcon.cpp
Normal file
|
@ -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>
|
45
net/linuxigd/files/patch-pmlist.cpp
Normal file
45
net/linuxigd/files/patch-pmlist.cpp
Normal file
|
@ -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);
|
1
net/linuxigd/pkg-comment
Normal file
1
net/linuxigd/pkg-comment
Normal file
|
@ -0,0 +1 @@
|
|||
Linux UPnP Internet Gateway Device
|
4
net/linuxigd/pkg-descr
Normal file
4
net/linuxigd/pkg-descr
Normal file
|
@ -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.
|
6
net/linuxigd/pkg-message
Normal file
6
net/linuxigd/pkg-message
Normal file
|
@ -0,0 +1,6 @@
|
|||
*********************************************************************
|
||||
|
||||
Please modify ${PREFIX}/etc/linuxigd/gatedesc.xml
|
||||
and replace 192.168.0.254 with the IP of your internal interface.
|
||||
|
||||
*********************************************************************
|
8
net/linuxigd/pkg-plist
Normal file
8
net/linuxigd/pkg-plist
Normal file
|
@ -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
|
Loading…
Reference in a new issue