From owner-svn-src-stable@freebsd.org Sat Apr 14 11:31:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E429F9714F for ; Sat, 14 Apr 2018 11:31:31 +0000 (UTC) (envelope-from bmr@ringman.ch) Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com [IPv6:2607:f8b0:4002:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56B6C80D3F for ; Sat, 14 Apr 2018 11:31:30 +0000 (UTC) (envelope-from bmr@ringman.ch) Received: by mail-yw0-x231.google.com with SMTP id i144so4382328ywc.2 for ; Sat, 14 Apr 2018 04:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ringman-ch.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rVE5xTGKHQ6ThJSUHSBmxAqnCyHp7YtzXYQ/Frd2gWc=; b=iy6cvgQOcLa12gJHMyNmDTKXzWOpHs/qCWaffHPRtEFPfgTkQXZKMOSJZHGYDeUn3q uDoQV0EkzZUqtCMGK58ayOdzB1sNSDfhpWXNvB1r3fKb6pioaw0xfTGIYxlzXK6D5jp/ nnbsXdjeyZdZNPB/6v8yA8+RfoaclqSt2uZaDcQ//inxw3Ikb5W6u0/vFgGOWgI5xcwg nTV4vYpJWmtDpFmorels48x3C/T2DBIWQUfbCZOBj8BbQ/2oF4Sx8MNfh2xdI7+BZ8sD 0IVApt+oI4XL7ZV5JBzVA2aSv3WGqFOQ8mUEqA3hHFzqEFWBbMR336ebIzwYcr7jwUw+ fOIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=rVE5xTGKHQ6ThJSUHSBmxAqnCyHp7YtzXYQ/Frd2gWc=; b=s344XaqaU1LmVAfRer/J5BrZmB9kklHa9+om2ELw44/ipsIYWGgHdbhFjxFi6aJLxC +4FYxYdWyrUb8AMIsM19pir3CEhVt/O81h2YYmBRFIy848sS54MG/26M2ZN2jbz/dKCg p4CyaW7q+SjsroxN+q6QsU3aSwfm3k9gbPg3/JVJGWBdHmm3b2Vz8DpuuxaRTya5t/+R BB4ZNJrRir1Fn5k2fG+dLH3UeoiuTNov+ljzkYMyM2FbwipoB3SmKayZtEvqj2/uIXct iDQPKAsOLYXnAkVpYp00crNCENWwg0ZBAmCsqmeeaQNelPeKqHDfWaEyw6/jAQi5/dfr lidw== X-Gm-Message-State: ALQs6tBKd48bcHNA3BxyAYZEWDTTfkReAKIoI2cYjI8P/6bzElS+bPss 8SnGWXCIlnYICGPjUp0hRsB8qz9aYuFP1fjRHZC03g== X-Google-Smtp-Source: AIpwx4/RMtENk43wCV86liDfiiB4UHwM2a8/KXocq75tdJ8i8qLQDFb9OCSWi6kZ9oX3LA6jrupwz1okg5weoGVDOkM= X-Received: by 10.129.51.196 with SMTP id z187mr561409ywz.512.1523705489355; Sat, 14 Apr 2018 04:31:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.128.133 with HTTP; Sat, 14 Apr 2018 04:31:28 -0700 (PDT) In-Reply-To: <201804132232.w3DMWSmI019256@repo.freebsd.org> References: <201804132232.w3DMWSmI019256@repo.freebsd.org> From: Magnus Ringman Date: Sat, 14 Apr 2018 13:31:28 +0200 Message-ID: Subject: Re: svn commit: r332493 - stable/11/sys/net To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, freebsd-stable@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 14 Apr 2018 11:31:31 -0000 Hi Brooks, this MFC missed your r331077 (https://reviews.freebsd.org/D14706) thus stable buildkernel currently breaks on missing those two macros. (_IOC_NEWLEN and _IOC_NEWTYPE for searchability) Sk=C3=A5l, Magnus On Sat, Apr 14, 2018 at 12:32 AM, Brooks Davis wrote: > Author: brooks > Date: Fri Apr 13 22:32:28 2018 > New Revision: 332493 > URL: https://svnweb.freebsd.org/changeset/base/332493 > > Log: > MFC r332088: > > Add 32-bit compat for ioctls that take struct ifgroupreq. > > Use an accessor to access ifgr_group and ifgr_groups. > > Use an macro CASE_IOC_IFGROUPREQ(cmd) in place of case statements such > as "case SIOCAIFGROUP:". This avoids poluting the switch statements > with large numbers of #ifdefs. > > Reviewed by: kib > Obtained from: CheriBSD > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D14960 > > Modified: > stable/11/sys/net/if.c > stable/11/sys/net/if.h > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/net/if.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/11/sys/net/if.c Fri Apr 13 21:19:06 2018 (r332492) > +++ stable/11/sys/net/if.c Fri Apr 13 22:32:28 2018 (r332493) > @@ -133,8 +133,25 @@ struct ifreq32 { > CTASSERT(sizeof(struct ifreq) =3D=3D sizeof(struct ifreq32)); > CTASSERT(__offsetof(struct ifreq, ifr_ifru) =3D=3D > __offsetof(struct ifreq32, ifr_ifru)); > -#endif > > +struct ifgroupreq32 { > + char ifgr_name[IFNAMSIZ]; > + u_int ifgr_len; > + union { > + char ifgru_group[IFNAMSIZ]; > + uint32_t ifgru_groups; > + } ifgr_ifgru; > +}; > +#define _CASE_IOC_IFGROUPREQ_32(cmd) \ > + case _IOC_NEWTYPE((cmd), struct ifgroupreq32): > +#else > +#define _CASE_IOC_IFGROUPREQ_32(cmd) > +#endif /* COMPAT_FREEBSD32 */ > + > +#define CASE_IOC_IFGROUPREQ(cmd) \ > + _CASE_IOC_IFGROUPREQ_32(cmd) \ > + case (cmd) > + > union ifreq_union { > struct ifreq ifr; > #ifdef COMPAT_FREEBSD32 > @@ -142,6 +159,13 @@ union ifreq_union { > #endif > }; > > +union ifgroupreq_union { > + struct ifgroupreq ifgr; > +#ifdef COMPAT_FREEBSD32 > + struct ifgroupreq32 ifgr32; > +#endif > +}; > + > SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers"); > SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-manageme= nt"); > > @@ -1490,17 +1514,42 @@ if_delgroups(struct ifnet *ifp) > IFNET_WUNLOCK(); > } > > +static char * > +ifgr_group_get(void *ifgrp) > +{ > + union ifgroupreq_union *ifgrup; > + > + ifgrup =3D ifgrp; > +#ifdef COMPAT_FREEBSD32 > + if (SV_CURPROC_FLAG(SV_ILP32)) > + return (&ifgrup->ifgr32.ifgr_ifgru.ifgru_group[0]); > +#endif > + return (&ifgrup->ifgr.ifgr_ifgru.ifgru_group[0]); > +} > + > +static struct ifg_req * > +ifgr_groups_get(void *ifgrp) > +{ > + union ifgroupreq_union *ifgrup; > + > + ifgrup =3D ifgrp; > +#ifdef COMPAT_FREEBSD32 > + if (SV_CURPROC_FLAG(SV_ILP32)) > + return ((struct ifg_req *)(uintptr_t) > + ifgrup->ifgr32.ifgr_ifgru.ifgru_groups); > +#endif > + return (ifgrup->ifgr.ifgr_ifgru.ifgru_groups); > +} > + > /* > - * Stores all groups from an interface in memory pointed > - * to by data > + * Stores all groups from an interface in memory pointed to by ifgr. > */ > static int > -if_getgroup(struct ifgroupreq *data, struct ifnet *ifp) > +if_getgroup(struct ifgroupreq *ifgr, struct ifnet *ifp) > { > int len, error; > struct ifg_list *ifgl; > struct ifg_req ifgrq, *ifgp; > - struct ifgroupreq *ifgr =3D data; > > if (ifgr->ifgr_len =3D=3D 0) { > IF_ADDR_RLOCK(ifp); > @@ -1511,7 +1560,7 @@ if_getgroup(struct ifgroupreq *data, struct ifnet *= ifp > } > > len =3D ifgr->ifgr_len; > - ifgp =3D ifgr->ifgr_groups; > + ifgp =3D ifgr_groups_get(ifgr); > /* XXX: wire */ > IF_ADDR_RLOCK(ifp); > TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) { > @@ -1535,12 +1584,11 @@ if_getgroup(struct ifgroupreq *data, struct ifnet= *ifp > } > > /* > - * Stores all members of a group in memory pointed to by data > + * Stores all members of a group in memory pointed to by igfr > */ > static int > -if_getgroupmembers(struct ifgroupreq *data) > +if_getgroupmembers(struct ifgroupreq *ifgr) > { > - struct ifgroupreq *ifgr =3D data; > struct ifg_group *ifg; > struct ifg_member *ifgm; > struct ifg_req ifgrq, *ifgp; > @@ -1563,7 +1611,7 @@ if_getgroupmembers(struct ifgroupreq *data) > } > > len =3D ifgr->ifgr_len; > - ifgp =3D ifgr->ifgr_groups; > + ifgp =3D ifgr_groups_get(ifgr); > TAILQ_FOREACH(ifgm, &ifg->ifg_members, ifgm_next) { > if (len < sizeof(ifgrq)) { > IFNET_RUNLOCK(); > @@ -2793,34 +2841,28 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t = data, > error =3D if_gethwaddr(ifp, ifr); > break; > > - case SIOCAIFGROUP: > - { > - struct ifgroupreq *ifgr =3D (struct ifgroupreq *)ifr; > - > + CASE_IOC_IFGROUPREQ(SIOCAIFGROUP): > error =3D priv_check(td, PRIV_NET_ADDIFGROUP); > if (error) > return (error); > - if ((error =3D if_addgroup(ifp, ifgr->ifgr_group))) > + if ((error =3D if_addgroup(ifp, > + ifgr_group_get((struct ifgroupreq *)data)))) > return (error); > break; > - } > > - case SIOCGIFGROUP: > - if ((error =3D if_getgroup((struct ifgroupreq *)ifr, ifp)= )) > + CASE_IOC_IFGROUPREQ(SIOCGIFGROUP): > + if ((error =3D if_getgroup((struct ifgroupreq *)data, ifp= ))) > return (error); > break; > > - case SIOCDIFGROUP: > - { > - struct ifgroupreq *ifgr =3D (struct ifgroupreq *)ifr; > - > + CASE_IOC_IFGROUPREQ(SIOCDIFGROUP): > error =3D priv_check(td, PRIV_NET_DELIFGROUP); > if (error) > return (error); > - if ((error =3D if_delgroup(ifp, ifgr->ifgr_group))) > + if ((error =3D if_delgroup(ifp, > + ifgr_group_get((struct ifgroupreq *)data)))) > return (error); > break; > - } > > default: > error =3D ENOIOCTL; > @@ -2926,7 +2968,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data= , s > error =3D if_clone_list((struct if_clonereq *)data); > CURVNET_RESTORE(); > return (error); > - case SIOCGIFGMEMB: > + CASE_IOC_IFGROUPREQ(SIOCGIFGMEMB): > error =3D if_getgroupmembers((struct ifgroupreq *)data); > CURVNET_RESTORE(); > return (error); > > Modified: stable/11/sys/net/if.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/11/sys/net/if.h Fri Apr 13 21:19:06 2018 (r332492) > +++ stable/11/sys/net/if.h Fri Apr 13 22:32:28 2018 (r332493) > @@ -512,8 +512,10 @@ struct ifgroupreq { > char ifgru_group[IFNAMSIZ]; > struct ifg_req *ifgru_groups; > } ifgr_ifgru; > +#ifndef _KERNEL > #define ifgr_group ifgr_ifgru.ifgru_group > #define ifgr_groups ifgr_ifgru.ifgru_groups > +#endif > }; > > /* > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"