miniupnp/miniupnpc
Thomas Bernard 0a9750602d Merge branch 'win32_snprintf' 2020-11-04 23:40:37 +01: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 win32_snprintf.h 2020-11-04 23:37:07 +01: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 Move addr_is_reserved() to a specific source file and test it 2020-09-24 09:57:25 +02:00
CMakeLists.txt Fix solaris build 2020-10-07 00:17:16 +02:00
Changelog.txt update Changelog 2020-09-28 23:25:23 +02:00
LICENSE 2019 => 2020 2020-10-31 11:36:06 +01:00
MANIFEST.in cli:py: do not ship binaries in sdist 2017-08-25 16:06:26 +02:00
Makefile Fix solaris build 2020-10-07 00:17:16 +02:00
Makefile.mingw Move addr_is_reserved() to a specific source file and test it 2020-09-24 09:57:25 +02:00
README Update Changelogs + 2019 2019-02-10 16:11:16 +01:00
VERSION miniupnpc: VERSION 2.1 2018-05-07 13:12:58 +02:00
addr_is_reserved.c miniupnpc/addr_is_reserved.c: include sys/types.h 2020-10-17 22:13:32 +02:00
addr_is_reserved.h Move addr_is_reserved() to a specific source file and test it 2020-09-24 09:57:25 +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 Fix snprintf emulation for Windows 2020-10-18 20:29:53 +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 Added miniupnpc 2011-09-27 22:25:35 +02:00
minihttptestserver.c check for malformed HTTP response 2020-09-28 23:23:17 +02:00
minisoap.c Fix snprintf emulation for Windows 2020-10-18 20:29:53 +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 Fix snprintf emulation for Windows 2020-10-18 20:29:53 +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 Fix snprintf emulation for Windows 2020-10-18 20:29:53 +02:00
miniupnpc.def Fix and simplify Makefile.mingw for miniupnpc 2020-04-02 18:45:46 +02: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 initialize tp_free 2020-06-05 21:13:19 +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 Rename all include guards to not clash with C99 (7.1.3 Reserved identifiers). 2012-09-20 17:52:51 -03:00
miniwget.c Fix snprintf emulation for Windows 2020-10-18 20:29:53 +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 Haiku support 2020-02-20 09:03:53 +01:00
portlistingparse.h miniupnpc: renamed declspec.h in order to avoid conflicts 2015-07-21 12:39:40 +02:00
pymoduletest.py miniupnpc: update *.py files headers 2020-04-06 12:25:34 +02: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 miniupnpc: update *.py files headers 2020-04-06 12:25:34 +02:00
setupmingw32.py miniupnpc: Fix name of miniupnpc import library in setupmingw32.py 2020-10-02 22:52:26 +02:00
testaddr_is_reserved.c Move addr_is_reserved() to a specific source file and test it 2020-09-24 09:57:25 +02:00
testigddescparse.c Make testigddescparse work under Win32 2018-09-02 18:50:58 +02:00
testminiwget.c Update file headers. 2017 => 2018 etc. 2018-01-16 02:06:46 +01:00
testminiwget.sh check for malformed HTTP response 2020-09-28 23:23:17 +02: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 miniupnpc: update *.py files headers 2020-04-06 12:25:34 +02:00
testupnpreplyparse.c miniupnpc: improve testupnpreplyparse 2017-12-12 11:07:09 +01:00
testupnpreplyparse.sh miniupnpc: validate upnpreplyparse.c code with "make check" 2013-05-14 23:09:42 +02:00
updateminiupnpcstrings.sh Added miniupnpc 2011-09-27 22:25:35 +02:00
upnpc.c Fix snprintf emulation for Windows 2020-10-18 20:29:53 +02:00
upnpcommands.c upnpcommands.c: restrict scope of variable p 2019-04-23 14:18:23 +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: use C99 flexible array member for struct UPNPDev 2020-05-29 17:59:38 +02:00
upnperrors.c upnperrors.c: update url and add vim modeline 2019-08-24 10:51:27 +02:00
upnperrors.h miniupnpc: renamed declspec.h in order to avoid conflicts 2015-07-21 12:39:40 +02:00
upnpreplyparse.c upnpreplyparse.c: Fix memory leak 2019-04-05 10:30:10 +02:00
upnpreplyparse.h remove need of sys/queue.h or bsdqueue.h in upnpreplyparse.c/.h 2014-10-27 17:38:26 +01:00
win32_snprintf.h Fix snprintf emulation for Windows 2020-10-18 20:29:53 +02: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-2019 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 miniupnpc library is available as a static library or as a DLL :
define MINIUPNP_STATICLIB if you want to link against the static library.

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