svn commit: r277600 - in projects/ifnet/sys: dev/virtio/network net

Gleb Smirnoff glebius at FreeBSD.org
Fri Jan 23 19:22:20 UTC 2015


Author: glebius
Date: Fri Jan 23 19:22:18 2015
New Revision: 277600
URL: https://svnweb.freebsd.org/changeset/base/277600

Log:
  Revert tiny part of r277456. Looks like we are stuck with 16-bit
  ifr_flags forever :(

Modified:
  projects/ifnet/sys/dev/virtio/network/if_vtnet.c
  projects/ifnet/sys/net/if.c
  projects/ifnet/sys/net/if.h

Modified: projects/ifnet/sys/dev/virtio/network/if_vtnet.c
==============================================================================
--- projects/ifnet/sys/dev/virtio/network/if_vtnet.c	Fri Jan 23 19:19:34 2015	(r277599)
+++ projects/ifnet/sys/dev/virtio/network/if_vtnet.c	Fri Jan 23 19:22:18 2015	(r277600)
@@ -3072,11 +3072,11 @@ vtnet_attach_disable_promisc(struct vtne
 	VTNET_CORE_LOCK(sc);
 	if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0) {
 		(void )if_drvioctl(SIOCGIFFLAGS, ifp, &ifr, curthread);
-		ifr.ifr_flagslow |= IFF_PROMISC;
+		ifr.ifr_flags |= IFF_PROMISC;
 		(void )if_drvioctl(SIOCSIFFLAGS, ifp, &ifr, curthread);
 	} else if (vtnet_set_promisc(sc, 0) != 0) {
 		(void )if_drvioctl(SIOCGIFFLAGS, ifp, &ifr, curthread);
-		ifr.ifr_flagslow |= IFF_PROMISC;
+		ifr.ifr_flags |= IFF_PROMISC;
 		(void )if_drvioctl(SIOCSIFFLAGS, ifp, &ifr, curthread);
 		device_printf(sc->vtnet_dev,
 		    "cannot disable default promiscuous mode\n");

Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c	Fri Jan 23 19:19:34 2015	(r277599)
+++ projects/ifnet/sys/net/if.c	Fri Jan 23 19:22:18 2015	(r277600)
@@ -2302,8 +2302,14 @@ if_drvioctl(u_long cmd, struct ifnet *if
 		break;
 
 	case SIOCGIFFLAGS:
-		ifr->ifr_flagslow = ifp->if_flags & 0xffff;
+		ifr->ifr_flags = ifp->if_flags & 0xffff;
 		ifr->ifr_flagshigh = ifp->if_flags >> 16;
+		/*
+		 * Some software may care about IFF_RUNNING, so make
+		 * it happy.
+		 */
+		if (ifp->if_flags & IFF_UP)
+			ifr->ifr_flags |= IFF_RUNNING;
 		break;
 
 	case SIOCGIFCAP:
@@ -2406,7 +2412,7 @@ if_drvioctl(u_long cmd, struct ifnet *if
 		 * they come from userland in two parts, that
 		 * we need to swap.
 		 */
-		flags = (ifr->ifr_flagslow & 0xffff) |
+		flags = (ifr->ifr_flags & 0xffff) |
 		    (ifr->ifr_flagshigh << 16);
 		if ((flags & IFF_CANTCHANGE) !=
 		    (ifp->if_flags & IFF_CANTCHANGE))
@@ -2414,11 +2420,11 @@ if_drvioctl(u_long cmd, struct ifnet *if
 		/*
 		 * Pass new flags down to driver and see if it accepts them.
 		 */
-		ifr->ifr_flags = flags;
 		error = if_ioctl(ifp, cmd, data, td);
 		if (error)
 			return (error);
-		flags = ifr->ifr_flags;
+		flags = (ifr->ifr_flags & 0xffff) |
+		    (ifr->ifr_flagshigh << 16);
 		/*
 		 * Manage IFF_UP flip.
 		 */

Modified: projects/ifnet/sys/net/if.h
==============================================================================
--- projects/ifnet/sys/net/if.h	Fri Jan 23 19:19:34 2015	(r277599)
+++ projects/ifnet/sys/net/if.h	Fri Jan 23 19:22:18 2015	(r277600)
@@ -382,8 +382,7 @@ struct	ifreq {
 			uint32_t ifrucap_curcap;	/* current values */
 			uint64_t ifrucap_hwassist;	/* returned hwassist */
 		}	ifru_cap;
-		u_int	ifru_flags;
-		short	ifru_sflags[2];
+		short	ifru_flags[2];
 		short	ifru_index;
 		int	ifru_jid;
 		int	ifru_metric;
@@ -397,9 +396,8 @@ struct	ifreq {
 #define	ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-to-p link */
 #define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address */
 #define	ifr_buffer	ifr_ifru.ifru_buffer	/* user supplied buffer with its length */
-#define	ifr_flags	ifr_ifru.ifru_flags	/* flags (after fixup) */
-#define	ifr_flagslow	ifr_ifru.ifru_sflags[0]	/* flags (low 16 bits) */
-#define	ifr_flagshigh	ifr_ifru.ifru_sflags[1]	/* flags (high 16 bits) */
+#define	ifr_flags	ifr_ifru.ifru_flags[0]	/* flags (low 16 bits) */
+#define	ifr_flagshigh	ifr_ifru.ifru_flags[1]	/* flags (high 16 bits) */
 #define	ifr_jid		ifr_ifru.ifru_jid	/* jail/vnet */
 #define	ifr_metric	ifr_ifru.ifru_metric	/* metric */
 #define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu */


More information about the svn-src-projects mailing list