Skip site navigation (1)Skip section navigation (2)
Date:      Sun,  4 Aug 2002 03:57:23 +0800 (CST)
From:      Yen-Ming Lee <leeym@utopia.leeym.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/41295: new port: net/linuxigd
Message-ID:  <20020803195723.7D4983E9C17@utopia.leeym.com>

next in thread | raw e-mail | index | archive | help

>Number:         41295
>Category:       ports
>Synopsis:       new port: net/linuxigd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 03 13:00:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Yen-Ming Lee
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
dedicate this port to Dear Miss WeiWei
>Environment:
System: FreeBSD utopia.leeym.com 4.6-STABLE FreeBSD 4.6-STABLE #62: Fri Aug 2 05:58:35 CST 2002 root@utopia.leeym.com:/usr/obj/usr/src/sys/UTOPIA i386


	
>Description:

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.

WWW: http://linux-igd.sourceforge.net/

This port depends on previous PR (devel/upnp)
http://www.freebsd.org/cgi/query-pr.cgi?pr=41294

ACKNOWLEDGEMENT:
I ported this for a lovely lady, Dear Miss WeiWei,
and thank her for testing voice chat of MSN messenger with me.

>How-To-Repeat:
	
>Fix:

	

--- linuxigd.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	linuxigd
#	linuxigd/Makefile
#	linuxigd/pkg-comment
#	linuxigd/pkg-descr
#	linuxigd/pkg-plist
#	linuxigd/distinfo
#	linuxigd/files
#	linuxigd/files/patch-Makefile
#	linuxigd/files/patch-gateway.cpp
#	linuxigd/files/patch-gateway.h
#	linuxigd/files/patch-ipcon.cpp
#	linuxigd/files/patch-pmlist.cpp
#	linuxigd/files/linuxigd.sh.sample
#	linuxigd/pkg-message
#
echo c - linuxigd
mkdir -p linuxigd > /dev/null 2>&1
echo x - linuxigd/Makefile
sed 's/^X//' >linuxigd/Makefile << 'END-of-linuxigd/Makefile'
X# New ports collection makefile for:	linuxigd
X# Date created:				02 August 2002
X# Whom:	      				Yen-Ming Lee <leeym@leeym.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	linuxigd
XPORTVERSION=	0.75
XCATEGORIES=	net
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	linux-igd
XDISTNAME=	gateway-${PORTVERSION}
XEXTRACT_SUFX=	.tgz
X
XMAINTAINER=	leeym@leeym.com
X
XLIB_DEPENDS=	upnp.1:${PORTSDIR}/devel/upnp
X
XUSE_GMAKE=	yes
XUSE_REINPLACE=	yes
XMAKE_ENV=	PTHREAD_LIBS=${PTHREAD_LIBS}
X
Xpost-extract:
X	@${CHMOD} 755 ${WRKSRC}/etc
X
Xpost-patch:
X	@${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' ${WRKSRC}/gateway.h
X
Xpost-install:
X	@${MKDIR} ${PREFIX}/etc/rc.d
X	@${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.sh.sample ${PREFIX}/etc/rc.d
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.mk>
END-of-linuxigd/Makefile
echo x - linuxigd/pkg-comment
sed 's/^X//' >linuxigd/pkg-comment << 'END-of-linuxigd/pkg-comment'
XLinux UPnP Internet Gateway Device
END-of-linuxigd/pkg-comment
echo x - linuxigd/pkg-descr
sed 's/^X//' >linuxigd/pkg-descr << 'END-of-linuxigd/pkg-descr'
XThis project is a deamon that emulates Microsoft's Internet Connection
XService (ICS). It implements the UPnP Internet Gateway Device specification
X(IGD) and allows UPnP aware clients, such as MSN Messenger to work properly
Xfrom behind a NAT firewall. 
END-of-linuxigd/pkg-descr
echo x - linuxigd/pkg-plist
sed 's/^X//' >linuxigd/pkg-plist << 'END-of-linuxigd/pkg-plist'
Xbin/upnpd
Xetc/linuxigd/gateconnSCPD.xml
Xetc/linuxigd/gatedesc.skl
Xetc/linuxigd/gatedesc.xml
Xetc/linuxigd/gateicfgSCPD.xml
Xetc/linuxigd/gateinfoSCPD.xml
Xetc/rc.d/linuxigd.sh.sample
X@dirrm etc/linuxigd
END-of-linuxigd/pkg-plist
echo x - linuxigd/distinfo
sed 's/^X//' >linuxigd/distinfo << 'END-of-linuxigd/distinfo'
XMD5 (gateway-0.75.tgz) = d2d69493fb0ccfaf02f278a065623d48
END-of-linuxigd/distinfo
echo c - linuxigd/files
mkdir -p linuxigd/files > /dev/null 2>&1
echo x - linuxigd/files/patch-Makefile
sed 's/^X//' >linuxigd/files/patch-Makefile << 'END-of-linuxigd/files/patch-Makefile'
X--- Makefile.orig	Thu May  2 23:53:12 2002
X+++ Makefile	Sat Aug  3 22:10:53 2002
X@@ -1,6 +1,6 @@
X CC=g++
X-INCLUDES= -I/usr/include/upnp 
X-LIBS= -lpthread  /usr/lib/libupnp.so
X+INCLUDES= -I$(PREFIX)/include 
X+LIBS= $(PTHREAD_LIBS) $(PREFIX)/lib/libupnp.so
X 
X 
X ifeq ($(DEBUG),1)
X@@ -26,7 +26,7 @@
X 	rm -f *.o $(APPS)
X 
X install: upnpd
X-	@install -d /etc/linuxigd
X-	@install etc/* /etc/linuxigd
X-	@install upnpd /usr/bin
X+	@install -d $(PREFIX)/etc/linuxigd
X+	@$(BSD_INSTALL_DATA) etc/* $(PREFIX)/etc/linuxigd
X+	@$(BSD_INSTALL_PROGRAM) upnpd $(PREFIX)/bin
X 
END-of-linuxigd/files/patch-Makefile
echo x - linuxigd/files/patch-gateway.cpp
sed 's/^X//' >linuxigd/files/patch-gateway.cpp << 'END-of-linuxigd/files/patch-gateway.cpp'
X--- gateway.cpp.orig	Sat May 18 05:11:23 2002
X+++ gateway.cpp	Sat Aug  3 22:10:54 2002
X@@ -49,6 +49,7 @@
X 
X // The global GATE object
X Gate gate;
X+char *ExtIf;
X 
X // Callback Function wrapper.  This is needed because ISO forbids a pointer to a bound
X // member function.  This corrects the issue.
X@@ -140,6 +141,7 @@
X 		UpnpFinish();
X 		exit(1);
X 	}
X+	ExtIf = argv[1];
X 	gate.m_ipcon = new IPCon(argv[1]);
X 	syslog(LOG_DEBUG, "Registering the root device\n");
X 	if ((ret = UpnpRegisterRootDevice(desc_doc_url, GateDeviceCallbackEventHandler,
END-of-linuxigd/files/patch-gateway.cpp
echo x - linuxigd/files/patch-gateway.h
sed 's/^X//' >linuxigd/files/patch-gateway.h << 'END-of-linuxigd/files/patch-gateway.h'
X--- gateway.h.orig	Fri May  3 00:14:57 2002
X+++ gateway.h	Sat Aug  3 22:10:54 2002
X@@ -28,7 +28,7 @@
X 
X #define INIT_PORT          2869
X #define INIT_DESC_DOC      "gatedesc"
X-#define INIT_CONF_DIR      "/etc/linuxigd/"
X+#define INIT_CONF_DIR      "%%PREFIX%%/etc/linuxigd/"
X 
X #define GATE_SERVICE_SERVCOUNT  3
X #define GATE_SERVICE_OSINFO             0
END-of-linuxigd/files/patch-gateway.h
echo x - linuxigd/files/patch-ipcon.cpp
sed 's/^X//' >linuxigd/files/patch-ipcon.cpp << 'END-of-linuxigd/files/patch-ipcon.cpp'
X--- ipcon.cpp.orig	Wed May 15 23:48:24 2002
X+++ ipcon.cpp	Sat Aug  3 22:10:54 2002
X@@ -25,7 +25,8 @@
X #include <stdio.h>
X #include <unistd.h>
X #include <arpa/inet.h>
X-#include <linux/sockios.h>
X+#include <sys/sockio.h>
X+#include <sys/socket.h>
X #include <net/if.h>
X #include <netinet/in.h>
X #include <sys/ioctl.h>
END-of-linuxigd/files/patch-ipcon.cpp
echo x - linuxigd/files/patch-pmlist.cpp
sed 's/^X//' >linuxigd/files/patch-pmlist.cpp << 'END-of-linuxigd/files/patch-pmlist.cpp'
X--- pmlist.cpp.orig	Fri May  3 00:16:28 2002
X+++ pmlist.cpp	Sat Aug  3 22:11:41 2002
X@@ -30,6 +30,9 @@
X #include <stdlib.h>
X #include <unistd.h>
X #include <iostream.h>
X+
X+extern char *ExtIf;
X+
X PortMapList::PortMapList()
X {
X 
X@@ -190,9 +193,12 @@
X 	else
X 		strcpy (prt, "udp");
X 
X-	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);
X-	
X-	system(command);
X+	FILE *ipnat = popen("/sbin/ipnat -f -", "w");
X+	if (ipnat == NULL)
X+		return 0;
X+	sprintf(command, "rdr %s %s/32 port %d -> %s port %d %s", ExtIf, ExtIP, ExtPort, IntIP, IntPort, prt);
X+	fprintf(ipnat, command);
X+	pclose(ipnat);
X 
X 	ret=1;
X 	return (ret);
X@@ -234,9 +240,13 @@
X 	else
X 		strcpy (prt, "udp");
X 
X-	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);
X-	
X-	system(command);
X+	FILE *ipnat = popen("/sbin/ipnat -rf -", "w");
X+	if (ipnat == NULL)
X+		return 0;
X+	sprintf(command, "rdr %s %s/32 port %d -> %s port %d %s", ExtIf, ExtIP, ExtPort, IntIP, IntPort, prt);
X+	fprintf(ipnat, command);
X+	pclose(ipnat);
X+
X 	ret = 1;
X 
X 	return (ret);
END-of-linuxigd/files/patch-pmlist.cpp
echo x - linuxigd/files/linuxigd.sh.sample
sed 's/^X//' >linuxigd/files/linuxigd.sh.sample << 'END-of-linuxigd/files/linuxigd.sh.sample'
X#!/bin/sh
X
XEXT_IF=fxp0	# external interface
XINT_IF=fxp1	# internal interface
X
Xif ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
X    echo "$0: Cannot determine the PREFIX" >&2
X    exit 1
Xfi
X
Xcase "$1" in
Xstart)
X	if [ -x ${PREFIX}/bin/upnpd ]; then
X		${PREFIX}/bin/upnpd ${EXT_IF} ${INT_IF} && echo -n ' upnpd'
X	fi
X	;;
Xstop)
X	killall upnpd && echo -n ' upnpd'
X	;;
X*)
X	echo "Usage: `basename $0` {start|stop}" >&2
X	;;
Xesac
X
Xexit 0
END-of-linuxigd/files/linuxigd.sh.sample
echo x - linuxigd/pkg-message
sed 's/^X//' >linuxigd/pkg-message << 'END-of-linuxigd/pkg-message'
X*********************************************************************
X
XPlease modify ${PREFIX}/etc/linuxigd/gatedesc.xml
Xand replace 192.168.0.254 with the IP of your internal interface.
X
X*********************************************************************
END-of-linuxigd/pkg-message
exit
--- linuxigd.shar ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020803195723.7D4983E9C17>