Download raw body.
ia_sockmask.sin_family is not set correctly
Hi @tech,
While working on a cross platform codebase that calls getifaddrs(3),
I noticed that unlike Darwin and Linux, on OpenBSD, the sin_family
value isn't set on the returned ifa_netmask structure, for ipv4 addresses.
While some SIOCAIFADDR callers set this value correctly (e.g., dhcpleased(8)),
others don't (e.g., ifconfig(8)). Either way, it is ignored by in_ioctl_change_ifaddr().
Since this is an ipv4 only path, it seems reasonable to just set it to the correct
value in in_ioctl_change_ifaddr().
---
Ido
diff --git sys/netinet/in.c sys/netinet/in.c
index 4edd8573071..d5c57d9feda 100644
--- sys/netinet/in.c
+++ sys/netinet/in.c
@@ -503,6 +503,7 @@ in_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp)
}
if (masksin != NULL) {
in_ifscrub(ifp, ia);
+ ia->ia_sockmask.sin_family = AF_INET;
ia->ia_netmask = ia->ia_sockmask.sin_addr.s_addr =
masksin->sin_addr.s_addr;
needinit = 1;
ia_sockmask.sin_family is not set correctly