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
..
2020-05-10 20:00:37 +02:00
2016-11-11 09:42:22 -05:00
2020-10-17 22:55:12 +02:00
2020-11-11 13:16:14 +01:00
2017-11-02 16:52:07 +01:00
2022-01-23 01:19:01 +01:00
2015-07-15 18:11:27 +02:00
2021-12-02 00:06:24 +01:00
2018-04-20 17:19:52 +02:00
2018-07-06 14:16:49 +02:00
2022-01-23 01:18:49 +01:00
2022-01-23 01:18:49 +01:00
2020-05-02 18:26:45 +02:00
2012-02-03 13:18:30 +01:00
2020-04-29 00:03:54 +02:00
2017-12-11 14:59:29 +01:00
2019-02-10 16:10:07 +01:00
2019-09-24 16:05:44 +02:00
2020-05-07 00:34:44 +02:00
2015-09-22 10:24:47 +02:00
2021-08-21 10:22:26 +02:00
2020-11-04 22:31:47 +01:00
2022-01-23 01:18:49 +01:00
2012-05-31 15:22:52 +02:00
2016-02-12 15:02:06 +01:00
2019-09-24 16:06:12 +02:00
2017-11-02 16:52:07 +01:00
2021-08-18 11:06:12 +01:00
2021-08-18 11:06:12 +01:00
2020-10-30 22:44:02 +01:00
2020-10-30 22:44:02 +01:00
2021-08-21 10:14:28 +02:00
2021-08-21 10:14:28 +02:00
2020-11-12 08:59:47 +01:00
2022-01-23 01:25:49 +01:00

MiniUPnP project
(c) 2006-2022 Thomas Bernard
webpage: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
github: https://github.com/miniupnp/miniupnp
freecode: http://freecode.com/projects/miniupnp
contact: miniupnp@free.fr

This directory contain the miniUPnP daemon software, aka miniUPnPd.
This software is subject to the conditions detailed in
the LICENSE file provided with this distribution.


The miniUPnP daemon is an UPnP IGD (internet gateway device)
which provide NAT traversal services to any UPnP enabled client on
the network.
See http://www.upnp.org/ for more details on UPnP.
During the year 2011, support for IGD v2 has been added.
In 2012, IGD v2 WANIPv6FirewallControl has been implemented.

IGD2 is still not enabled by default because of interoperability
issues.

In addition to UPnP IGD, miniUPnPd supports NAT-PMP and PCP :

See information about NAT Port Mapping Protocol (NAT-PMP) here :
http://miniupnp.free.fr/nat-pmp.html
NAT-PMP is the precursor of Port Control Protocol (PCP, RFC 6887).
In 2013, support for PCP has been added too.

Read the INSTALL file for instructions to compile, install and
configure miniupnpd on your system.

Report bugs to miniupnp@free.fr or on the web forum
https://miniupnp.tuxfamily.org/forum/
or using https://github.com/miniupnp/miniupnp/issues

Thomas Bernard