Enable support for NAT-PMP and UPnP through libnatpmp/miniupnpc.

Disabled by default: set "upnp_port_forwarding = true" into
~/.mldonkey/downloads.ini to enable it.
This commit is contained in:
dcoppa 2012-02-28 15:38:55 +00:00
parent 634873c8e6
commit 05c340f796
2 changed files with 52 additions and 6 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.45 2011/12/12 14:57:23 dcoppa Exp $
# $OpenBSD: Makefile,v 1.46 2012/02/28 15:38:55 dcoppa Exp $
COMMENT = e-donkey client
DISTNAME = mldonkey-3.1.0
CATEGORIES = net
REVISION = 4
REVISION = 5
HOMEPAGE = http://mldonkey.sourceforge.net/Main_Page
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=mldonkey/}
@ -25,16 +25,18 @@ WANTLIB += bz2 c cairo charset expat fontconfig
WANTLIB += freetype gd gdk-x11-2.0 gdk_pixbuf-2.0
WANTLIB += gio-2.0 glib-2.0 gmodule-2.0 gobject-2.0
WANTLIB += gthread-2.0 gtk-x11-2.0 jpeg m magic
WANTLIB += pixman-1 pango-1.0 pangocairo-1.0
WANTLIB += pangoft2-1.0 png pthread pthread-stubs
WANTLIB += rsvg-2 stdc++ xcb xcb-render xcb-shm z
WANTLIB += miniupnpc natpmp pixman-1 pango-1.0
WANTLIB += pangocairo-1.0 pangoft2-1.0 png pthread
WANTLIB += pthread-stubs rsvg-2 stdc++ xcb
WANTLIB += xcb-render xcb-shm z
CONFIGURE_STYLE = autoconf no-autoheader
AUTOCONF_DIR = ${WRKSRC}/config
AUTOCONF_VERSION = 2.68
MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/config
CONFIGURE_ARGS += --enable-gui=newgui2
CONFIGURE_ARGS += --enable-gui=newgui2 \
--enable-upnp-natpmp
CONFIGURE_ENV += CPPFLAGS='-I${LOCALBASE}/include/libpng \
-I${LOCALBASE}/include -I${X11BASE}/include' \
LDFLAGS='-L${LOCALBASE}/lib -L${X11BASE}/lib' \
@ -47,6 +49,8 @@ BUILD_DEPENDS = x11/lablgtk2
LIB_DEPENDS = archivers/bzip2 \
devel/libmagic \
graphics/gd \
net/miniupnp/libnatpmp \
net/miniupnp/miniupnpc \
x11/gnome/librsvg \
x11/gtk+2

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-src_utils_net_upnp_stubs_c,v 1.1 2012/02/28 15:38:55 dcoppa Exp $
Fix build with latest libnatpmp/miniupnpc
--- src/utils/net/upnp_stubs.c.orig Mon Nov 1 18:19:23 2010
+++ src/utils/net/upnp_stubs.c Mon Feb 27 15:35:59 2012
@@ -501,7 +501,7 @@ natpmpPulse( ml_upnpmp_t * map )
if( map->enabled && ( map->natpmpState == ML_NATPMP_DISCOVER ) )
{
- int val = initnatpmp( &map->natpmp );
+ int val = initnatpmp( &map->natpmp, 0, 0 );
dbg_printf( "initnatpmp = %d\n", val );
val = sendpublicaddressrequest( &map->natpmp );
dbg_printf( "sendpublicaddressrequest = %d\n", val );
@@ -639,7 +639,7 @@ upnpPulse( ml_upnpmp_t * map )
{
struct UPNPDev * devlist;
errno = 0;
- devlist = upnpDiscover( 2000, NULL, NULL, 0 );
+ devlist = upnpDiscover( 2000, NULL, NULL, 0, 0, 0 );
if( devlist == NULL )
{
dbg_printf( "upnpDiscover failed (errno %d - %s)\n", errno, str_errno( errno ) );
@@ -680,7 +680,7 @@ upnpPulse( ml_upnpmp_t * map )
snprintf( type, sizeof( type ), "%s", ( map->isTcp ? "TCP" : "UDP" ) );
i = UPNP_GetSpecificPortMappingEntry( map->upnpUrls.controlURL,
map->upnpData.first.servicetype, portStr,
- type, intClient, intPort );
+ type, intClient, intPort, NULL, NULL, NULL );
if( i != UPNPCOMMAND_SUCCESS )
{
dbg_printf( "Port %d isn't forwarded\n", map->extPort );
@@ -730,7 +730,7 @@ upnpPulse( ml_upnpmp_t * map )
err = UPNP_AddPortMapping( map->upnpUrls.controlURL,
map->upnpData.first.servicetype,
extPortStr, intPortStr, map->lanaddr,
- desc, type, NULL );
+ desc, type, NULL, "0" );
map->upnpMapped = !err;
}
dbg_printf( "Port forwarding through \"%s\", service \"%s\". (local address[%s:%d])\n", map->upnpUrls.controlURL, map->upnpData.first.servicetype, map->lanaddr, map->intPort );