Merge branch '731-ipv6-routable-address'

fixes #731
This commit is contained in:
Thomas Bernard 2024-05-30 01:21:09 +02:00
commit fbe0b19dcb
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,8 @@
$Id: Changelog.txt,v 1.515 2024/03/19 23:40:30 nanard Exp $ $Id: Changelog.txt,v 1.515 2024/03/19 23:40:30 nanard Exp $
2024/04/29:
ipv6: prefer globally routable addresses
VERSION 2.3.6 : released on 2024/03/20 VERSION 2.3.6 : released on 2024/03/20
2024/03/05: 2024/03/05:

View File

@ -2,7 +2,7 @@
/* vim: tabstop=4 shiftwidth=4 noexpandtab /* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project * MiniUPnP project
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
* (c) 2006-2023 Thomas Bernard * (c) 2006-2024 Thomas Bernard
* This software is subject to the conditions detailed * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -264,7 +264,10 @@ find_ipv6_addr(const char * ifname,
{ {
addr = (const struct sockaddr_in6 *)ife->ifa_addr; addr = (const struct sockaddr_in6 *)ife->ifa_addr;
if(!IN6_IS_ADDR_LOOPBACK(&addr->sin6_addr) if(!IN6_IS_ADDR_LOOPBACK(&addr->sin6_addr)
&& !IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) && !IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)
/* RFC4193 "Unique Local IPv6 Unicast Addresses" only if no
* other address found */
&& (r == 0 || (addr->sin6_addr.s6_addr[0] & 0xfe) != 0xfc))
{ {
inet_ntop(ife->ifa_addr->sa_family, inet_ntop(ife->ifa_addr->sa_family,
&addr->sin6_addr, &addr->sin6_addr,