From owner-svn-src-stable@FreeBSD.ORG Fri Nov 12 12:00:00 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E92E1065695; Fri, 12 Nov 2010 12:00:00 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3928FC14; Fri, 12 Nov 2010 11:59:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oACBxx6H007624; Fri, 12 Nov 2010 11:59:59 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oACBxx3M007620; Fri, 12 Nov 2010 11:59:59 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201011121159.oACBxx3M007620@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 12 Nov 2010 11:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215175 - in stable/8/sys: net sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 12:00:00 -0000 Author: pluknet Date: Fri Nov 12 11:59:59 2010 New Revision: 215175 URL: http://svn.freebsd.org/changeset/base/215175 Log: MFC r214136: Reshuffle SIOCGIFCONF32 handler. Approved by: kib (mentor) Modified: stable/8/sys/net/if.c stable/8/sys/net/if.h stable/8/sys/sys/sockio.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Fri Nov 12 11:36:12 2010 (r215174) +++ stable/8/sys/net/if.c Fri Nov 12 11:59:59 2010 (r215175) @@ -87,6 +87,11 @@ #include +#ifdef COMPAT_FREEBSD32 +#include +#include +#endif + struct ifindex_entry { struct ifnet *ife_ifnet; }; @@ -2459,6 +2464,17 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, return (error); } +#ifdef COMPAT_FREEBSD32 +struct ifconf32 { + int32_t ifc_len; + union { + uint32_t ifcu_buf; + uint32_t ifcu_req; + } ifc_ifcu; +}; +#define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) +#endif + /* * Interface ioctls. */ @@ -2473,10 +2489,21 @@ ifioctl(struct socket *so, u_long cmd, c switch (cmd) { case SIOCGIFCONF: case OSIOCGIFCONF: -#ifdef __amd64__ + return (ifconf(cmd, data)); + +#ifdef COMPAT_FREEBSD32 case SIOCGIFCONF32: + { + struct ifconf32 *ifc32; + struct ifconf ifc; + + ifc32 = (struct ifconf32 *)data; + ifc.ifc_len = ifc32->ifc_len; + ifc.ifc_buf = PTRIN(ifc32->ifc_buf); + + return (ifconf(SIOCGIFCONF, (void *)&ifc)); + } #endif - return (ifconf(cmd, data)); } ifr = (struct ifreq *)data; @@ -2703,23 +2730,12 @@ static int ifconf(u_long cmd, caddr_t data) { struct ifconf *ifc = (struct ifconf *)data; -#ifdef __amd64__ - struct ifconf32 *ifc32 = (struct ifconf32 *)data; - struct ifconf ifc_swab; -#endif struct ifnet *ifp; struct ifaddr *ifa; struct ifreq ifr; struct sbuf *sb; int error, full = 0, valid_len, max_len; -#ifdef __amd64__ - if (cmd == SIOCGIFCONF32) { - ifc_swab.ifc_len = ifc32->ifc_len; - ifc_swab.ifc_buf = (caddr_t)(uintptr_t)ifc32->ifc_buf; - ifc = &ifc_swab; - } -#endif /* Limit initial buffer size to MAXPHYS to avoid DoS from userspace. */ max_len = MAXPHYS - 1; @@ -2809,10 +2825,6 @@ again: } ifc->ifc_len = valid_len; -#ifdef __amd64__ - if (cmd == SIOCGIFCONF32) - ifc32->ifc_len = valid_len; -#endif sbuf_finish(sb); error = copyout(sbuf_data(sb), ifc->ifc_req, ifc->ifc_len); sbuf_delete(sb); Modified: stable/8/sys/net/if.h ============================================================================== --- stable/8/sys/net/if.h Fri Nov 12 11:36:12 2010 (r215174) +++ stable/8/sys/net/if.h Fri Nov 12 11:59:59 2010 (r215175) @@ -391,16 +391,6 @@ struct ifconf { #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ }; -#if defined (__amd64__) -struct ifconf32 { - int ifc_len; /* size of associated buffer */ - union { - u_int ifcu_buf; - u_int ifcu_req; - } ifc_ifcu; -}; -#endif - /* * interface groups */ Modified: stable/8/sys/sys/sockio.h ============================================================================== --- stable/8/sys/sys/sockio.h Fri Nov 12 11:36:12 2010 (r215174) +++ stable/8/sys/sys/sockio.h Fri Nov 12 11:59:59 2010 (r215175) @@ -62,9 +62,6 @@ #define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ #define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ #define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#if defined (__amd64__) -#define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) /* get ifnet list */ -#endif #define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ #define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ #define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */