Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2018 18:53:50 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        freebsd-current@freebsd.org
Subject:   32-bit compat ifconfig support
Message-ID:  <20180330185349.GM88362@spindle.one-eyed-alien.net>

next in thread | raw e-mail | index | archive | help

--TA4f0niHM6tHt3xR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

With this change, 32-bit ifconfig is expected to work.  I've done most
of my testing on a different compat ABI in CheriBSD, but am happy to
receive reports one way or another.  If you find edge cases, please file
bug reports and I'll take a look at them.

-- Brooks

----- Forwarded message from Brooks Davis <brooks@FreeBSD.org> -----

Date: Fri, 30 Mar 2018 18:50:13 +0000 (UTC)
=46rom: Brooks Davis <brooks@FreeBSD.org>
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
Subject: svn commit: r331797 - in head/sys: dev/an dev/ath dev/cxgbe
	dev/if_ndis dev/iwi dev/ixl dev/mlx4/mlx4_en dev/mlx5/mlx5_en dev/mwl
	dev/nxge dev/oce dev/qlnx/qlnxe dev/sbni dev/sfxge dev/vxge net net...

Author: brooks
Date: Fri Mar 30 18:50:13 2018
New Revision: 331797
URL: https://svnweb.freebsd.org/changeset/base/331797

Log:
  Use an accessor function to access ifr_data.
 =20
  This fixes 32-bit compat (no ioctl command defintions are required
  as struct ifreq is the same size).  This is believed to be sufficent to
  fully support ifconfig on 32-bit systems.
 =20
  Reviewed by:	kib
  Obtained from:	CheriBSD
  MFC after:	1 week
  Relnotes:	yes
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D14900

Modified:
  head/sys/dev/an/if_an.c
  head/sys/dev/ath/if_ath_ioctl.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/ixl/ixl_pf_main.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/nxge/if_nxge.c
  head/sys/dev/oce/oce_if.c
  head/sys/dev/qlnx/qlnxe/qlnx_os.c
  head/sys/dev/sbni/if_sbni.c
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/vxge/vxge.c
  head/sys/net/if.c
  head/sys/net/if.h
  head/sys/net/if_gif.c
  head/sys/net/if_gre.c
  head/sys/net/if_ipsec.c
  head/sys/net/if_spppsubr.c
  head/sys/net/if_var.h
  head/sys/net/if_vlan.c
  head/sys/net/iflib.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/netinet/ip_carp.c
  head/sys/netpfil/pf/if_pfsync.c
  head/sys/security/mac/mac_net.c

Modified: head/sys/dev/an/if_an.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
--- head/sys/dev/an/if_an.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/an/if_an.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1934,7 +1934,8 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
 		error =3D 0;
 		break;
 	case SIOCGAIRONET:
-		error =3D copyin(ifr->ifr_data, &sc->areq, sizeof(sc->areq));
+		error =3D copyin(ifr_data_get_ptr(ifr), &sc->areq,
+		    sizeof(sc->areq));
 		if (error !=3D 0)
 			break;
 		AN_LOCK(sc);
@@ -1963,13 +1964,15 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t=
 da
 			break;
 		}
 		AN_UNLOCK(sc);
-		error =3D copyout(&sc->areq, ifr->ifr_data, sizeof(sc->areq));
+		error =3D copyout(&sc->areq, ifr_data_get_ptr(ifr),
+		    sizeof(sc->areq));
 		break;
 	case SIOCSAIRONET:
 		if ((error =3D priv_check(td, PRIV_DRIVER)))
 			goto out;
 		AN_LOCK(sc);
-		error =3D copyin(ifr->ifr_data, &sc->areq, sizeof(sc->areq));
+		error =3D copyin(ifr_data_get_ptr(ifr), &sc->areq,
+		    sizeof(sc->areq));
 		if (error !=3D 0)
 			break;
 		an_setdef(sc, &sc->areq);
@@ -1978,7 +1981,8 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
 	case SIOCGPRIVATE_0:		/* used by Cisco client utility */
 		if ((error =3D priv_check(td, PRIV_DRIVER)))
 			goto out;
-		error =3D copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl));
+		error =3D copyin(ifr_data_get_ptr(ifr), &l_ioctl,
+		    sizeof(l_ioctl));
 		if (error)
 			goto out;
 		mode =3D l_ioctl.command;
@@ -1996,13 +2000,15 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t=
 da
 		AN_UNLOCK(sc);
 		if (!error) {
 			/* copy out the updated command info */
-			error =3D copyout(&l_ioctl, ifr->ifr_data, sizeof(l_ioctl));
+			error =3D copyout(&l_ioctl, ifr_data_get_ptr(ifr),
+			    sizeof(l_ioctl));
 		}
 		break;
 	case SIOCGPRIVATE_1:		/* used by Cisco client utility */
 		if ((error =3D priv_check(td, PRIV_DRIVER)))
 			goto out;
-		error =3D copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl));
+		error =3D copyin(ifr_data_get_ptr(ifr), &l_ioctl,
+		    sizeof(l_ioctl));
 		if (error)
 			goto out;
 		l_ioctl.command =3D 0;

Modified: head/sys/dev/ath/if_ath_ioctl.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
--- head/sys/dev/ath/if_ath_ioctl.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/ath/if_ath_ioctl.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -267,12 +267,12 @@ ath_ioctl(struct ieee80211com *ic, u_long cmd, void *d
 		    rt->info[sc->sc_txrix].dot11Rate &~ IEEE80211_RATE_BASIC;
 		if (rt->info[sc->sc_txrix].phy & IEEE80211_T_HT)
 			sc->sc_stats.ast_tx_rate |=3D IEEE80211_RATE_MCS;
-		return copyout(&sc->sc_stats,
-		    ifr->ifr_data, sizeof (sc->sc_stats));
+		return copyout(&sc->sc_stats, ifr_data_get_ptr(ifr),
+		    sizeof (sc->sc_stats));
 	}
 	case SIOCGATHAGSTATS:
-		return copyout(&sc->sc_aggr_stats,
-		    ifr->ifr_data, sizeof (sc->sc_aggr_stats));
+		return copyout(&sc->sc_aggr_stats, ifr_data_get_ptr(ifr),
+		    sizeof (sc->sc_aggr_stats));
 	case SIOCZATHSTATS: {
 		int error;
=20

Modified: head/sys/dev/cxgbe/t4_main.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
--- head/sys/dev/cxgbe/t4_main.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/cxgbe/t4_main.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1800,7 +1800,7 @@ fail:
 	case SIOCGI2C: {
 		struct ifi2creq i2c;
=20
-		rc =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		rc =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
 		if (rc !=3D 0)
 			break;
 		if (i2c.dev_addr !=3D 0xA0 && i2c.dev_addr !=3D 0xA2) {
@@ -1818,7 +1818,7 @@ fail:
 		    i2c.offset, i2c.len, &i2c.data[0]);
 		end_synchronized_op(sc, 0);
 		if (rc =3D=3D 0)
-			rc =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+			rc =3D copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
 		break;
 	}
=20

Modified: head/sys/dev/if_ndis/if_ndis.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
--- head/sys/dev/if_ndis/if_ndis.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/if_ndis/if_ndis.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -2975,11 +2975,12 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd=
, v
 	switch (cmd) {
 	case SIOCGDRVSPEC:
 	case SIOCSDRVSPEC:
-		error =3D copyin(ifr->ifr_data, &oid, sizeof(oid));
+		error =3D copyin(ifr_data_get_ptr(ifr), &oid, sizeof(oid));
 		if (error)
 			break;
 		oidbuf =3D malloc(oid.len, M_TEMP, M_WAITOK | M_ZERO);
-		error =3D copyin(ifr->ifr_data + sizeof(oid), oidbuf, oid.len);
+		error =3D copyin((caddr_t)ifr_data_get_ptr(ifr) + sizeof(oid),
+		    oidbuf, oid.len);
 	}
=20
 	if (error) {
@@ -3001,7 +3002,7 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd, v
 			NDIS_UNLOCK(sc);
 			break;
 		}
-		error =3D copyin(ifr->ifr_data, &evt, sizeof(evt));
+		error =3D copyin(ifr_data_get_ptr(ifr), &evt, sizeof(evt));
 		if (error) {
 			NDIS_UNLOCK(sc);
 			break;
@@ -3012,14 +3013,15 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd=
, v
 			break;
 		}
 		error =3D copyout(&sc->ndis_evt[sc->ndis_evtcidx],
-		    ifr->ifr_data, sizeof(uint32_t) * 2);
+		    ifr_data_get_ptr(ifr), sizeof(uint32_t) * 2);
 		if (error) {
 			NDIS_UNLOCK(sc);
 			break;
 		}
 		if (sc->ndis_evt[sc->ndis_evtcidx].ne_len) {
 			error =3D copyout(sc->ndis_evt[sc->ndis_evtcidx].ne_buf,
-			    ifr->ifr_data + (sizeof(uint32_t) * 2),
+			    (caddr_t)ifr_data_get_ptr(ifr) +
+			    (sizeof(uint32_t) * 2),
 			    sc->ndis_evt[sc->ndis_evtcidx].ne_len);
 			if (error) {
 				NDIS_UNLOCK(sc);
@@ -3041,10 +3043,11 @@ ndis_80211ioctl(struct ieee80211com *ic, u_long cmd=
, v
 	switch (cmd) {
 	case SIOCGDRVSPEC:
 	case SIOCSDRVSPEC:
-		error =3D copyout(&oid, ifr->ifr_data, sizeof(oid));
+		error =3D copyout(&oid, ifr_data_get_ptr(ifr), sizeof(oid));
 		if (error)
 			break;
-		error =3D copyout(oidbuf, ifr->ifr_data + sizeof(oid), oid.len);
+		error =3D copyout(oidbuf,
+		    (caddr_t)ifr_data_get_ptr(ifr) + sizeof(oid), oid.len);
 	}
=20
 	free(oidbuf, M_TEMP);

Modified: head/sys/dev/iwi/if_iwi.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
--- head/sys/dev/iwi/if_iwi.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/iwi/if_iwi.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -2059,7 +2059,7 @@ iwi_ioctl(struct ieee80211com *ic, u_long cmd, void *d
 	switch (cmd) {
 	case SIOCGIWISTATS:
 		/* XXX validate permissions/memory/etc? */
-		error =3D copyout(&sc->sc_linkqual, ifr->ifr_data,
+		error =3D copyout(&sc->sc_linkqual, ifr_data_get_ptr(ifr),
 		    sizeof(struct iwi_notif_link_quality));
 		break;
 	case SIOCZIWISTATS:

Modified: head/sys/dev/ixl/ixl_pf_main.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
--- head/sys/dev/ixl/ixl_pf_main.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/ixl/ixl_pf_main.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -5174,7 +5174,7 @@ ixl_ioctl(struct ifnet * ifp, u_long command, caddr_t=
=20
 		if (!pf->has_i2c)
 			return (ENOTTY);
=20
-		error =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		error =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
 		if (error !=3D 0)
 			break;
 		if (i2c.dev_addr !=3D 0xA0 && i2c.dev_addr !=3D 0xA2) {
@@ -5191,7 +5191,7 @@ ixl_ioctl(struct ifnet * ifp, u_long command, caddr_t=
=20
 			    i2c.dev_addr, &i2c.data[i]))
 				return (EIO);
=20
-		error =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+		error =3D copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
 		break;
 	}
 #endif

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.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
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Fri Mar 30 18:49:52 2018	(r3=
31796)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Fri Mar 30 18:50:13 2018	(r3=
31797)
@@ -2058,7 +2058,7 @@ out:
 	case SIOCGI2C: {
 		struct ifi2creq i2c;
=20
-		error =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		error =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
 		if (error)
 			break;
 		if (i2c.len > sizeof(i2c.data)) {
@@ -2075,7 +2075,7 @@ out:
 			error =3D -error;
 			break;
 		}
-		error =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+		error =3D copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
 		break;
 	}
 #endif

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.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
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Fri Mar 30 18:49:52 2018	(r331=
796)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Fri Mar 30 18:50:13 2018	(r331=
797)
@@ -2884,7 +2884,7 @@ out:
 		 * Copy from the user-space address ifr_data to the
 		 * kernel-space address i2c
 		 */
-		error =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		error =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
 		if (error)
 			break;
=20
@@ -2948,7 +2948,7 @@ out:
 			goto err_i2c;
 		}
=20
-		error =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+		error =3D copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
 err_i2c:
 		PRIV_UNLOCK(priv);
 		break;

Modified: head/sys/dev/mwl/if_mwl.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
--- head/sys/dev/mwl/if_mwl.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/mwl/if_mwl.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -4750,8 +4750,8 @@ mwl_ioctl(struct ieee80211com *ic, u_long cmd, void *d
 		 * statistics.  The alternative is to copy the data
 		 * to a local structure.
 		 */
-		return (copyout(&sc->sc_stats,
-				ifr->ifr_data, sizeof (sc->sc_stats)));
+		return (copyout(&sc->sc_stats, ifr_data_get_ptr(ifr),
+		    sizeof (sc->sc_stats)));
 #ifdef MWL_DIAGAPI
 	case SIOCGMVDIAG:
 		/* XXX check privs */

Modified: head/sys/dev/nxge/if_nxge.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
--- head/sys/dev/nxge/if_nxge.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/nxge/if_nxge.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1368,7 +1368,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	void *info =3D NULL;
 	int retValue =3D EINVAL;
=20
-	cmd =3D fubyte(ifreqp->ifr_data);
+	cmd =3D fubyte(ifr_data_get_ptr(ifreqp));
 	if (cmd =3D=3D -1)
 		return (EFAULT);
=20
@@ -1379,7 +1379,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	            (xge_hal_stats_hw_info_t **)&info);
 	        mtx_unlock(&lldev->mtx_drv);
 	        if(status =3D=3D XGE_HAL_OK) {
-	            if(copyout(info, ifreqp->ifr_data,
+	            if(copyout(info, ifr_data_get_ptr(ifreqp),
 	                sizeof(xge_hal_stats_hw_info_t)) =3D=3D 0)
 	                retValue =3D 0;
 	        }
@@ -1397,7 +1397,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	                sizeof(xge_hal_pci_config_t));
 	            mtx_unlock(&lldev->mtx_drv);
 	            if(status =3D=3D XGE_HAL_OK) {
-	                if(copyout(info, ifreqp->ifr_data,
+	                if(copyout(info, ifr_data_get_ptr(ifreqp),
 	                    sizeof(xge_hal_pci_config_t)) =3D=3D 0)
 	                    retValue =3D 0;
 	            }
@@ -1417,7 +1417,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	                sizeof(xge_hal_stats_device_info_t));
 	            mtx_unlock(&lldev->mtx_drv);
 	            if(status =3D=3D XGE_HAL_OK) {
-	                if(copyout(info, ifreqp->ifr_data,
+	                if(copyout(info, ifr_data_get_ptr(ifreqp),
 	                    sizeof(xge_hal_stats_device_info_t)) =3D=3D 0)
 	                    retValue =3D 0;
 	            }
@@ -1438,7 +1438,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	                sizeof(xge_hal_stats_sw_err_t));
 	            mtx_unlock(&lldev->mtx_drv);
 	            if(status =3D=3D XGE_HAL_OK) {
-	                if(copyout(info, ifreqp->ifr_data,
+	                if(copyout(info, ifr_data_get_ptr(ifreqp),
 	                    sizeof(xge_hal_stats_sw_err_t)) =3D=3D 0)
 	                    retValue =3D 0;
 	            }
@@ -1451,7 +1451,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	        break;
=20
 	    case XGE_QUERY_DRIVERSTATS:
-		if(copyout(&lldev->driver_stats, ifreqp->ifr_data,
+		if(copyout(&lldev->driver_stats, ifr_data_get_ptr(ifreqp),
 	            sizeof(xge_driver_stats_t)) =3D=3D 0) {
 	            retValue =3D 0;
 	        }
@@ -1465,7 +1465,8 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	        info =3D xge_os_malloc(NULL, XGE_BUFFER_SIZE);
 	        if(info !=3D NULL) {
 	            strcpy(info, XGE_DRIVER_VERSION);
-	            if(copyout(info, ifreqp->ifr_data, XGE_BUFFER_SIZE) =3D=3D 0)
+	            if(copyout(info, ifr_data_get_ptr(ifreqp),
+			XGE_BUFFER_SIZE) =3D=3D 0)
 	                retValue =3D 0;
 	            xge_os_free(NULL, info, XGE_BUFFER_SIZE);
 	        }
@@ -1479,7 +1480,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	                sizeof(xge_hal_device_config_t));
 	            mtx_unlock(&lldev->mtx_drv);
 	            if(status =3D=3D XGE_HAL_OK) {
-	                if(copyout(info, ifreqp->ifr_data,
+	                if(copyout(info, ifr_data_get_ptr(ifreqp),
 	                    sizeof(xge_hal_device_config_t)) =3D=3D 0)
 	                    retValue =3D 0;
 	            }
@@ -1492,7 +1493,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	        break;
=20
 	    case XGE_QUERY_BUFFER_MODE:
-	        if(copyout(&lldev->buffer_mode, ifreqp->ifr_data,
+	        if(copyout(&lldev->buffer_mode, ifr_data_get_ptr(ifreqp),
 	            sizeof(int)) =3D=3D 0)
 	            retValue =3D 0;
 	        break;
@@ -1501,7 +1502,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifre
 	    case XGE_SET_BUFFER_MODE_2:
 	    case XGE_SET_BUFFER_MODE_5:
 	        mode =3D (cmd =3D=3D XGE_SET_BUFFER_MODE_1) ? 'Y':'N';
-	        if(copyout(&mode, ifreqp->ifr_data, sizeof(mode)) =3D=3D 0)
+	        if(copyout(&mode, ifr_data_get_ptr(ifreqp), sizeof(mode)) =3D=3D =
0)
 	            retValue =3D 0;
 	        break;
 	    default:
@@ -1529,7 +1530,7 @@ xge_ioctl_registers(xge_lldev_t *lldev, struct ifreq *
 	int error;
 	u64 val64 =3D 0;
=20
-	error =3D copyin(ifreqp->ifr_data, &tmpdata, sizeof(tmpdata));
+	error =3D copyin(ifr_data_get_ptr(ifreqp), &tmpdata, sizeof(tmpdata));
 	if (error !=3D 0)
 		return (error);
 	data =3D &tmpdata;
@@ -1542,7 +1543,8 @@ xge_ioctl_registers(xge_lldev_t *lldev, struct ifreq *
 	        &data->value);
 	    mtx_unlock(&lldev->mtx_drv);
 	    if(status =3D=3D XGE_HAL_OK) {
-	        if(copyout(data, ifreqp->ifr_data, sizeof(xge_register_t)) =3D=3D=
 0)
+	        if(copyout(data, ifr_data_get_ptr(ifreqp),
+		    sizeof(xge_register_t)) =3D=3D 0)
 	            retValue =3D 0;
 	    }
 	}
@@ -1587,7 +1589,7 @@ xge_ioctl_registers(xge_lldev_t *lldev, struct ifreq *
 	    mtx_unlock(&lldev->mtx_drv);
=20
 	    if(retValue =3D=3D 0) {
-	        if(copyout(data, ifreqp->ifr_data,
+	        if(copyout(data, ifr_data_get_ptr(ifreqp),
 	            sizeof(xge_hal_pci_bar0_t)) !=3D 0) {
 	            xge_trace(XGE_ERR, "Copyout of register values failed");
 	            retValue =3D EINVAL;

Modified: head/sys/dev/oce/oce_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
--- head/sys/dev/oce/oce_if.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/oce/oce_if.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -2276,7 +2276,7 @@ oce_handle_passthrough(struct ifnet *ifp, caddr_t data
 	struct ifreq *ifr =3D (struct ifreq *)data;
 	int rc =3D ENXIO;
 	char cookie[32] =3D {0};
-	void *priv_data =3D (void *)ifr->ifr_data;
+	void *priv_data =3D ifr_data_get_ptr(ifr);
 	void *ioctl_ptr;
 	uint32_t req_size;
 	struct mbx_hdr req;

Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.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
--- head/sys/dev/qlnx/qlnxe/qlnx_os.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/qlnx/qlnxe/qlnx_os.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -2464,7 +2464,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
 		struct ecore_hwfn *p_hwfn =3D &ha->cdev.hwfns[0];
 		struct ecore_ptt *p_ptt;
=20
-		ret =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		ret =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
=20
 		if (ret)
 			break;
@@ -2494,7 +2494,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
 			break;
 		}
=20
-		ret =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+		ret =3D copyout(&i2c, ifr_data_get_ptr(ifr), sizeof(i2c));
=20
 		QL_DPRINT8(ha, "SIOCGI2C copyout ret =3D %d \
 			 len =3D %d addr =3D 0x%02x offset =3D 0x%04x \

Modified: head/sys/dev/sbni/if_sbni.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
--- head/sys/dev/sbni/if_sbni.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/sbni/if_sbni.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1153,7 +1153,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t=
=20
 		SBNI_LOCK(sc);
 		bcopy(&sc->in_stats, in_stats, sizeof(struct sbni_in_stats));
 		SBNI_UNLOCK(sc);
-		error =3D copyout(ifr->ifr_data, in_stats,
+		error =3D copyout(ifr_data_get_ptr(ifr), in_stats,
 		    sizeof(struct sbni_in_stats));
 		free(in_stats, M_DEVBUF);
 		break;

Modified: head/sys/dev/sfxge/sfxge.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
--- head/sys/dev/sfxge/sfxge.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/sfxge/sfxge.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -529,7 +529,7 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long comman
 	{
 		struct ifi2creq i2c;
=20
-		error =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		error =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
 		if (error !=3D 0)
 			break;
=20
@@ -544,7 +544,8 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long comman
 						&i2c.data[0]);
 		SFXGE_ADAPTER_UNLOCK(sc);
 		if (error =3D=3D 0)
-			error =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+			error =3D copyout(&i2c, ifr_data_get_ptr(ifr),
+			    sizeof(i2c));
 		break;
 	}
 #endif
@@ -552,12 +553,13 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long comman
 		error =3D priv_check(curthread, PRIV_DRIVER);
 		if (error !=3D 0)
 			break;
-		error =3D copyin(ifr->ifr_data, &ioc, sizeof(ioc));
+		error =3D copyin(ifr_data_get_ptr(ifr), &ioc, sizeof(ioc));
 		if (error !=3D 0)
 			return (error);
 		error =3D sfxge_private_ioctl(sc, &ioc);
 		if (error =3D=3D 0) {
-			error =3D copyout(&ioc, ifr->ifr_data, sizeof(ioc));
+			error =3D copyout(&ioc, ifr_data_get_ptr(ifr),
+			    sizeof(ioc));
 		}
 		break;
 	default:

Modified: head/sys/dev/vxge/vxge.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
--- head/sys/dev/vxge/vxge.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/dev/vxge/vxge.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -3710,8 +3710,8 @@ vxge_ioctl_regs(vxge_dev_t *vdev, struct ifreq *ifr)
 	u32 offset, reqd_size =3D 0;
 	int i, err =3D EINVAL;
=20
-	char *command =3D (char *) ifr->ifr_data;
-	void *reg_info =3D (void *) ifr->ifr_data;
+	char *command =3D ifr_data_get_ptr(ifr);
+	void *reg_info =3D ifr_data_get_ptr(ifr);
=20
 	vxge_vpath_t *vpath;
 	vxge_hal_status_e status =3D VXGE_HAL_OK;
@@ -3818,7 +3818,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 	vxge_drv_stats_t *drv_stat;
=20
 	char *buffer =3D NULL;
-	char *command =3D (char *) ifr->ifr_data;
+	char *command =3D ifr_data_get_ptr(ifr);
 	vxge_hal_status_e status =3D VXGE_HAL_OK;
=20
 	switch (*command) {
@@ -3829,7 +3829,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 			status =3D vxge_hal_aux_pci_config_read(vdev->devh,
 			    bufsize, buffer, &retsize);
 			if (status =3D=3D VXGE_HAL_OK)
-				err =3D copyout(buffer, ifr->ifr_data, retsize);
+				err =3D copyout(buffer, ifr_data_get_ptr(ifr),
+				    retsize);
 			else
 				device_printf(vdev->ndev,
 				    "failed pciconfig statistics query\n");
@@ -3848,7 +3849,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 			status =3D vxge_hal_aux_stats_mrpcim_read(vdev->devh,
 			    bufsize, buffer, &retsize);
 			if (status =3D=3D VXGE_HAL_OK)
-				err =3D copyout(buffer, ifr->ifr_data, retsize);
+				err =3D copyout(buffer, ifr_data_get_ptr(ifr),
+				    retsize);
 			else
 				device_printf(vdev->ndev,
 				    "failed mrpcim statistics query\n");
@@ -3864,7 +3866,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 			status =3D vxge_hal_aux_stats_device_read(vdev->devh,
 			    bufsize, buffer, &retsize);
 			if (status =3D=3D VXGE_HAL_OK)
-				err =3D copyout(buffer, ifr->ifr_data, retsize);
+				err =3D copyout(buffer, ifr_data_get_ptr(ifr),
+				    retsize);
 			else
 				device_printf(vdev->ndev,
 				    "failed device statistics query\n");
@@ -3888,7 +3891,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 			((vxge_device_hw_info_t *) buffer)->port_failure =3D
 			    vdev->port_failure;
=20
-			err =3D copyout(buffer, ifr->ifr_data, bufsize);
+			err =3D copyout(buffer, ifr_data_get_ptr(ifr), bufsize);
 			if (err !=3D 0)
 				device_printf(vdev->ndev,
 				    "failed device hardware info query\n");
@@ -3915,7 +3918,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 				    sizeof(vxge_drv_stats_t));
 			}
=20
-			err =3D copyout(drv_stat, ifr->ifr_data, bufsize);
+			err =3D copyout(drv_stat, ifr_data_get_ptr(ifr), bufsize);
 			if (err !=3D 0)
 				device_printf(vdev->ndev,
 				    "failed driver statistics query\n");
@@ -3925,7 +3928,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 		break;
=20
 	case VXGE_GET_BANDWIDTH:
-		bw_info =3D (vxge_bw_info_t *) ifr->ifr_data;
+		bw_info =3D ifr_data_get_ptr(ifr);
=20
 		if ((vdev->config.hw_info.func_id !=3D 0) &&
 		    (vdev->hw_fw_version < VXGE_FW_VERSION(1, 8, 0)))
@@ -3938,7 +3941,8 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 		if (status !=3D VXGE_HAL_OK)
 			break;
=20
-		err =3D copyout(bw_info, ifr->ifr_data, sizeof(vxge_bw_info_t));
+		err =3D copyout(bw_info, ifr_data_get_ptr(ifr),
+		    sizeof(vxge_bw_info_t));
 		break;
=20
 	case VXGE_SET_BANDWIDTH:
@@ -3949,7 +3953,7 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *ifr)
 	case VXGE_SET_PORT_MODE:
 		if (vdev->is_privilaged) {
 			if (vdev->config.hw_info.ports =3D=3D VXGE_DUAL_PORT_MODE) {
-				port_info =3D (vxge_port_info_t *) ifr->ifr_data;
+				port_info =3D ifr_data_get_ptr(ifr);
 				vdev->config.port_mode =3D port_info->port_mode;
 				err =3D vxge_port_mode_update(vdev);
 				if (err !=3D ENXIO)
@@ -3966,10 +3970,11 @@ vxge_ioctl_stats(vxge_dev_t *vdev, struct ifreq *if=
r)
 	case VXGE_GET_PORT_MODE:
 		if (vdev->is_privilaged) {
 			if (vdev->config.hw_info.ports =3D=3D VXGE_DUAL_PORT_MODE) {
-				port_info =3D (vxge_port_info_t *) ifr->ifr_data;
+				port_info =3D ifr_data_get_ptr(ifr);
 				err =3D vxge_port_mode_get(vdev, port_info);
 				if (err =3D=3D VXGE_HAL_OK) {
-					err =3D copyout(port_info, ifr->ifr_data,
+					err =3D copyout(port_info,
+					    ifr_data_get_ptr(ifr),
 					    sizeof(vxge_port_info_t));
 				}
 			}
@@ -4005,7 +4010,7 @@ vxge_bw_priority_set(vxge_dev_t *vdev, struct ifreq *i
 	u32 func_id;
 	vxge_bw_info_t *bw_info;
=20
-	bw_info =3D (vxge_bw_info_t *) ifr->ifr_data;
+	bw_info =3D ifr_data_get_ptr(ifr);
 	func_id =3D bw_info->func_id;
=20
 	vdev->config.bw_info[func_id].priority =3D bw_info->priority;

Modified: head/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
--- head/sys/net/if.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -2403,6 +2403,20 @@ ifr_buffer_set_length(struct thread *td, void *data,=
 s
 		ifrup->ifr.ifr_ifru.ifru_buffer.length =3D len;
 }
=20
+void *
+ifr_data_get_ptr(void *ifrp)
+{
+	union ifreq_union *ifrup;
+
+	ifrup =3D ifrp;
+#ifdef COMPAT_FREEBSD32
+	if (SV_CURPROC_FLAG(SV_ILP32))
+		return ((void *)(uintptr_t)
+		    ifrup->ifr32.ifr_ifru.ifru_data);
+#endif
+		return (ifrup->ifr.ifr_ifru.ifru_data);
+}
+
 /*
  * Hardware specific interface ioctls.
  */
@@ -2584,7 +2598,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data,
 		error =3D priv_check(td, PRIV_NET_SETIFNAME);
 		if (error)
 			return (error);
-		error =3D copyinstr(ifr->ifr_data, new_name, IFNAMSIZ, NULL);
+		error =3D copyinstr(ifr_data_get_ptr(ifr), new_name, IFNAMSIZ,
+		    NULL);
 		if (error !=3D 0)
 			return (error);
 		if (new_name[0] =3D=3D '\0')
@@ -2895,8 +2910,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, s
 		error =3D priv_check(td, PRIV_NET_IFCREATE);
 		if (error =3D=3D 0)
 			error =3D if_clone_create(ifr->ifr_name,
-			    sizeof(ifr->ifr_name),
-			    cmd =3D=3D SIOCIFCREATE2 ? ifr->ifr_data : NULL);
+			    sizeof(ifr->ifr_name), cmd =3D=3D SIOCIFCREATE2 ?
+			    ifr_data_get_ptr(ifr) : NULL);
 		CURVNET_RESTORE();
 		return (error);
 	case SIOCIFDESTROY:

Modified: head/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
--- head/sys/net/if.h	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if.h	Fri Mar 30 18:50:13 2018	(r331797)
@@ -412,7 +412,9 @@ struct	ifreq {
 #define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu */
 #define ifr_phys	ifr_ifru.ifru_phys	/* physical wire */
 #define ifr_media	ifr_ifru.ifru_media	/* physical media */
+#ifndef _KERNEL
 #define	ifr_data	ifr_ifru.ifru_data	/* for use by interface */
+#endif
 #define	ifr_reqcap	ifr_ifru.ifru_cap[0]	/* requested capabilities */
 #define	ifr_curcap	ifr_ifru.ifru_cap[1]	/* current capabilities */
 #define	ifr_index	ifr_ifru.ifru_index	/* interface index */

Modified: head/sys/net/if_gif.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
--- head/sys/net/if_gif.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if_gif.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -898,12 +898,14 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		break;
 	case GIFGOPTS:
 		options =3D sc->gif_options;
-		error =3D copyout(&options, ifr->ifr_data, sizeof(options));
+		error =3D copyout(&options, ifr_data_get_ptr(ifr),
+		    sizeof(options));
 		break;
 	case GIFSOPTS:
 		if ((error =3D priv_check(curthread, PRIV_NET_GIF)) !=3D 0)
 			break;
-		error =3D copyin(ifr->ifr_data, &options, sizeof(options));
+		error =3D copyin(ifr_data_get_ptr(ifr), &options,
+		    sizeof(options));
 		if (error)
 			break;
 		if (options & ~GIF_OPTMASK)

Modified: head/sys/net/if_gre.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
--- head/sys/net/if_gre.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if_gre.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -455,7 +455,8 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 	case GRESKEY:
 		if ((error =3D priv_check(curthread, PRIV_NET_GRE)) !=3D 0)
 			break;
-		if ((error =3D copyin(ifr->ifr_data, &opt, sizeof(opt))) !=3D 0)
+		if ((error =3D copyin(ifr_data_get_ptr(ifr), &opt,
+		    sizeof(opt))) !=3D 0)
 			break;
 		if (sc->gre_key !=3D opt) {
 			GRE_WLOCK(sc);
@@ -465,13 +466,14 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		}
 		break;
 	case GREGKEY:
-		error =3D copyout(&sc->gre_key, ifr->ifr_data,
+		error =3D copyout(&sc->gre_key, ifr_data_get_ptr(ifr),
 		    sizeof(sc->gre_key));
 		break;
 	case GRESOPTS:
 		if ((error =3D priv_check(curthread, PRIV_NET_GRE)) !=3D 0)
 			break;
-		if ((error =3D copyin(ifr->ifr_data, &opt, sizeof(opt))) !=3D 0)
+		if ((error =3D copyin(ifr_data_get_ptr(ifr), &opt,
+		    sizeof(opt))) !=3D 0)
 			break;
 		if (opt & ~GRE_OPTMASK)
 			error =3D EINVAL;
@@ -486,7 +488,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		break;
=20
 	case GREGOPTS:
-		error =3D copyout(&sc->gre_options, ifr->ifr_data,
+		error =3D copyout(&sc->gre_options, ifr_data_get_ptr(ifr),
 		    sizeof(sc->gre_options));
 		break;
 	default:

Modified: head/sys/net/if_ipsec.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
--- head/sys/net/if_ipsec.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if_ipsec.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -688,12 +688,12 @@ ipsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
 		break;
 	case IPSECGREQID:
 		reqid =3D sc->reqid;
-		error =3D copyout(&reqid, ifr->ifr_data, sizeof(reqid));
+		error =3D copyout(&reqid, ifr_data_get_ptr(ifr), sizeof(reqid));
 		break;
 	case IPSECSREQID:
 		if ((error =3D priv_check(curthread, PRIV_NET_SETIFCAP)) !=3D 0)
 			break;
-		error =3D copyin(ifr->ifr_data, &reqid, sizeof(reqid));
+		error =3D copyin(ifr_data_get_ptr(ifr), &reqid, sizeof(reqid));
 		if (error !=3D 0)
 			break;
 		error =3D ipsec_set_reqid(ifp, reqid);

Modified: head/sys/net/if_spppsubr.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
--- head/sys/net/if_spppsubr.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if_spppsubr.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -5058,17 +5058,17 @@ sppp_params(struct sppp *sp, u_long cmd, void *data)
 	if ((spr =3D malloc(sizeof(struct spppreq), M_TEMP, M_NOWAIT)) =3D=3D NUL=
L)
 		return (EAGAIN);
 	/*
-	 * ifr->ifr_data is supposed to point to a struct spppreq.
+	 * ifr_data_get_ptr(ifr) is supposed to point to a struct spppreq.
 	 * Check the cmd word first before attempting to fetch all the
 	 * data.
 	 */
-	rv =3D fueword(ifr->ifr_data, &subcmd);
+	rv =3D fueword(ifr_data_get_ptr(ifr), &subcmd);
 	if (rv =3D=3D -1) {
 		rv =3D EFAULT;
 		goto quit;
 	}
=20
-	if (copyin((caddr_t)ifr->ifr_data, spr, sizeof(struct spppreq)) !=3D 0) {
+	if (copyin(ifr_data_get_ptr(ifr), spr, sizeof(struct spppreq)) !=3D 0) {
 		rv =3D EFAULT;
 		goto quit;
 	}
@@ -5105,8 +5105,8 @@ sppp_params(struct sppp *sp, u_long cmd, void *data)
 		 * setting it.
 		 */
 		spr->defs.lcp.timeout =3D sp->lcp.timeout * 1000 / hz;
-		rv =3D copyout(spr, (caddr_t)ifr->ifr_data,
-			     sizeof(struct spppreq));
+		rv =3D copyout(spr, ifr_data_get_ptr(ifr),
+		    sizeof(struct spppreq));
 		break;
=20
 	case (u_long)SPPPIOSDEFS:

Modified: head/sys/net/if_var.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
--- head/sys/net/if_var.h	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if_var.h	Fri Mar 30 18:50:13 2018	(r331797)
@@ -719,6 +719,9 @@ int drbr_enqueue_drv(if_t ifp, struct buf_ring *br, st
 void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *);
 int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsomax *);
=20
+/* accessors for struct ifreq */
+void *ifr_data_get_ptr(void *ifrp);
+
 #ifdef DEVICE_POLLING
 enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS };
=20

Modified: head/sys/net/if_vlan.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
--- head/sys/net/if_vlan.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/if_vlan.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1857,7 +1857,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
 			break;
 		}
 #endif
-		error =3D copyin(ifr->ifr_data, &vlr, sizeof(vlr));
+		error =3D copyin(ifr_data_get_ptr(ifr), &vlr, sizeof(vlr));
 		if (error)
 			break;
 		if (vlr.vlr_parent[0] =3D=3D '\0') {
@@ -1888,7 +1888,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
 			vlr.vlr_tag =3D ifv->ifv_vid;
 		}
 		VLAN_SUNLOCK();
-		error =3D copyout(&vlr, ifr->ifr_data, sizeof(vlr));
+		error =3D copyout(&vlr, ifr_data_get_ptr(ifr), sizeof(vlr));
 		break;
 	=09
 	case SIOCSIFFLAGS:

Modified: head/sys/net/iflib.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
--- head/sys/net/iflib.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net/iflib.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -3984,7 +3984,7 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
 	{
 		struct ifi2creq i2c;
=20
-		err =3D copyin(ifr->ifr_data, &i2c, sizeof(i2c));
+		err =3D copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
 		if (err !=3D 0)
 			break;
 		if (i2c.dev_addr !=3D 0xA0 && i2c.dev_addr !=3D 0xA2) {
@@ -3997,7 +3997,8 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
 		}
=20
 		if ((err =3D IFDI_I2C_REQ(ctx, &i2c)) =3D=3D 0)
-			err =3D copyout(&i2c, ifr->ifr_data, sizeof(i2c));
+			err =3D copyout(&i2c, ifr_data_get_ptr(ifr),
+			    sizeof(i2c));
 		break;
 	}
 	case SIOCSIFCAP:

Modified: head/sys/net80211/ieee80211_ioctl.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
--- head/sys/net80211/ieee80211_ioctl.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/net80211/ieee80211_ioctl.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -3567,7 +3567,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
 		break;
 	case SIOCG80211STATS:
 		ifr =3D (struct ifreq *)data;
-		copyout(&vap->iv_stats, ifr->ifr_data, sizeof (vap->iv_stats));
+		copyout(&vap->iv_stats, ifr_data_get_ptr(ifr),
+		    sizeof (vap->iv_stats));
 		break;
 	case SIOCSIFMTU:
 		ifr =3D (struct ifreq *)data;

Modified: head/sys/netinet/ip_carp.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
--- head/sys/netinet/ip_carp.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/netinet/ip_carp.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1708,7 +1708,7 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
 	struct carp_softc *sc =3D NULL;
 	int error =3D 0, locked =3D 0;
=20
-	if ((error =3D copyin(ifr->ifr_data, &carpr, sizeof carpr)))
+	if ((error =3D copyin(ifr_data_get_ptr(ifr), &carpr, sizeof carpr)))
 		return (error);
=20
 	ifp =3D ifunit_ref(ifr->ifr_name);
@@ -1824,7 +1824,8 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
 				break;
 			}
 			carp_carprcp(&carpr, sc, priveleged);
-			error =3D copyout(&carpr, ifr->ifr_data, sizeof(carpr));
+			error =3D copyout(&carpr, ifr_data_get_ptr(ifr),
+			    sizeof(carpr));
 		} else  {
 			int i, count;
=20
@@ -1842,7 +1843,8 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
 			IFNET_FOREACH_CARP(ifp, sc) {
 				carp_carprcp(&carpr, sc, priveleged);
 				carpr.carpr_count =3D count;
-				error =3D copyout(&carpr, ifr->ifr_data +
+				error =3D copyout(&carpr,
+				    (caddr_t)ifr_data_get_ptr(ifr) +
 				    (i * sizeof(carpr)), sizeof(carpr));
 				if (error) {
 					CIF_UNLOCK(ifp->if_carp);

Modified: head/sys/netpfil/pf/if_pfsync.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
--- head/sys/netpfil/pf/if_pfsync.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/netpfil/pf/if_pfsync.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -1319,7 +1319,8 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
 		pfsyncr.pfsyncr_defer =3D (PFSYNCF_DEFER =3D=3D
 		    (sc->sc_flags & PFSYNCF_DEFER));
 		PFSYNC_UNLOCK(sc);
-		return (copyout(&pfsyncr, ifr->ifr_data, sizeof(pfsyncr)));
+		return (copyout(&pfsyncr, ifr_data_get_ptr(ifr),
+		    sizeof(pfsyncr)));
=20
 	case SIOCSETPFSYNC:
 	    {
@@ -1330,7 +1331,8 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat
=20
 		if ((error =3D priv_check(curthread, PRIV_NETINET_PF)) !=3D 0)
 			return (error);
-		if ((error =3D copyin(ifr->ifr_data, &pfsyncr, sizeof(pfsyncr))))
+		if ((error =3D copyin(ifr_data_get_ptr(ifr), &pfsyncr,
+		    sizeof(pfsyncr))))
 			return (error);
=20
 		if (pfsyncr.pfsyncr_maxupdates > 255)

Modified: head/sys/security/mac/mac_net.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
--- head/sys/security/mac/mac_net.c	Fri Mar 30 18:49:52 2018	(r331796)
+++ head/sys/security/mac/mac_net.c	Fri Mar 30 18:50:13 2018	(r331797)
@@ -406,7 +406,7 @@ mac_ifnet_ioctl_get(struct ucred *cred, struct ifreq *
 	if (!(mac_labeled & MPC_OBJECT_IFNET))
 		return (EINVAL);
=20
-	error =3D copyin(ifr->ifr_ifru.ifru_data, &mac, sizeof(mac));
+	error =3D copyin(ifr_data_get_ptr(ifr), &mac, sizeof(mac));
 	if (error)
 		return (error);
=20
@@ -449,7 +449,7 @@ mac_ifnet_ioctl_set(struct ucred *cred, struct ifreq *
 	if (!(mac_labeled & MPC_OBJECT_IFNET))
 		return (EINVAL);
=20
-	error =3D copyin(ifr->ifr_ifru.ifru_data, &mac, sizeof(mac));
+	error =3D copyin(ifr_data_get_ptr(ifr), &mac, sizeof(mac));
 	if (error)
 		return (error);
=20


----- End forwarded message -----

--TA4f0niHM6tHt3xR
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJavoe8AAoJEKzQXbSebgfAR10H/1Jgnc4wPEYADf3GkfYrdqhD
eNckmUnd3uzx85hYLxpwe6NePmA3vspMg+L4cSiu9sDlytiGRTvs7ZUyv6ZF0t5V
xhawYLopwJoS21oPBGCXXPp5GwzHPdEmUFfmMC5DCcSv1HNOGGkcNGbP0A+3lhSq
IYJ/vYsM52YWxr8rp2HRxk/lbRwj20YR8Ah/CUqZj9VUeJrCa1j/hqxgJz9SK2UB
cWH7x5nGe6hxIa/77JqzbH1tV/wbnWaSRAWDNh+m/yKfDRQFsFlSqb7APDWupNs7
+eMFFV4FALb1oyvqg6hKqOzMhkW5t2mguxalWfdM2uwqJfmJNbIoKh0tcHw3K5U=
=Pxb5
-----END PGP SIGNATURE-----

--TA4f0niHM6tHt3xR--



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