Re: svn commit: r332493 - stable/11/sys/net

2018-04-14 Thread Magnus Ringman
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ål,
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
> ==
> --- 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) == sizeof(struct ifreq32));
>  CTASSERT(__offsetof(struct ifreq, ifr_ifru) ==
>  __offsetof(struct ifreq32, ifr_ifru));
> -#endif
>
> +struct ifgroupreq32 {
> +   charifgr_name[IFNAMSIZ];
> +   u_int   ifgr_len;
> +   union {
> +   charifgru_group[IFNAMSIZ];
> +   uint32_tifgru_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 ifreqifr;
>  #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-management");
>
> @@ -1490,17 +1514,42 @@ if_delgroups(struct ifnet *ifp)
> IFNET_WUNLOCK();
>  }
>
> +static char *
> +ifgr_group_get(void *ifgrp)
> +{
> +   union ifgroupreq_union *ifgrup;
> +
> +   ifgrup = ifgrp;
> +#ifdef COMPAT_FREEBSD32
> +   if (SV_CURPROC_FLAG(SV_ILP32))
> +   return (>ifgr32.ifgr_ifgru.ifgru_group[0]);
> +#endif
> +   return (>ifgr.ifgr_ifgru.ifgru_group[0]);
> +}
> +
> +static struct ifg_req *
> +ifgr_groups_get(void *ifgrp)
> +{
> +   union ifgroupreq_union *ifgrup;
> +
> +   ifgrup = 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 = data;
>
> if (ifgr->ifgr_len == 0) {
> IF_ADDR_RLOCK(ifp);
> @@ -1511,7 +1560,7 @@ if_getgroup(struct ifgroupreq *data, struct ifnet *ifp
> }
>
> len = ifgr->ifgr_len;
> -   ifgp = ifgr->ifgr_groups;
> +   ifgp = ifgr_groups_get(ifgr);
> /* XXX: wire */
> IF_ADDR_RLOCK(ifp);
> TAILQ_FOREACH(ifgl, >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 = data;
> struct ifg_group*ifg;
> struct ifg_member   *ifgm;
> struct ifg_req   ifgrq, *ifgp;
> @@ -1563,7 +1611,7 @@ if_getgroupmembers(struct ifgroupreq *data)
> }
>
> len = ifgr->ifgr_len;
> -   ifgp = ifgr->ifgr_groups;
> +   ifgp = ifgr_groups_get(ifgr);
> TAILQ_FOREACH(ifgm, >ifg_members, ifgm_next) {
> 

Re: svn commit: r332493 - stable/11/sys/net

2018-04-14 Thread Magnus Ringman
I don't think anyone has committed a fix yet (I'm not eligible, just
lurking here.)

Just manually integrate the missing change.  At the top of your src tree:

patch -p1 << __EOT
--- head/sys/sys/ioccom.h 2017/11/20 19:43:44 326023
+++ head/sys/sys/ioccom.h 2018/03/16 22:23:04 331077
@@ -61,6 +61,10 @@
 #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
 /* this should be _IORW, but stdio got there first */
 #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
+/* Replace length/type in an ioctl command. */
+#define _IOC_NEWLEN(ioc, len) \
+(((~(IOCPARM_MASK << 16)) & (ioc)) | (((len) & IOCPARM_MASK) << 16))
+#define _IOC_NEWTYPE(ioc, type) _IOC_NEWLEN((ioc), sizeof(type))

 #ifdef _KERNEL
__EOT

On Sat, Apr 14, 2018 at 1:37 PM, David Wolfskill <da...@catwhisker.org> wrote:
> On Sat, Apr 14, 2018 at 01:31:28PM +0200, Magnus Ringman wrote:
>> 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ål,
>> Magnus
>> 
>
> Aye; looks as if that would explain the kernel build failures I had this
> morning in stable/11, trying to update from r332465 -> r332496.
>
> Peace,
> david
> --
> David H. Wolfskill  da...@catwhisker.org
> Donald Trump's criticism of others comes across as psychological projection.
>
> See http://www.catwhisker.org/~david/publickey.gpg for my public key.
___
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-unsubscr...@freebsd.org"