summaryrefslogtreecommitdiff
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2019-12-01 21:12:43 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2019-12-01 21:12:43 +0000
commitfe7e798365c6e9dd1e199304e9028630af4b29a8 (patch)
tree42382df00986e5786d3743f6eb58b60b0078c330 /sys/netinet/in.c
parent82bc115890ebf1aa532a8a1adaa3822781a478fd (diff)
Don't require a valid sa_len for a bunch of IPv4 "get" ioctls
Same fix as for the IPv6 case. Fixes a regression in ports/net/openvpn spotted by landry@, ok bluhm@
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 149aa3564d6..85116527742 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.167 2019/11/28 00:50:41 bluhm Exp $ */
+/* $OpenBSD: in.c,v 1.168 2019/12/01 21:12:42 jca Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -557,11 +557,14 @@ in_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp)
struct ifreq *ifr = (struct ifreq *)data;
struct ifaddr *ifa;
struct in_ifaddr *ia = NULL;
+ struct sockaddr *sa;
struct sockaddr_in *sin = NULL;
int error = 0;
- if (ifr->ifr_addr.sa_family == AF_INET) {
- error = in_sa2sin(&ifr->ifr_addr, &sin);
+ sa = &ifr->ifr_addr;
+ if (sa->sa_family == AF_INET) {
+ sa->sa_len = sizeof(struct sockaddr_in);
+ error = in_sa2sin(sa, &sin);
if (error)
return (error);
}