miniupnp/miniupnpc
Thomas Bernard c55d27f46e InetPton() is not available with Win XP so use inet_addr()
see 8babc5d013

Signed-off-by: Thomas Bernard <miniupnp@free.fr>
2018-07-15 12:52:19 +02:00
..
java changes java sample according to change of upnpDiscover() 2015-09-04 18:15:07 +02:00
man3 miniupnpc: fix typo 2018-02-03 01:12:45 +08:00
msvc add genminiupnpcstrings.vbs to MSVC 2015 project 2018-07-14 13:34:44 +02:00
testdesc miniupnpc: Add linksys_WAG200G_desc.xml to test 2014-11-26 12:39:43 +01:00
testreplyparse miniupnpc: added test cases for XML parsing 2014-01-27 16:27:51 +01:00
.gitignore .gitignore: add miniupnpc.pc 2018-04-10 09:47:18 +02:00
CMakeLists.txt Fix colliding of miniupnpc.lib files 2018-05-09 13:52:41 +03:00
Changelog.txt miniupnpc: VERSION 2.1 2018-05-07 13:12:58 +02:00
LICENSE 2015 => 2016 2016-10-06 15:51:07 +03:30
MANIFEST.in cli:py: do not ship binaries in sdist 2017-08-25 16:06:26 +02:00
Makefile miniupnpc: increments API_VERSION to 17 2018-04-06 12:48:24 +02:00
Makefile.mingw miniupnpc/Makefile.mingw: Support cross compiling for Ming32 2018-04-26 22:13:06 +02:00
README miniupnp: Add information about iptables settings into README 2018-07-14 13:45:09 +02:00
VERSION miniupnpc: VERSION 2.1 2018-05-07 13:12:58 +02:00
apiversions.txt miniupnpc: increments API_VERSION to 17 2018-04-06 12:48:24 +02:00
codelength.h miniupnpc: update getDevicesFromMiniSSDPD() to process longer minissdpd responses 2015-06-16 17:33:59 +02:00
connecthostport.c Move common definition to miniupnpc_socketdef.h 2018-07-14 13:39:01 +02:00
connecthostport.h miniupnpc: use SOCKET type instead of int for copilation under Win64 2018-04-06 12:21:36 +02:00
external-ip.sh Update external-ip.sh, only output on success 2017-09-28 15:14:22 -07:00
igd_desc_parse.c igd_desc_parse.c: fix buffer overflow 2015-09-15 15:32:33 +02:00
igd_desc_parse.h igd_desc_parse.c: define printIGD() only in DEBUG 2014-11-17 20:32:41 +01:00
listdevices.c miniupnpc/lisdevices.c: remove warnings. fix leak 2018-04-30 16:44:15 +02:00
mingw32make.bat
minihttptestserver.c miniupnpc: fix typo 2018-02-03 01:12:45 +08:00
minisoap.c Move common definition to miniupnpc_socketdef.h 2018-07-14 13:39:01 +02:00
minisoap.h miniupnpc: use SOCKET type instead of int for copilation under Win64 2018-04-06 12:21:36 +02:00
minissdpc.c InetPton() is not available with Win XP so use inet_addr() 2018-07-15 12:52:19 +02:00
minissdpc.h When code was updated for 64-bit Windows configurations, some changes were not applied. 2018-07-06 11:35:12 +02:00
miniupnpc.c When code was updated for 64-bit Windows configurations, some changes were not applied. 2018-07-06 11:35:12 +02:00
miniupnpc.def Dynamic build fails 2014-07-29 11:07:43 -04:00
miniupnpc.h miniupnpc: VERSION 2.1 2018-05-07 13:12:58 +02:00
miniupnpc_declspec.h miniupnpc: renamed declspec.h in order to avoid conflicts 2015-07-21 12:39:40 +02:00
miniupnpc_socketdef.h Move common definition to miniupnpc_socketdef.h 2018-07-14 13:39:01 +02:00
miniupnpcmodule.c miniupnpc/miniupnpcmodule.c: small fix 2018-04-26 22:27:05 +02:00
miniupnpcstrings.h.cmake miniupnpc: use #define UPNP_VERSION_STRING "UPnP/1.1" 2014-11-05 06:34:51 +01:00
miniupnpcstrings.h.in miniupnpc: use #define UPNP_VERSION_STRING "UPnP/1.1" 2014-11-05 06:34:51 +01:00
miniupnpctypes.h
miniwget.c When code was updated for 64-bit Windows configurations, some changes were not applied. 2018-07-06 11:35:12 +02:00
miniwget.h miniupnpc: use SOCKET type instead of int for copilation under Win64 2018-04-06 12:21:36 +02:00
miniwget_private.h miniupnpc: use SOCKET type instead of int for copilation under Win64 2018-04-06 12:21:36 +02:00
minixml.c minixml.c: fix heap buffer overflow 2017-12-11 14:59:29 +01:00
minixml.h When code was updated for 64-bit Windows configurations, some changes were not applied. 2018-07-06 11:35:12 +02:00
minixmlvalid.c Check malloc/calloc return values 2015-07-15 18:10:10 +02:00
portlistingparse.c miniupnpc: update Changelog.txt and 2015=>2016 2016-12-16 09:59:10 +01:00
portlistingparse.h miniupnpc: renamed declspec.h in order to avoid conflicts 2015-07-21 12:39:40 +02:00
pymoduletest.py Update file headers. 2017 => 2018 etc. 2018-01-16 02:06:46 +01:00
pymoduletest3.py fix typo 2018-01-09 09:33:31 +08:00
receivedata.c miniupnpc: use SOCKET type instead of int for copilation under Win64 2018-04-06 12:21:36 +02:00
receivedata.h miniupnpc: use SOCKET type instead of int for copilation under Win64 2018-04-06 12:21:36 +02:00
setup.py allow setup.py to call another make executable that 'make' 2017-07-19 19:44:30 +02:00
setupmingw32.py chmod +x setup*.py 2015-10-25 19:52:54 +01:00
testigddescparse.c miniupnpc: mem leaks fixes. 2015-07-30 01:10:03 +02:00
testminiwget.c Update file headers. 2017 => 2018 etc. 2018-01-16 02:06:46 +01:00
testminiwget.sh Update file headers. 2017 => 2018 etc. 2018-01-16 02:06:46 +01:00
testminixml.c igd_desc_parse.c: define printIGD() only in DEBUG 2014-11-17 20:32:41 +01:00
testportlistingparse.c miniupnpc: remove bsdqueue.h 2014-11-01 11:41:31 +01:00
testupnpigd.py Add python 3 compatibility to IGD test 2016-10-11 21:14:04 +02:00
testupnpreplyparse.c miniupnpc: improve testupnpreplyparse 2017-12-12 11:07:09 +01:00
testupnpreplyparse.sh
updateminiupnpcstrings.sh
upnpc.c miniupnpc/upnpc.c: 2017=>2018 2018-04-20 16:34:42 +02:00
upnpcommands.c When code was updated for 64-bit Windows configurations, some changes were not applied. 2018-07-06 11:35:12 +02:00
upnpcommands.h When code was updated for 64-bit Windows configurations, some changes were not applied. 2018-07-06 11:35:12 +02:00
upnpdev.c miniupnpc: update Changelog / dependencies / comments 2015-08-28 14:23:38 +02:00
upnpdev.h miniupnpc: increments API_VERSION to 17 2018-04-06 12:48:24 +02:00
upnperrors.c Add support for IGD2 AddAnyPortMapping and DeletePortMappingRange 2014-05-13 21:50:07 +01:00
upnperrors.h miniupnpc: renamed declspec.h in order to avoid conflicts 2015-07-21 12:39:40 +02:00
upnpreplyparse.c upnpreplyparse.c: NameValueParserEndElt() rename arg to avoid confusion 2017-12-12 12:21:38 +01:00
upnpreplyparse.h remove need of sys/queue.h or bsdqueue.h in upnpreplyparse.c/.h 2014-10-27 17:38:26 +01:00
wingenminiupnpcstrings.c fix realloc failure issues detected thanks to cppcheck 2015-02-08 10:23:22 +01:00

README

Project: miniupnp
Project web page: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
github: https://github.com/miniupnp/miniupnp
Author: Thomas Bernard
Copyright (c) 2005-2017 Thomas Bernard
This software is subject to the conditions detailed in the
LICENSE file provided within this distribution.


* miniUPnP Client - miniUPnPc *

To compile, simply run 'gmake' (could be 'make' on your system).
Under win32, to compile with MinGW, type "mingw32make.bat".
MS Visual C solution and project files are supplied in the msvc/ subdirectory.

The compilation is known to work under linux, FreeBSD,
OpenBSD, MacOS X, AmigaOS and cygwin.
The official AmigaOS4.1 SDK was used for AmigaOS4 and GeekGadgets for AmigaOS3.
upx (http://upx.sourceforge.net) is used to compress the win32 .exe files.

To install the library and headers on the system use :
> su
> make install
> exit

alternatively, to install into a specific location, use :
> INSTALLPREFIX=/usr/local make install

upnpc.c is a sample client using the libminiupnpc.
To use the libminiupnpc in your application, link it with
libminiupnpc.a (or .so) and use the following functions found in miniupnpc.h,
upnpcommands.h and miniwget.h :
- upnpDiscover()
- UPNP_GetValidIGD()
- miniwget()
- parserootdesc()
- GetUPNPUrls()
- UPNP_* (calling UPNP methods)

Note : use #include <miniupnpc/miniupnpc.h> etc... for the includes
and -lminiupnpc for the link

Discovery process is speeded up when MiniSSDPd is running on the machine.


* Python module *

you can build a python module with 'make pythonmodule'
and install it with 'make installpythonmodule'.
setup.py (and setupmingw32.py) are included in the distribution.


Feel free to contact me if you have any problem :
e-mail : miniupnp@free.fr

If you are using libminiupnpc in your application, please
send me an email !

For any question, you can use the web forum :
https://miniupnp.tuxfamily.org/forum/

Bugs should be reported on github :
https://github.com/miniupnp/miniupnp/issues

* Linux firewall configuration for UPnP clients *

Due to how UPnP protocol is designed, unicast responses to UPnP multicast client
requests are not tracked by Linux netfilter. And therefore netfilter executes
default action for them (which is in most cases DROP response packet).

To workaround this limitation, custom ipset hash table can be used. It is
supported since Linux kernel >= 2.6.39.

Rules for IPv4:
$ ipset create upnp hash:ip,port timeout 3
$ iptables -A OUTPUT -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j SET --add-set upnp src,src --exist
$ iptables -A INPUT -p udp -m set --match-set upnp dst,dst -j ACCEPT
$ iptables -A INPUT -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j ACCEPT

Rules for IPv6:
$ ipset create upnp6 hash:ip,port timeout 3 family inet6
$ ip6tables -A OUTPUT -d ff02::c/128 -p udp -m udp --dport 1900 -j SET --add-set upnp6 src,src --exist
$ ip6tables -A OUTPUT -d ff05::c/128 -p udp -m udp --dport 1900 -j SET --add-set upnp6 src,src --exist
$ ip6tables -A INPUT -p udp -m set --match-set upnp6 dst,dst -j ACCEPT
$ ip6tables -A INPUT -d ff02::c/128 -p udp -m udp --dport 1900 -j ACCEPT
$ ip6tables -A INPUT -d ff05::c/128 -p udp -m udp --dport 1900 -j ACCEPT

Detailed description is available on:
https://serverfault.com/a/911286
https://unix.stackexchange.com/a/444804