Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2011 13:30:17 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228574 - in head: sbin/ifconfig sys/netinet
Message-ID:  <201112161330.pBGDUH5W008716@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Dec 16 13:30:17 2011
New Revision: 228574
URL: http://svn.freebsd.org/changeset/base/228574

Log:
  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.

Modified:
  head/sbin/ifconfig/af_inet.c
  head/sys/netinet/in.c

Modified: head/sbin/ifconfig/af_inet.c
==============================================================================
--- head/sbin/ifconfig/af_inet.c	Fri Dec 16 12:53:15 2011	(r228573)
+++ head/sbin/ifconfig/af_inet.c	Fri Dec 16 13:30:17 2011	(r228574)
@@ -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);

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Fri Dec 16 12:53:15 2011	(r228573)
+++ head/sys/netinet/in.c	Fri Dec 16 13:30:17 2011	(r228574)
@@ -253,16 +253,10 @@ in_control(struct socket *so, u_long cmd
 		    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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112161330.pBGDUH5W008716>