miniupnp/miniupnpc
Ștefan Talpalaru c8566d6ebd
strupnperror(): add 2 more error codes
2019-05-03 14:37:02 +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 Update renamed file in MSVC Project (#331) 2018-10-20 08:56:12 +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 remove space at end of line... 2019-04-23 12:56:28 +02:00
Changelog.txt upnpreplyparse.c: Fix memory leak 2019-04-05 10:30:10 +02:00
LICENSE 2019 2019-04-08 14:46:11 +02:00
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 Add wheels as a distribution alternative for Windows builds. 2019-04-25 18:17:27 +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
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 use strncmp() instead of memcmp() when needed 2019-04-23 14:16:25 +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 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 use strncmp() instead of memcmp() when needed 2019-04-23 14:16:25 +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 best way to test for integer in [16;31] 2019-04-23 14:19:31 +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 miniupnpcmodule.c: check return of WSAStartup() 2018-10-31 16:34:00 +01: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 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 Creation a build matrix to support various python versions. 2019-04-25 17:28:49 +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 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 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 2019 2019-04-08 14:46:11 +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: increments API_VERSION to 17 2018-04-06 12:48:24 +02:00
upnperrors.c strupnperror(): add 2 more error codes 2019-05-03 14:37:02 +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
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