svn commit: r279819 - head/sys/dev/hyperv/netvsc

Xin LI delphij at FreeBSD.org
Mon Mar 9 20:11:17 UTC 2015


Author: delphij
Date: Mon Mar  9 20:11:16 2015
New Revision: 279819
URL: https://svnweb.freebsd.org/changeset/base/279819

Log:
  Fix CARP when in use in a HyperV environment:
  
   - Bump link state when stopping or starting the interface;
   - Don't handle SIOCGIFADDR specially, similar to r277103.
  
  This change is based on a previous revision from Andy Zhang
  (Microsoft) who did the diagnostic work and many thanks to
  them for their help in supporting the HyperV work.
  
  PR:		kern/187203
  MFC after:	2 weeks

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Mon Mar  9 18:24:29 2015	(r279818)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Mon Mar  9 20:11:16 2015	(r279819)
@@ -736,7 +736,14 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 	switch(cmd) {
 
 	case SIOCSIFADDR:
-	case SIOCGIFADDR:
+#ifdef INET
+		if (ifa->ifa_addr->sa_family == AF_INET) {
+			ifp->if_flags |= IFF_UP;
+			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+				hn_ifinit(sc);
+			arp_ifinit(ifp, ifa);
+		} else
+#endif
 		error = ether_ioctl(ifp, cmd, data);
 		break;
 	case SIOCSIFMTU:
@@ -900,6 +907,7 @@ hn_stop(hn_softc_t *sc)
 		printf(" Closing Device ...\n");
 
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+	if_link_state_change(ifp, LINK_STATE_DOWN);
 	sc->hn_initdone = 0;
 
 	ret = hv_rf_on_close(device_ctx);
@@ -949,6 +957,7 @@ hn_ifinit_locked(hn_softc_t *sc)
 	}
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	if_link_state_change(ifp, LINK_STATE_UP);
 }
 
 /*


More information about the svn-src-head mailing list