Import miniupnpd-1.6.20111118

The miniUPnP daemon is an UPnP IGD (Internet Gateway Device) which
provides NAT traversal services to any UPnP enabled client as well as
NAT Port Mapping Protocol (NAT-PMP) on the network.

ok sthen@
This commit is contained in:
ajacoutot 2012-01-13 09:22:50 +00:00
parent aa44f3823f
commit c857b25352
17 changed files with 272 additions and 0 deletions

22
net/miniupnp/miniupnpd/Makefile Executable file
View File

@ -0,0 +1,22 @@
# $OpenBSD: Makefile,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
COMMENT= UPnP IGD client lightweight library
DISTNAME= miniupnpd-1.6.20111118
WANTLIB += c kvm
MAKE_FLAGS= INSTALLETCDIR=${PREFIX}/share/examples/miniupnpd \
INSTALLMANDIR=${PREFIX}/share/man/man1
FAKE_FLAGS= PREFIX=${TRUEPREFIX}
pre-configure:
${SUBST_CMD} ${WRKSRC}/miniupnpd.1
post-install:
${INSTALL_MAN_DIR} ${PREFIX}/man/man1
${INSTALL_MAN} ${WRKSRC}/miniupnpd.1 \
${PREFIX}/man/man1/miniupnpd.1
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (miniupnpd-1.6.20111118.tar.gz) = qUZP7wokc6RvUvDQ2HQfuw==
RMD160 (miniupnpd-1.6.20111118.tar.gz) = GMAPcY9/w6eE5ZnASQRmSMJiGD8=
SHA1 (miniupnpd-1.6.20111118.tar.gz) = CRzUpyklfoCFq5MLWART4W2U+y0=
SHA256 (miniupnpd-1.6.20111118.tar.gz) = c0ldmlEmiwrqLNYbbZq8WfhTK6qFi8JkGYSeAawfDIs=
SIZE (miniupnpd-1.6.20111118.tar.gz) = 125683

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- Makefile.orig Fri May 27 00:49:17 2011
+++ Makefile Sat Jan 7 09:35:16 2012
@@ -11,7 +11,7 @@
# Linux users, please use Makefile.linux :
# make -f Makefile.linux
-CFLAGS = -pipe -Wall -Os
+CFLAGS += -pipe -Wall
#CFLAGS = -pipe -Wall -O -g -DDEBUG
CC ?= gcc
RM = rm -f
@@ -128,7 +128,7 @@ clean:
miniupnpdctl.o testgetifaddr.o \
$(PFOBJS) $(IPFOBJS) $(IPFWOBJS)
-install: miniupnpd genuuid
+install: miniupnpd
$(STRIP) miniupnpd
$(INSTALL) -d $(DESTDIR)$(INSTALLBINDIR)
$(INSTALL) -m 555 miniupnpd $(DESTDIR)$(INSTALLBINDIR)

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-bsd_getifstats_c,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- bsd/getifstats.c.orig Sat Jan 7 09:33:33 2012
+++ bsd/getifstats.c Sat Jan 7 09:33:52 2012
@@ -9,6 +9,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#if defined(__FreeBSD__) || defined(__DragonFly__)

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-genconfig_sh,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- genconfig.sh.orig Sun Jan 8 10:15:53 2012
+++ genconfig.sh Sun Jan 8 10:16:50 2012
@@ -67,6 +67,10 @@ case $OS_NAME in
if [ \( $MAJORVER -ge 5 \) -o \( $MAJORVER -eq 4 -a $MINORVER -ge 7 \) ]; then
echo "#define PF_NEWSTYLE" >> ${CONFIGFILE}
fi
+ # onrdomain was introduced in OpenBSD 5.0
+ if [ $MAJORVER -ge 4 ]; then
+ echo "#define PFRULE_HAS_ONRDOMAIN" >> ${CONFIGFILE}
+ fi
echo "#define USE_PF 1" >> ${CONFIGFILE}
FW=pf
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-getifaddr_c,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- getifaddr.c.orig Sat Jan 7 09:32:57 2012
+++ getifaddr.c Sat Jan 7 09:33:07 2012
@@ -13,6 +13,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#if defined(sun)

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-miniupnpd_1,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- miniupnpd.1.orig Thu May 13 11:18:12 2010
+++ miniupnpd.1 Thu May 13 11:18:31 2010
@@ -17,7 +17,7 @@ clients on the LAN to ask for port redirections.
.SH OPTIONS
.TP
.B \-f file
-load the config from file. default is /etc/miniupnpd.conf.
+load the config from file. default is ${SYSCONFDIR}/miniupnpd.conf.
.TP
.B \-i interface
interface used to connect to the internet.

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-miniupnpd_conf,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- miniupnpd.conf.orig Tue Dec 22 23:49:09 2009
+++ miniupnpd.conf Sat Jan 7 10:43:25 2012
@@ -1,6 +1,5 @@
# WAN network interface
-#ext_ifname=eth0
-ext_ifname=xl1
+ext_ifname=em0
# if the WAN interface has several IP addresses, you
# can specify the one to use below
#ext_ip=
@@ -24,7 +23,7 @@ port=0
#minissdpdsocket=/var/run/minissdpd.sock
# enable NAT-PMP support (default is no)
-enable_natpmp=yes
+enable_natpmp=no
# enable UPNP support (default is yes)
enable_upnp=yes
@@ -43,8 +42,7 @@ bitrate_down=10000000
# "secure" mode : when enabled, UPnP client are allowed to add mappings only
# to their IP.
-#secure_mode=yes
-secure_mode=no
+secure_mode=yes
# default presentation url is http address on port 80
# If set to an empty string, no presentationURL element will appear
@@ -57,7 +55,6 @@ system_uptime=yes
# notify interval in seconds. default is 30 seconds.
#notify_interval=240
-notify_interval=60
# unused rules cleaning.
# never remove any rule before this threshold for the number
@@ -82,8 +79,8 @@ clean_ruleset_interval=600
# active when compiled with PF_ENABLE_FILTER_RULES (see config.h file)
#quickrules=no
-# uuid : generate your own with "make genuuid"
-uuid=fc4ec57e-b051-11db-88f8-0060085db3f6
+# uuid : generate your own with uuid(1) or uuidgen(1)
+uuid=00000000-0000-0000-0000-000000000000
# serial and model number the daemon will report to clients
# in its XML description
@@ -97,9 +94,8 @@ model_number=1
# ip/mask format must be nn.nn.nn.nn/nn
# it is advised to only allow redirection of port above 1024
# and to finish the rule set with "deny 0-65535 0.0.0.0/0 0-65535"
-allow 1024-65535 192.168.0.0/24 1024-65535
-allow 1024-65535 192.168.1.0/24 1024-65535
-allow 1024-65535 192.168.0.0/23 22
-allow 12345 192.168.7.113/32 54321
+#allow 1024-65535 192.168.0.0/24 1024-65535
+#allow 1024-65535 192.168.1.0/24 1024-65535
+#allow 1024-65535 192.168.0.0/23 22
+#allow 12345 192.168.7.113/32 54321
deny 0-65535 0.0.0.0/0 0-65535
-

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-pf_obsdrdr_c,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- pf/obsdrdr.c.orig Wed Jun 22 23:20:27 2011
+++ pf/obsdrdr.c Sun Jan 8 10:18:32 2012
@@ -33,6 +33,8 @@
* Must be set with OpenBSD version 4.0 and up.
* - PF_NEWSSTYLE
* Must be set with OpenBSD version 4.7 and up.
+ * - PFRULE_HAS_ONRDOMAIN
+ * Must be set with OpenBSD version 5.0 and up.
*/
#include <sys/types.h>
@@ -248,6 +250,9 @@ add_redirect_rule2(const char * ifname,
#ifdef PFRULE_HAS_RTABLEID
pcr.rule.rtableid = -1; /* first appeared in OpenBSD 4.0 */
#endif
+#ifdef PFRULE_HAS_ONRDOMAIN
+ pcr.rule.onrdomain = -1; /* first appeared in OpenBSD 5.0 */
+#endif
pcr.rule.quick = 1;
pcr.rule.keep_state = PF_STATE_NORMAL;
if(tag)
@@ -377,6 +382,9 @@ add_filter_rule2(const char * ifname,
pcr.rule.flagset = (TH_SYN|TH_ACK);
#ifdef PFRULE_HAS_RTABLEID
pcr.rule.rtableid = -1; /* first appeared in OpenBSD 4.0 */
+#endif
+#ifdef PFRULE_HAS_ONRDOMAIN
+ pcr.rule.onrdomain = -1; /* first appeared in OpenBSD 5.0 */
#endif
pcr.rule.keep_state = 1;
strlcpy(pcr.rule.label, desc, PF_RULE_LABEL_SIZE);

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-upnphttp_c,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- upnphttp.c.orig Sat Jan 7 09:31:10 2012
+++ upnphttp.c Sat Jan 7 09:31:49 2012
@@ -13,6 +13,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/param.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
#include <ctype.h>

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-upnppermissions_c,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- upnppermissions.c.orig Sat Jan 7 09:34:12 2012
+++ upnppermissions.c Sat Jan 7 09:34:19 2012
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <syslog.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "config.h"

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-upnpsoap_c,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
--- upnpsoap.c.orig Sat Jan 7 09:32:13 2012
+++ upnpsoap.c Sat Jan 7 09:32:32 2012
@@ -12,6 +12,7 @@
#include <unistd.h>
#include <syslog.h>
#include <sys/types.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>

View File

@ -0,0 +1,3 @@
The miniUPnP daemon is an UPnP IGD (Internet Gateway Device) which
provides NAT traversal services to any UPnP enabled client as well as
NAT Port Mapping Protocol (NAT-PMP) on the network.

View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
@man man/man1/miniupnpd.1
@bin sbin/miniupnpd
share/doc/pkg-readmes/${FULLPKGNAME}
share/examples/miniupnpd/
share/examples/miniupnpd/miniupnpd.conf
@sample ${SYSCONFDIR}/miniupnpd.conf
@rcscript ${RCDIR}/miniupnpd

View File

@ -0,0 +1,22 @@
$OpenBSD: README,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------
Before starting miniupnpd(1), a new universally unique identifier (UUID)
needs to be generated for the gateway and "uuid=" set accordingly in
${SYSCONFDIR}/miniupnpd.conf. To do so, either uuid(1) from the uuid
package or uuidgen(1) from the e2fsprogs package can be used.
Then the following pf(4) anchor needs to be added to pf.conf(5):
anchor "miniupnpd"
At last, multicast needs to be allowed on the internal interface of the
gateway. To do so the following line needs to be added to pf.conf(5):
pass on $internal_interface from any to { 224.0.0.2, 239.0.0.0/8 }
Current miniupnpd(1) anchor rules can be checked by using:
pfctl -a "miniupnpd" -s rules
and flushed with:
pfctl -a "miniupnpd" -F all

View File

@ -0,0 +1,4 @@
*** !!WARNING!! !!WARNING!! !!WARNING!! ***
This port allows machines within your network to create holes in your
firewall. Please ensure this is really what you want!
*** !!WARNING!! !!WARNING!! !!WARNING!! ***

View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# $OpenBSD: miniupnpd.rc,v 1.1.1.1 2012/01/13 09:22:50 ajacoutot Exp $
daemon="${TRUEPREFIX}/sbin/miniupnpd"
. /etc/rc.d/rc.subr
rc_reload=NO
rc_cmd $1