Commit Graph

90 Commits

Author SHA1 Message Date
Thomas Bernard 0c556655ea
Move addr_is_reserved() to a specific source file and test it 2020-09-24 09:57:25 +02:00
Pali Rohár 96aa863c78 Fix check for reserved IP addresses in miniupnpc
Check for 0.0.0.0, 192.168., 10. and 172. is not enough. Nowadays routers
behind NAT are getting IP address from shared CG-NAT space 100.64.0.0/10.

This patch adjust miniupnpc to check for all reserved IPv4 addresses.
2020-08-05 16:26:26 +02:00
Thomas Bernard c2818392e1 fix UPNP_GetValidIGD()
lanaddr was the one used to connect to the last device.
fixes #396
2019-10-13 19:58:52 +02:00
Thomas Bernard f3a567cedf
best way to test for integer in [16;31] 2019-04-23 14:19:31 +02:00
Thomas Bernard 422d42357e
use strncmp() instead of memcmp() when needed
memcmp(s1, s2, l) is valid when both s1 and s2
have at least l bytes acccessible. So
memcmp("a", "abcdefgh", 8)
is not valid

see #362
2019-04-23 14:16:25 +02:00
irwir bded13f390 When code was updated for 64-bit Windows configurations, some changes were not applied.
Details :
  cast for connect() sendto() arguments
  remove unecessary p = NULL;
  remove unecessary code
  printf format fixes in ssdpDiscoverDevices()

fixes #311

Signed-off-by: Thomas Bernard <miniupnp@free.fr>
2018-07-06 11:35:12 +02:00
Thomas Bernard 284db0bb49 miniupnpc: use SOCKET type instead of int for copilation under Win64
see #289
2018-04-06 12:21:36 +02:00
Thomas Bernard ce2673118d miniupnpc: disable call to MiniSSDPd when -m option is used
fixes #269
2018-02-22 15:58:25 +01:00
Thomas Bernard 718deea11e Update file headers. 2017 => 2018 etc. 2018-01-16 02:06:46 +01:00
yangfl d492fa39ef fix typo 2018-01-09 09:33:31 +08:00
Thomas Bernard c4991916e5 miniupnpc: change miniwget to return HTTP status code
increments API_VERSION to 16
2016-01-24 18:30:41 +01:00
Thomas Bernard d274456d07 UPNP_GetValidIGD() checks external ip address = 0.0.0.0
(or empty string)
2016-01-24 17:38:40 +01:00
Thomas Bernard d1243e157d parse HTTP response status line in miniwget.c 2016-01-22 16:53:19 +01:00
Thomas Bernard 99c7aeef4d Improve UPNPIGD_IsConnected() to check if WAN address is not private. 2016-01-22 15:22:01 +01:00
Thomas Bernard 2e30127cee 2016 ! 2016-01-17 19:36:29 +01:00
Thomas Bernard 6e8fda2358 fix previous commit 53804c3db
allow calling UPNP_GetValidIGD() with lanaddr=NULL
2015-12-11 17:48:43 +01:00
Denis Leroy 53804c3db3 Fix bug in returning IGD LAN address 2015-12-11 16:59:38 +01:00
Thomas Bernard 06417600f8 miniupnpc.c: simpleUPnPcommand2() C++ => C comments
also reindentation, move declaration of soapbodylen up
vim stuff :)
2015-10-26 11:44:40 +01:00
Wladimir J. van der Laan fb02299fff More accurate checking while writing buffer in simpleUPnPcommand2
Account exactly for bytes when building buffer in simpleUPnPcommand2.
The margin of 100 is not guaranteed to always be enough. When long
parameters are passed in, it was possible to overflow the buffer.
2015-10-25 21:48:00 +01:00
Wladimir J. van der Laan 4c90b87ce3 Check snprintf result
Verify that the buffer size was large enough to write the output,
raise an error condition if not.
2015-10-25 21:13:23 +01:00
Thomas Bernard d4af610c51 Merge branch 'master' into local_port
Conflicts:
	miniupnpc/miniupnpc.c
	miniupnpc/miniupnpc.h
	miniupnpc/miniupnpcmodule.c
	miniupnpc/upnpc.c
2015-10-08 17:42:45 +02:00
Thomas Bernard e1344f74aa removed unused variable under win32 2015-09-16 00:12:35 +02:00
Thomas Bernard 46f4679508 miniupnpc.c: clean #define's 2015-09-04 17:37:11 +02:00
Thomas Bernard 2400d2f8d2 Merge branch 'refact_ssdpc'
Conflicts:
	miniupnpc/miniupnpc.c

was because of aba8c3f3d7
2015-08-27 22:29:53 +02:00
Thomas Bernard d0c8154d74 miniupnpc.c: add minissdpd and discovered devices list 2015-08-27 22:22:35 +02:00
Thomas Bernard aba8c3f3d7 miniupnpc.c: use unsigned long for IP_MULTICAST_TTL with win32
fixes 1da63faa4f for win32
2015-08-26 18:47:27 +02:00
Thomas Bernard fd8e8e7593 miniupnpc: Also accept "Up" as ConnectionStatus value 2015-08-16 22:10:48 +02:00
Konstantin Tokarev 353f101655 Moved SSDP discovery code into minissdpc.c 2015-08-03 20:09:26 +03:00
Konstantin Tokarev fd65c0a9df Moved UPNPDev definition to separate header. 2015-08-03 20:09:26 +03:00
Thomas Bernard 1da63faa4f miniupnpc: add ttl argument to upnpDiscover() functions
increments API_VERSION to 14
2015-07-23 22:44:37 +02:00
Konstantin Tokarev cffba15387 Split getDevicesFromMiniSSDPD into 4 steps to allow reuse of local socket.
It allows allows client application to use event loop instead of blocking
in read() while waiting for server reply.
2015-07-23 16:22:23 +03:00
Konstantin Tokarev 2c56ffceeb Fixed typo in setsockopt invocation which sets TTL. 2015-07-23 12:40:42 +03:00
Thomas Bernard af2ec81f14 Merge branch 'read_usn' 2015-07-22 23:50:44 +02:00
Thomas Bernard 963eefcae5 miniupnpc.c: dont break if USN is not set
USN is mandatory, but don't break if the packet don't follow the standard and misses USN: header
2015-07-22 23:46:44 +02:00
Thomas Bernard 151b16a1ed miniupnpc.c: set multicast TTL to 2 by default 2015-07-22 15:00:01 +02:00
Konstantin Tokarev eb74f5c886 Read USN from SSDP messages. 2015-07-22 12:08:52 +03:00
Thomas Bernard e0999ace78 miniupnpc: Check malloc/calloc return values
fixes #136
2015-07-15 14:48:57 +02:00
Thomas Bernard 27e2aa3841 miniupnpc: update getDevicesFromMiniSSDPD() to process longer minissdpd responses 2015-06-16 17:33:59 +02:00
Thomas Bernard eec3f12012 miniupnpc: minor code/comments modifications 2015-06-11 14:28:35 +02:00
Thomas Bernard 76f52c81de fixes 5c6a140098 2015-06-09 17:20:30 +02:00
Thomas Bernard a2adfcd05d miniupnpc/miniupnpc.c: don't wait several times for the timeout in upnpDiscoverDevices() 2015-05-22 12:44:38 +02:00
Thomas Bernard 0bf168d306 miniupnpc.c: minor comment reformatting 2015-05-22 12:27:38 +02:00
Thomas Bernard 5c6a140098 miniupnpc: add searchalltypes param to upnpDiscoverDevices()
increase API_VERSION to 13
2015-05-22 12:25:51 +02:00
Nevo Hed 94a5af0c15 Allow user to explicitly specify local (source) port
See https://github.com/miniupnp/miniupnp/issues/119

- Replace the sameport parameter to the upnpDiscover* functions
- Added constants UPNP_LOCAL_PORT_ANY(0) & UPNP_LOCAL_PORT_SAME(1).  The
  value "1" was chosen for presumed backwards compatability with the
  previous "sameport" parameter (assuming usesr would have set to 1 if
  they wanted same port)
- Can be specified with "-z" to the test programs "upnpc" & "pymoduletest.py"
2015-05-12 19:05:48 -04:00
Maks Naumov 81dc08d290 Fix setsockopt() for IPV6_MULTICAST_IF
32bit: sizeof(&ifindex) == sizeof(void *) == 4
64bit: sizeof(&ifindex) == sizeof(void *) == 8

As a result, it is "ifindex" oob acces on 64bit platforms.
2015-01-21 16:44:36 +01:00
Thomas Bernard c72591e72e miniupnpc/miniupnpc.c: fix compilation under WIN32 2014-12-01 10:31:50 +01:00
Thomas Bernard 4cae31c948 miniupnpc.c: dont use if_indextoname() under MS Windows
fixes #85
2014-11-27 12:59:12 +01:00
Thomas Bernard 3690785a79 miniupnpc/miniupnpc.c: accept all versions of urn:schemas-upnp-org:service:WANCommonInterfaceConfig: service 2014-11-18 00:01:48 +01:00
Thomas Bernard 04b7126079 miniupnpc: fix LIBSPEC => MINIUPNP_LIBSPEC 2014-11-13 11:05:09 +01:00
Thomas Bernard 9325bacbfc Merge branch 'master' into search_all
Conflicts:
	miniupnpc/.gitignore
	miniupnpc/Makefile
	miniupnpc/miniupnpc.c
2014-11-13 11:02:28 +01:00