mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04: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: 7e5bf68495 netlink: add netlink support
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D49226
This commit is contained in:
parent
5d8b48487a
commit
0e096bb3fc
1 changed files with 2 additions and 2 deletions
|
|
@ -818,9 +818,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…
Reference in a new issue