README
1Project: miniupnp
2Project web page: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
3github: https://github.com/miniupnp/miniupnp
4Author: Thomas Bernard
5Copyright (c) 2005-2020 Thomas Bernard
6This software is subject to the conditions detailed in the
7LICENSE file provided within this distribution.
8
9
10* miniUPnP Client - miniUPnPc *
11
12To compile, simply run 'gmake' (could be 'make' on your system).
13Under win32, to compile with MinGW, type "mingw32make.bat".
14MS Visual C solution and project files are supplied in the msvc/ subdirectory.
15The miniupnpc library is available as a static library or as a DLL :
16define MINIUPNP_STATICLIB if you want to link against the static library.
17
18The compilation is known to work under linux, FreeBSD,
19OpenBSD, MacOS X, AmigaOS and cygwin.
20The official AmigaOS4.1 SDK was used for AmigaOS4 and GeekGadgets for AmigaOS3.
21upx (http://upx.sourceforge.net) is used to compress the win32 .exe files.
22
23To install the library and headers on the system use :
24> su
25> make install
26> exit
27
28alternatively, to install into a specific location, use :
29> INSTALLPREFIX=/usr/local make install
30
31upnpc.c is a sample client using the libminiupnpc.
32To use the libminiupnpc in your application, link it with
33libminiupnpc.a (or .so) and use the following functions found in miniupnpc.h,
34upnpcommands.h and miniwget.h :
35- upnpDiscover()
36- UPNP_GetValidIGD()
37- miniwget()
38- parserootdesc()
39- GetUPNPUrls()
40- UPNP_* (calling UPNP methods)
41
42Note : use #include <miniupnpc/miniupnpc.h> etc... for the includes
43and -lminiupnpc for the link
44
45Discovery process is speeded up when MiniSSDPd is running on the machine.
46
47
48* Python module *
49
50you can build a python module with 'make pythonmodule'
51and install it with 'make installpythonmodule'.
52setup.py (and setupmingw32.py) are included in the distribution.
53
54
55Feel free to contact me if you have any problem :
56e-mail : miniupnp@free.fr
57
58If you are using libminiupnpc in your application, please
59send me an email !
60
61For any question, you can use the web forum :
62https://miniupnp.tuxfamily.org/forum/
63
64Bugs should be reported on github :
65https://github.com/miniupnp/miniupnp/issues
66
67* Linux firewall configuration for UPnP clients *
68
69Due to how UPnP protocol is designed, unicast responses to UPnP multicast client
70requests are not tracked by Linux netfilter. And therefore netfilter executes
71default action for them (which is in most cases DROP response packet).
72
73To workaround this limitation, custom ipset hash table can be used. It is
74supported since Linux kernel >= 2.6.39.
75
76Rules for IPv4:
77$ ipset create upnp hash:ip,port timeout 3
78$ iptables -A OUTPUT -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j SET --add-set upnp src,src --exist
79$ iptables -A INPUT -p udp -m set --match-set upnp dst,dst -j ACCEPT
80$ iptables -A INPUT -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j ACCEPT
81
82Rules for IPv6:
83$ ipset create upnp6 hash:ip,port timeout 3 family inet6
84$ ip6tables -A OUTPUT -d ff02::c/128 -p udp -m udp --dport 1900 -j SET --add-set upnp6 src,src --exist
85$ ip6tables -A OUTPUT -d ff05::c/128 -p udp -m udp --dport 1900 -j SET --add-set upnp6 src,src --exist
86$ ip6tables -A INPUT -p udp -m set --match-set upnp6 dst,dst -j ACCEPT
87$ ip6tables -A INPUT -d ff02::c/128 -p udp -m udp --dport 1900 -j ACCEPT
88$ ip6tables -A INPUT -d ff05::c/128 -p udp -m udp --dport 1900 -j ACCEPT
89
90Detailed description is available on:
91https://serverfault.com/a/911286
92https://unix.stackexchange.com/a/444804
93