From 92ed4e1a244dc14ab9854b950076f24ed015ea8d Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 16 Dec 2011 13:30:17 +0000 Subject: [PATCH] Since size of struct in_aliasreq has just been changed in r228571, and thus ifconfig(8) needs recompile, it is a good chance to make parameter checks on SIOCAIFADDR arguments more strict. --- sbin/ifconfig/af_inet.c | 1 + sys/netinet/in.c | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sbin/ifconfig/af_inet.c b/sbin/ifconfig/af_inet.c index bcd17c4f4957..c73337374be4 100644 --- a/sbin/ifconfig/af_inet.c +++ b/sbin/ifconfig/af_inet.c @@ -126,6 +126,7 @@ in_getaddr(const char *s, int which) *p = '/'; errx(1, "%s: bad value (width %s)", s, errstr); } + min->sin_family = AF_INET; min->sin_len = sizeof(*min); min->sin_addr.s_addr = htonl(~((1LL << (32 - masklen)) - 1) & 0xffffffff); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 7e9b1ed91a59..e0b3efaf9e0f 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -253,16 +253,10 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, sizeof(struct sockaddr_in) || ifra->ifra_broadaddr.sin_family != AF_INET)) return (EINVAL); -#if 0 - /* - * ifconfig(8) historically doesn't set af_family for mask - * for unknown reason. - */ if (ifra->ifra_mask.sin_len != 0 && (ifra->ifra_mask.sin_len != sizeof(struct sockaddr_in) || ifra->ifra_mask.sin_family != AF_INET)) return (EINVAL); -#endif break; case SIOCSIFADDR: case SIOCSIFBRDADDR: