Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
miniupnpd: Updated to 20160215
Browse files Browse the repository at this point in the history
  • Loading branch information
RMerl committed Feb 16, 2016
1 parent 84a6b16 commit 2f193f6
Show file tree
Hide file tree
Showing 45 changed files with 1,390 additions and 337 deletions.
30 changes: 29 additions & 1 deletion release/src/router/miniupnpd/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
$Id: Changelog.txt,v 1.408 2015/11/16 19:29:42 nanard Exp $
$Id: Changelog.txt,v 1.421 2016/02/12 12:34:37 nanard Exp $

2016/02/12:
return error 729 - ConflictWithOtherMechanisms if IGD v2 is enabled.
add iptc_init() check in iptcrdr.c/init_redirect()
add update_portmapping() / update_portmapping_desc_timestamp() functions

2016/02/11:
use Linux libuuid uuid_generate() / BSD uuid_create() API

2016/01/28:
renamed iptables chain MINIUPNPD-PCP-PEER to MINIUPNPD-POSTROUTING
implemented "IGD2 Port Triggering" with netfilter/iptables

2016/01/18:
fix pcpserver.c CreatePCPMap_FW() : check pinhole before adding

2015/12/16:
improve syslog message for incoming HTTP requests

2015/12/13:
--disable-pppconn to disable WanPPPConnection
more fixes in DeviceProtection service

2015/12/12:
add commandline option to genconfig.sh to set UPnP (UDA) version
advertise correct service and device versions when IGDv2 is enabled
fix action arguments for DeviceProtection service
fix event subscription renewal (include SID in response)

2015/11/16:
Fix bsd/getroute.c get_src_for_route_to() when args are NULL
Expand Down
20 changes: 13 additions & 7 deletions release/src/router/miniupnpd/INSTALL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MiniUPnP project.
(c) 2006-2014 Thomas Bernard
(c) 2006-2016 Thomas Bernard
Homepage : http://miniupnp.free.fr/
Mirror: http://miniupnp.tuxfamily.org/
github: https://github.com/miniupnp/miniupnp
Expand All @@ -26,20 +26,17 @@ To Build and Install :
pass out on $int_if from any to 239.0.0.0/8 keep state
pass in on $int_if from any to 239.0.0.0/8 keep state
- dont forget to " pfctl -f /etc/pf.conf "
- you can check your modifications are taken into accout with
- you can check your modifications are taken into account with
"pfctl -s nat" and "pfctl -s rule". Look for the "rdr-anchor miniupnpd"
(if applicable) and/or "anchor miniupnpd" lines.
- OpenBSD users may need to add a multicast_host= line to /etc/rc.conf.local
see $man 8 netstart
- install as root using :
# make install
or
# PREFIX=/usr/local make install
- run as root : The daemon needs rights to modify pf rules.

edit the /etc/miniupnpd.conf file to set options. Almost all options are also
available through command line switches.
To stop the daemon use :
> kill `cat /var/run/miniupnpd.pid`

=========================== *BSD,*Solaris/ipf =============================

genconfig.sh and the Makefile try to detect wether ipf or pf should be
Expand Down Expand Up @@ -113,6 +110,15 @@ How to get libiptc with its headers on debian :
- it is now possible to compile miniupnpd using the following command :
> IPTABLESPATH=/path/to/iptables-x.x.x make -f Makefile.linux

======================== Linux/netfilter nftables =========================

work is in progress. To build :
> make -f Makefile.linux_nft

see :
http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=4370
https://github.com/miniupnp/miniupnp/pull/114

=========================== Configuration =============================
Edit the /etc/miniupnpd.conf file to set options. Almost all options are
also available through command line switches.
Expand Down
22 changes: 11 additions & 11 deletions release/src/router/miniupnpd/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $Id: Makefile,v 1.87 2015/11/05 11:16:13 nanard Exp $
# $Id: Makefile,v 1.88 2016/02/10 20:32:43 nanard Exp $
# MiniUPnP project
# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
# Author: Thomas Bernard
Expand Down Expand Up @@ -223,34 +223,34 @@ depend: config.h
testssdppktgen.c

miniupnpd: config.h $(ALLOBJS)
$(CC) $(CFLAGS) -o $@ $(ALLOBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(ALLOBJS) $(LIBS)

# BSDmake :
# $(CC) $(CFLAGS) -o $@ $> $(LIBS)
# $(CC) $(LDFLAGS) -o $@ $> $(LIBS)

miniupnpdctl: config.h $(MINIUPNPDCTLOBJS)
$(CC) $(CFLAGS) -o $@ $(MINIUPNPDCTLOBJS)
$(CC) $(LDFLAGS) -o $@ $(MINIUPNPDCTLOBJS)

testupnpdescgen: config.h $(TESTUPNPDESCGENOBJS)
$(CC) $(CFLAGS) -o $@ $(TESTUPNPDESCGENOBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(TESTUPNPDESCGENOBJS) $(LIBS)

testgetifstats: config.h $(TESTGETIFSTATSOBJS)
$(CC) $(CFLAGS) -o $@ $(TESTGETIFSTATSOBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(TESTGETIFSTATSOBJS) $(LIBS)

testgetifaddr: config.h $(TESTGETIFADDROBJS)
$(CC) $(CFLAGS) -o $@ $(TESTGETIFADDROBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(TESTGETIFADDROBJS) $(LIBS)

testupnppermissions: config.h $(TESTUPNPPERMISSIONSOBJS)
$(CC) $(CFLAGS) -o $@ $(TESTUPNPPERMISSIONSOBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(TESTUPNPPERMISSIONSOBJS) $(LIBS)

testgetroute: config.h $(TESTGETROUTEOBJS)
$(CC) $(CFLAGS) -o $@ $(TESTGETROUTEOBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(TESTGETROUTEOBJS) $(LIBS)

testasyncsendto: config.h $(TESTASYNCSENDTOOBJS)
$(CC) $(CFLAGS) -o $@ $(TESTASYNCSENDTOOBJS)
$(CC) $(LDFLAGS) -o $@ $(TESTASYNCSENDTOOBJS)

testportinuse: config.h $(TESTPORTINUSEOBJS)
$(CC) $(CFLAGS) -o $@ $(TESTPORTINUSEOBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(TESTPORTINUSEOBJS) $(LIBS)

# gmake :
# $(CC) $(CFLAGS) -o $@ $^
Expand Down
9 changes: 8 additions & 1 deletion release/src/router/miniupnpd/Makefile.linux
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $Id: Makefile.linux,v 1.86 2014/04/09 07:22:28 nanard Exp $
# $Id: Makefile.linux,v 1.93 2016/02/12 14:28:01 nanard Exp $
# MiniUPnP project
# (c) 2006-2015 Thomas Bernard
# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
Expand Down Expand Up @@ -149,6 +149,13 @@ endif # ($(TEST),1)

LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)

TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1)
ifeq ($(TEST),1)
LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid)
else
$(info please install uuid-dev package / libuuid)
endif # ($(TEST),1)

TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o

EXECUTABLES = miniupnpd testupnpdescgen testgetifstats \
Expand Down
8 changes: 5 additions & 3 deletions release/src/router/miniupnpd/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MiniUPnP project
(c) 2006-2014 Thomas Bernard
(c) 2006-2016 Thomas Bernard
webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
github: https://github.com/miniupnp/miniupnp
freecode: http://freecode.com/projects/miniupnp
Expand All @@ -16,7 +16,9 @@ the network.
See http://www.upnp.org/ for more details on UPnP.
During the year 2011, support for IGD v2 has been added.
In 2012, IGD v2 WANIPv6FirewallControl has been implemented.
It is not yes enabled by default because it still needs testing.

IGD2 is still not enabled by default because of interoperability
issues.

Support for the NAT Port Mapping Protocol (NAT-PMP) has been
added. See information about NAT-PMP here :
Expand All @@ -25,7 +27,7 @@ http://miniupnp.free.fr/nat-pmp.html
NAT-PMP is the precursor of Port Control Protocol (PCP).
In 2013, support for PCP has been added too.

Read the INSTALL files for instructions to compile, install and
Read the INSTALL file for instructions to compile, install and
configure miniupnpd on your system.

Report bugs to miniupnp@free.fr on the web forum
Expand Down
2 changes: 2 additions & 0 deletions release/src/router/miniupnpd/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ support IGD v2 : http://upnp.org/specs/gw/igd2/
- ipfw/ipf : TODO

implement port_in_use() for NetBSD

- Do we need to TRIM arguments from SOAP ?
17 changes: 14 additions & 3 deletions release/src/router/miniupnpd/commonrdr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* $Id: commonrdr.h,v 1.9 2014/02/11 09:36:15 nanard Exp $ */
/* $Id: commonrdr.h,v 1.10 2016/02/12 12:34:39 nanard Exp $ */
/* MiniUPnP project
* (c) 2006-2014 Thomas Bernard
* (c) 2006-2016 Thomas Bernard
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
Expand Down Expand Up @@ -52,5 +52,16 @@ unsigned short *
get_portmappings_in_range(unsigned short startport, unsigned short endport,
int proto, unsigned int * number);

#endif
/* update the port mapping internal port, decription and timestamp */
int
update_portmapping(const char * ifname, unsigned short eport, int proto,
unsigned short iport, const char * desc,
unsigned int timestamp);

/* update the port mapping decription and timestamp */
int
update_portmapping_desc_timestamp(const char * ifname,
unsigned short eport, int proto,
const char * desc, unsigned int timestamp);

#endif
63 changes: 56 additions & 7 deletions release/src/router/miniupnpd/genconfig.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#! /bin/sh
# $Id: genconfig.sh,v 1.81 2015/07/16 15:00:21 nanard Exp $
# $Id: genconfig.sh,v 1.90 2016/02/11 10:35:12 nanard Exp $
# miniupnp daemon
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
# (c) 2006-2015 Thomas Bernard
# (c) 2006-2016 Thomas Bernard
# This software is subject to the conditions detailed in the
# LICENCE file provided within the distribution

# default to UPnP Device Architecture (UDA) v1.1
# some control points do not like UDA v2.0
UPNP_VERSION_MAJOR=1
UPNP_VERSION_MINOR=1

for argv; do
case "$argv" in
--ipv6) IPV6=1 ;;
Expand All @@ -15,6 +20,16 @@ case "$argv" in
--vendorcfg) VENDORCFG=1 ;;
--pcp-peer) PCP_PEER=1 ;;
--portinuse) PORTINUSE=1 ;;
--uda-version=*)
UPNP_VERSION=$(echo $argv | cut -d= -f2)
UPNP_VERSION_MAJOR=$(echo $UPNP_VERSION | cut -s -d. -f1)
UPNP_VERSION_MINOR=$(echo $UPNP_VERSION | cut -s -d. -f2)
echo "Setting UPnP version major=$UPNP_VERSION_MAJOR minor=$UPNP_VERSION_MINOR"
if [ -z "$UPNP_VERSION_MAJOR" ] || [ -z "$UPNP_VERSION_MINOR" ] ; then
echo "UPnP Version invalid in option $argv"
exit 1
fi ;;
--disable-pppconn) DISABLEPPPCONN=1 ;;
--help|-h)
echo "Usage : $0 [options]"
echo " --ipv6 enable IPv6"
Expand All @@ -24,6 +39,8 @@ case "$argv" in
echo " --vendorcfg enable configuration of manufacturer info"
echo " --pcp-peer enable PCP PEER operation"
echo " --portinuse enable port in use check"
echo " --uda-version=x.x set advertised UPnP version (default to ${UPNP_VERSION_MAJOR}.${UPNP_VERSION_MINOR})"
echo " --disable-pppconn disable WANPPPConnection"
exit 1
;;
*)
Expand Down Expand Up @@ -86,9 +103,14 @@ ${RM} ${CONFIGFILE}

echo "/* MiniUPnP Project" >> ${CONFIGFILE}
echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}
echo " * (c) 2006-2015 Thomas Bernard" >> ${CONFIGFILE}
echo " * (c) 2006-2016 Thomas Bernard" >> ${CONFIGFILE}
echo " * generated by $0 on `date`" >> ${CONFIGFILE}
echo " * using command line options $* */" >> ${CONFIGFILE}
echo " * `uname -a`" >> ${CONFIGFILE}
if [ -z "$*" ] ; then
echo " * using no command line option */" >> ${CONFIGFILE}
else
echo " * using command line options $* */" >> ${CONFIGFILE}
fi
echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}
echo "#define $CONFIGMACRO" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE}
Expand All @@ -109,8 +131,8 @@ echo "" >> ${CONFIGFILE}
cat >> ${CONFIGFILE} <<EOF
/* UPnP version reported in XML descriptions
* 1.0 / 1.1 / 2.0 depending on which UDA (UPnP Device Architecture) Version */
#define UPNP_VERSION_MAJOR 1
#define UPNP_VERSION_MINOR 1
#define UPNP_VERSION_MAJOR ${UPNP_VERSION_MAJOR}
#define UPNP_VERSION_MINOR ${UPNP_VERSION_MINOR}
#define UPNP_VERSION_MAJOR_STR XSTR(UPNP_VERSION_MAJOR)
#define UPNP_VERSION_MINOR_STR XSTR(UPNP_VERSION_MINOR)
EOF
Expand Down Expand Up @@ -253,6 +275,12 @@ case $OS_NAME in
OS_VERSION=`cat /etc/gentoo-release`
OS_URL=http://www.gentoo.org/
fi
# ClearOS special case
if [ -f /etc/clearos-release ]; then
OS_NAME=ClearOS
OS_VERSION=`grep ^base_version /etc/product | awk '{ print $3 }'`
OS_URL=https://www.clearos.com/
fi
# use lsb_release (Linux Standard Base) when available
LSB_RELEASE=`which lsb_release`
if [ 0 -eq $? ]; then
Expand Down Expand Up @@ -356,7 +384,15 @@ case $FW in
;;
esac

# set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
# UUID API
if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then
echo "#define BSD_UUID" >> ${CONFIGFILE}
fi
if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then
echo "#define LIB_UUID" >> ${CONFIGFILE}
fi

# set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then
V6SOCKETS_ARE_V6ONLY=0
fi
Expand All @@ -370,6 +406,10 @@ if [ \( "$FW" = "netfilter" \) -o \( "$FW" = "pf" \) -o \( "$FW" = "ipfw" \) ] ;
echo "#define SUPPORT_REMOTEHOST" >> ${CONFIGFILE}
fi

echo "/* Enable IGD2 \"Port Triggering\" as defined in Section 2.5.16" >> ${CONFIGFILE}
echo " * figure 2.2 in UPnP-gw-WANIPConnection-v2-Service.pdf */" >> ${CONFIGFILE}
echo "#define ENABLE_PORT_TRIGGERING" >> ${CONFIGFILE}

echo "" >> ${CONFIGFILE}
echo "#define OS_NAME \"$OS_NAME\"" >> ${CONFIGFILE}
echo "#define OS_VERSION \"$OS_NAME/$OS_VERSION\"" >> ${CONFIGFILE}
Expand Down Expand Up @@ -456,6 +496,15 @@ echo "/*#define HAS_DUMMY_SERVICE*/" >> ${CONFIGFILE}
echo "#define ENABLE_L3F_SERVICE" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE}

echo "/* define ADVERTISE_WANPPPCONN to allow buggy Control Point to use" >> ${CONFIGFILE}
echo " * WANPPPConnection instead of WANIPConnection. */" >> ${CONFIGFILE}
if [ -n "$STRICT" ] || [ -n "$DISABLEPPPCONN" ] ; then
echo "/*#define ADVERTISE_WANPPPCONN*/" >> ${CONFIGFILE}
else
echo "#define ADVERTISE_WANPPPCONN" >> ${CONFIGFILE}
fi
echo "" >> ${CONFIGFILE}

echo "/* Enable IP v6 support */" >> ${CONFIGFILE}
if [ -n "$IPV6" ]; then
echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
Expand Down

0 comments on commit 2f193f6

Please sign in to comment.