mirror of
https://github.com/opnsense/src.git
synced 2026-02-04 03:00:53 -06:00
netlink: Fix getting route scope of interface's IPv4 addresses
sin_addr of a `struct sockaddr_in` is stored in network byte order, but IN_LOOPBACK() and IN_LINKLOCAL() want the host order. Reviewed by: melifaro, #network Fixes: 7e5bf68495cc netlink: add netlink support MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49226 (cherry picked from commit 0e096bb3fcaaf663df372aa4abb986e8d63c6e68)
This commit is contained in:
parent
2a564b0b65
commit
02a79c4a32
@ -816,9 +816,9 @@ ifa_get_scope(const struct ifaddr *ifa)
|
||||
{
|
||||
struct in_addr addr;
|
||||
addr = ((const struct sockaddr_in *)sa)->sin_addr;
|
||||
if (IN_LOOPBACK(addr.s_addr))
|
||||
if (IN_LOOPBACK(ntohl(addr.s_addr)))
|
||||
addr_scope = RT_SCOPE_HOST;
|
||||
else if (IN_LINKLOCAL(addr.s_addr))
|
||||
else if (IN_LINKLOCAL(ntohl(addr.s_addr)))
|
||||
addr_scope = RT_SCOPE_LINK;
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user