Commit Graph

25 Commits

Author SHA1 Message Date
Thomas Bernard 65ad337f70
miniupnpd: find_ipv6_addr() avoid fc00::/7 if possible
fc00::/7 = RFC4193 Unique Local IPv6 Unicast Addresses
2024-04-29 01:21:09 +02:00
Thomas Bernard 096478dce1 fix getifaddr() error case
see #670
2023-11-14 21:15:58 +01:00
Thomas Bernard 5231397bd6
update Changelog and comments about commit 9500253 2022-02-19 20:03:30 +01:00
Jo-Philipp Wich 95002535b3 getifaddr.c: prefer non-reserved over reserved addresses in `getifaddr()`
When iterating interface addresses obtained via `getifaddrs()`, don't
stop at the first found IPv4 address but continue checking all IPv4
addresses and prefer to use a non-reserved one in case an interface
has both reserved (private) and non-reserved (public) addresses
assigned.

After this fix, miniupnpd on OpenWrt is able to properly detect the
external IP address of an external interface with both a private
RFC1918 and a public IP assigned regardless of whether `getifaddrs()`
happens to return the private or the public IPv4 address first.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-02-16 17:58:42 +01:00
Pali Rohár dbb821a7c9 getifaddr.c: Fix mask for RFC7534 Direct Delegation AS112 Service 2020-07-12 13:45:30 +02:00
Thomas Bernard 585a1d64e2
getifaddr.c: properly use strncpy()
silent a gcc8 warning
2019-05-20 21:55:17 +02:00
Thomas Bernard 8c91ff515e reserved[] is const 2018-07-06 13:20:30 +02:00
Pali Rohár c35935c61d miniupnpd: Add function addr_is_reserved() to check if address is private/reserved and therefore not for public port forwarding 2018-05-19 13:31:14 +02:00
Chocobo1 61289d42fb Correctly terminate the string 2015-06-24 16:24:01 +08:00
Thomas Bernard 98109ea92e miniupnpd/getifaddr.c: fix when IPV6 is not enabled 2014-05-06 15:15:07 +02:00
Markus Stenberg 338a533a09 miniupnpd/pcpserver.c: Preliminary work for PCP fw control
Added preliminary is_fw flag, and added af to getifaddr_in6. Made
option parsing follow the RFC and also made it bit more paranoid
(there were some security problems with length checks not being done
at right place all the time; simplified flow, should be easier to
verify now that it does nothing untoward).
2014-05-06 15:12:42 +02:00
Thomas Bernard f789a3bab7 miniupnpd/getifaddr.c: check if interface is up 2014-04-11 00:03:13 +02:00
Thomas Bernard 7cb493919f miniupnpd/getifaddr.c: don't use getifaddrs() in IPv4 only
should fix #62 :
Don't use getifaddrs() in IPv4 only
so we avoid problems if getifaddrs() implementation is buggy
2014-03-14 10:04:49 +01:00
Thomas Bernard 3ed3478398 miniupnpd/getifaddr.c: clean up and fix getifaddr_in6() 2014-03-13 10:42:07 +01:00
Thomas Bernard 81fa1bcd57 miniupnpd/getifaddr.c: getifaddr_in6() only return IPv4 address when IPV6 disabled
see if it can help for issue #62
pcp/CheckAddress() is likely to need more changes.
2014-03-13 10:00:42 +01:00
Thomas Bernard d397d73628 miniupnpd/getifaddr.c: fix getifaddr_in6()
-1 is returned if no address is found
2014-03-13 09:56:34 +01:00
Thomas Bernard 1e08e9ed4d getifaddr: more portable code (works with old OpenBSD) 2013-12-13 16:59:51 +01:00
Peter Tatrai 9e1ffd5cd9 Add initial PCP support 2013-07-11 09:38:55 +02:00
Thomas Bernard 333c28a502 miniupnpd/getifaddr.c: Uses ifr_addr if ifr_netmask is not defined in struct ifreq 2013-04-27 17:51:53 +02:00
Thomas Bernard 961e1c35d3 miniupnpd: autodetect LAN interface netmask instead of defaulting to /24
Fix #23
2013-03-23 11:50:57 +01:00
Shawn Landen 5c224accbf remove trailing whitespace from miniupnpd 2012-02-29 17:48:41 -08:00
Thomas Bernard 8dccc0d419 getifaddr.c: Add missign freeifaddrs() in find_ipv6_addr() 2012-02-09 00:33:06 +01:00
Thomas Bernard c07408ef1f Always #include <netinet/in.h> before #include <arpa/inet.h> (for OpenBSD) 2012-01-20 22:55:43 +01:00
Thomas Bernard 8f68347464 added additional checks on structure returned by getifaddrs() 2012-01-02 11:12:52 +01:00
Thomas Bernard 0d96346588 Adding miniupnpd 2011-09-28 21:13:20 +02:00