Author: syrinx
Date: Sun Jan 31 11:30:28 2010
New Revision: 203274
URL: http://svn.freebsd.org/changeset/base/203274

Log:
  MFC r202935:
  While flushing the multicast filter of an interface, do not zero the relevant
  ifmultiaddr structures' reference to the parent interface, unless the parent
  interface is really detaching. While here, program only link layer multicast
  filters to a wlan's hardware parent interface.
  
  PR:           kern/142391, kern/142392
  Reviewed by:  sam, rpaulo, bms

Modified:
  stable/8/sys/net/if.c
  stable/8/sys/net/if_var.h
  stable/8/sys/net80211/ieee80211_ioctl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c       Sun Jan 31 11:20:27 2010        (r203273)
+++ stable/8/sys/net/if.c       Sun Jan 31 11:30:28 2010        (r203274)
@@ -773,9 +773,10 @@ if_purgeaddrs(struct ifnet *ifp)
 }
 
 /*
- * Remove any multicast network addresses from an interface.
+ * Remove any multicast network addresses from an interface when an ifnet
+ * is going away.
  */
-void
+static void
 if_purgemaddrs(struct ifnet *ifp)
 {
        struct ifmultiaddr *ifma;
@@ -3005,6 +3006,22 @@ if_delmulti(struct ifnet *ifp, struct so
 }
 
 /*
+ * Delete all multicast group membership for an interface.
+ * Should be used to quickly flush all multicast filters.
+ */
+void
+if_delallmulti(struct ifnet *ifp)
+{
+       struct ifmultiaddr *ifma;
+       struct ifmultiaddr *next;
+
+       IF_ADDR_LOCK(ifp);
+       TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next)
+               if_delmulti_locked(ifp, ifma, 0);
+       IF_ADDR_UNLOCK(ifp);
+}
+
+/*
  * Delete a multicast group membership by group membership pointer.
  * Network-layer protocol domains must use this routine.
  *

Modified: stable/8/sys/net/if_var.h
==============================================================================
--- stable/8/sys/net/if_var.h   Sun Jan 31 11:20:27 2010        (r203273)
+++ stable/8/sys/net/if_var.h   Sun Jan 31 11:30:28 2010        (r203274)
@@ -832,7 +832,7 @@ void        if_delmulti_ifma(struct ifmultiaddr
 void   if_detach(struct ifnet *);
 void   if_vmove(struct ifnet *, struct vnet *);
 void   if_purgeaddrs(struct ifnet *);
-void   if_purgemaddrs(struct ifnet *);
+void   if_delallmulti(struct ifnet *);
 void   if_down(struct ifnet *);
 struct ifmultiaddr *
        if_findmulti(struct ifnet *, struct sockaddr *);

Modified: stable/8/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_ioctl.c     Sun Jan 31 11:20:27 2010        
(r203273)
+++ stable/8/sys/net80211/ieee80211_ioctl.c     Sun Jan 31 11:30:28 2010        
(r203274)
@@ -3199,15 +3199,18 @@ ieee80211_ioctl_updatemulti(struct ieee8
        void *ioctl;
 
        IEEE80211_LOCK(ic);
-       if_purgemaddrs(parent);
+       if_delallmulti(parent);
        ioctl = parent->if_ioctl;       /* XXX WAR if_allmulti */
        parent->if_ioctl = NULL;
        TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
                struct ifnet *ifp = vap->iv_ifp;
                struct ifmultiaddr *ifma;
 
-               TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
+               TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+                       if (ifma->ifma_addr->sa_family != AF_LINK)
+                               continue;
                        (void) if_addmulti(parent, ifma->ifma_addr, NULL);
+               }
        }
        parent->if_ioctl = ioctl;
        ieee80211_runtask(ic, &ic->ic_mcast_task);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to