]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/mld6.c
xnu-3789.60.24.tar.gz
[apple/xnu.git] / bsd / netinet6 / mld6.c
index 38c46dd72edbc7a23d7269c0686be57d0d9eff3a..6cbcaef13458e72016e233a02904dc496529e128 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -1219,7 +1219,6 @@ mld_v2_process_group_query(struct in6_multi *inm, int timer, struct mbuf *m0,
        case MLD_IDLE_MEMBER:
        case MLD_LEAVING_MEMBER:
                return (retval);
-               break;
        case MLD_REPORTING_MEMBER:
        case MLD_G_QUERY_PENDING_MEMBER:
        case MLD_SG_QUERY_PENDING_MEMBER:
@@ -1603,6 +1602,10 @@ mld_timeout(void *arg)
                interface_timers_running6 = 0;
                LIST_FOREACH(mli, &mli_head, mli_link) {
                        MLI_LOCK(mli);
+                       if (mli->mli_version != MLD_VERSION_2) {
+                               MLI_UNLOCK(mli);
+                               continue;
+                       }
                        if (mli->mli_v2_timer == 0) {
                                /* Do nothing. */
                        } else if (--mli->mli_v2_timer == 0) {
@@ -2308,16 +2311,20 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifinfo *mli,
        VERIFY(mli->mli_ifp == ifp);
 
        /*
-        * Groups joined on loopback or marked as 'not reported',
-        * enter the MLD_SILENT_MEMBER state and
-        * are never reported in any protocol exchanges.
+        * Avoid MLD if group is :
+        * 1. Joined on loopback, OR
+        * 2. On a link that is marked MLIF_SILENT
+        * 3. rdar://problem/19227650 Is link local scoped and
+        *    on cellular interface
+        * 4. Is a type that should not be reported (node local
+        *    or all node link local multicast.
         * All other groups enter the appropriate state machine
         * for the version in use on this link.
-        * A link marked as MLIF_SILENT causes MLD to be completely
-        * disabled for the link.
         */
        if ((ifp->if_flags & IFF_LOOPBACK) ||
            (mli->mli_flags & MLIF_SILENT) ||
+           (IFNET_IS_CELLULAR(ifp) &&
+            IN6_IS_ADDR_MC_LINKLOCAL(&inm->in6m_addr)) ||
            !mld_is_addr_reported(&inm->in6m_addr)) {
                MLD_PRINTF(("%s: not kicking state machine for silent group\n",
                    __func__));
@@ -2487,7 +2494,10 @@ mld_handle_state_change(struct in6_multi *inm, struct mld_ifinfo *mli,
                MLI_UNLOCK(mli);
                retval *= -1;
                goto done;
+       } else {
+               retval = 0;
        }
+
        /*
         * If record(s) were enqueued, start the state-change
         * report timer for this group.
@@ -3453,11 +3463,7 @@ mld_dispatch_packet(struct mbuf *m)
        }
 
        im6o->im6o_multicast_hlim  = 1;
-#if MROUTING
-       im6o->im6o_multicast_loop = (ip6_mrouter != NULL);
-#else
        im6o->im6o_multicast_loop = 0;
-#endif
        im6o->im6o_multicast_ifp = ifp;
 
        if (m->m_flags & M_MLDV1) {
@@ -3609,22 +3615,16 @@ mld_rec_type_to_str(const int type)
        switch (type) {
                case MLD_CHANGE_TO_EXCLUDE_MODE:
                        return "TO_EX";
-                       break;
                case MLD_CHANGE_TO_INCLUDE_MODE:
                        return "TO_IN";
-                       break;
                case MLD_MODE_IS_EXCLUDE:
                        return "MODE_EX";
-                       break;
                case MLD_MODE_IS_INCLUDE:
                        return "MODE_IN";
-                       break;
                case MLD_ALLOW_NEW_SOURCES:
                        return "ALLOW_NEW";
-                       break;
                case MLD_BLOCK_OLD_SOURCES:
                        return "BLOCK_OLD";
-                       break;
                default:
                        break;
        }