/*
- * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#else
struct mld_ifinfo_u {
#endif /* XNU_KERNEL_PRIVATE */
- uint32_t mli_ifindex; /* interface this instance belongs to */
- uint32_t mli_version; /* MLDv1 Host Compatibility Mode */
- uint32_t mli_v1_timer; /* MLDv1 Querier Present timer (s) */
- uint32_t mli_v2_timer; /* MLDv2 General Query (interface) timer (s)*/
- uint32_t mli_flags; /* MLD per-interface flags */
- uint32_t mli_rv; /* MLDv2 Robustness Variable */
- uint32_t mli_qi; /* MLDv2 Query Interval (s) */
- uint32_t mli_qri; /* MLDv2 Query Response Interval (s) */
- uint32_t mli_uri; /* MLDv2 Unsolicited Report Interval (s) */
+ uint32_t mli_ifindex; /* interface this instance belongs to */
+ uint32_t mli_version; /* MLDv1 Host Compatibility Mode */
+ uint32_t mli_v1_timer; /* MLDv1 Querier Present timer (s) */
+ uint32_t mli_v2_timer; /* MLDv2 General Query (interface) timer (s)*/
+ uint32_t mli_flags; /* MLD per-interface flags */
+ uint32_t mli_rv; /* MLDv2 Robustness Variable */
+ uint32_t mli_qi; /* MLDv2 Query Interval (s) */
+ uint32_t mli_qri; /* MLDv2 Query Response Interval (s) */
+ uint32_t mli_uri; /* MLDv2 Unsolicited Report Interval (s) */
uint32_t _pad;
};
-#define MLIF_SILENT 0x00000001 /* Do not use MLD on this ifp */
-#define MLIF_USEALLOW 0x00000002 /* Use ALLOW/BLOCK for joins/leaves */
+#define MLIF_SILENT 0x00000001 /* Do not use MLD on this ifp */
+#define MLIF_USEALLOW 0x00000002 /* Use ALLOW/BLOCK for joins/leaves */
+#define MLIF_PROCESSED 0x00000004 /* Entry has been processed and can be skipped */
/*
* MLD version tag.
*/
-#define MLD_VERSION_NONE 0 /* Invalid */
-#define MLD_VERSION_1 1
-#define MLD_VERSION_2 2 /* Default */
+#define MLD_VERSION_NONE 0 /* Invalid */
+#define MLD_VERSION_1 1
+#define MLD_VERSION_2 2 /* Default */
#endif /* PRIVATE */
#ifdef BSD_KERNEL_PRIVATE
#define MLD_DEBUG 1
#ifdef MLD_DEBUG
extern int mld_debug;
-#define MLD_PRINTF(x) do { if (mld_debug) printf x; } while (0)
+#define MLD_PRINTF(x) do { if (mld_debug) printf x; } while (0)
#else
-#define MLD_PRINTF(x)
+#define MLD_PRINTF(x)
#endif
-#define MLD_RANDOM_DELAY(X) (RandomULong() % (X) + 1)
-#define MLD_MAX_STATE_CHANGES 24 /* Max pending changes per group */
+#define MLD_RANDOM_DELAY(X) (RandomULong() % (X) + 1)
+#define MLD_MAX_STATE_CHANGES 24 /* Max pending changes per group */
/*
* MLD per-group states.
*/
-#define MLD_NOT_MEMBER 0 /* Can garbage collect group */
-#define MLD_SILENT_MEMBER 1 /* Do not perform MLD for group */
-#define MLD_REPORTING_MEMBER 2 /* MLDv1 we are reporter */
-#define MLD_IDLE_MEMBER 3 /* MLDv1 we reported last */
-#define MLD_LAZY_MEMBER 4 /* MLDv1 other member reporting */
-#define MLD_SLEEPING_MEMBER 5 /* MLDv1 start query response */
-#define MLD_AWAKENING_MEMBER 6 /* MLDv1 group timer will start */
-#define MLD_G_QUERY_PENDING_MEMBER 7 /* MLDv2 group query pending */
-#define MLD_SG_QUERY_PENDING_MEMBER 8 /* MLDv2 source query pending */
-#define MLD_LEAVING_MEMBER 9 /* MLDv2 dying gasp (pending last */
- /* retransmission of INCLUDE {}) */
+#define MLD_NOT_MEMBER 0 /* Can garbage collect group */
+#define MLD_SILENT_MEMBER 1 /* Do not perform MLD for group */
+#define MLD_REPORTING_MEMBER 2 /* MLDv1 we are reporter */
+#define MLD_IDLE_MEMBER 3 /* MLDv1 we reported last */
+#define MLD_LAZY_MEMBER 4 /* MLDv1 other member reporting */
+#define MLD_SLEEPING_MEMBER 5 /* MLDv1 start query response */
+#define MLD_AWAKENING_MEMBER 6 /* MLDv1 group timer will start */
+#define MLD_G_QUERY_PENDING_MEMBER 7 /* MLDv2 group query pending */
+#define MLD_SG_QUERY_PENDING_MEMBER 8 /* MLDv2 source query pending */
+#define MLD_LEAVING_MEMBER 9 /* MLDv2 dying gasp (pending last */
+ /* retransmission of INCLUDE {}) */
/*
* MLDv2 protocol control variables.
*/
-#define MLD_RV_INIT 2 /* Robustness Variable */
-#define MLD_RV_MIN 1
-#define MLD_RV_MAX 7
+#define MLD_RV_INIT 2 /* Robustness Variable */
+#define MLD_RV_MIN 1
+#define MLD_RV_MAX 7
-#define MLD_QI_INIT 125 /* Query Interval (s) */
-#define MLD_QI_MIN 1
-#define MLD_QI_MAX 255
+#define MLD_QI_INIT 125 /* Query Interval (s) */
+#define MLD_QI_MIN 1
+#define MLD_QI_MAX 255
-#define MLD_QRI_INIT 10 /* Query Response Interval (s) */
-#define MLD_QRI_MIN 1
-#define MLD_QRI_MAX 255
+#define MLD_QRI_INIT 10 /* Query Response Interval (s) */
+#define MLD_QRI_MIN 1
+#define MLD_QRI_MAX 255
-#define MLD_URI_INIT 3 /* Unsolicited Report Interval (s) */
-#define MLD_URI_MIN 0
-#define MLD_URI_MAX 10
+#define MLD_URI_INIT 3 /* Unsolicited Report Interval (s) */
+#define MLD_URI_MIN 0
+#define MLD_URI_MAX 10
-#define MLD_MAX_GS_SOURCES 256 /* # of sources in rx GS query */
-#define MLD_MAX_G_GS_PACKETS 8 /* # of packets to answer G/GS */
-#define MLD_MAX_STATE_CHANGE_PACKETS 8 /* # of packets per state change */
-#define MLD_MAX_RESPONSE_PACKETS 16 /* # of packets for general query */
-#define MLD_MAX_RESPONSE_BURST 4 /* # of responses to send at once */
-#define MLD_RESPONSE_BURST_INTERVAL 1 /* 1 second */
+#define MLD_MAX_GS_SOURCES 256 /* # of sources in rx GS query */
+#define MLD_MAX_G_GS_PACKETS 8 /* # of packets to answer G/GS */
+#define MLD_MAX_STATE_CHANGE_PACKETS 8 /* # of packets per state change */
+#define MLD_MAX_RESPONSE_PACKETS 16 /* # of packets for general query */
+#define MLD_MAX_RESPONSE_BURST 4 /* # of responses to send at once */
+#define MLD_RESPONSE_BURST_INTERVAL 1 /* 1 second */
/*
* MLD-specific mbuf flags.
*/
-#define M_MLDV1 M_PROTO1 /* Packet is MLDv1 */
-#define M_GROUPREC M_PROTO3 /* mbuf chain is a group record */
+#define M_MLDV1 M_PROTO1 /* Packet is MLDv1 */
+#define M_GROUPREC M_PROTO3 /* mbuf chain is a group record */
/*
* Leading space for MLDv2 reports inside MTU.
* We now put the MLDv2 report header in the initial mbuf containing
* the IPv6 header.
*/
-#define MLD_MTUSPACE (sizeof(struct ip6_hdr) + sizeof(struct mld_raopt) + \
- sizeof(struct icmp6_hdr))
+#define MLD_MTUSPACE (sizeof(struct ip6_hdr) + sizeof(struct mld_raopt) + \
+ sizeof(struct icmp6_hdr))
struct mld_ifinfo {
decl_lck_mtx_data(, mli_lock);
- uint32_t mli_refcnt; /* reference count */
- uint32_t mli_debug; /* see ifa_debug flags */
+ uint32_t mli_refcnt; /* reference count */
+ uint32_t mli_debug; /* see ifa_debug flags */
LIST_ENTRY(mld_ifinfo) mli_link;
- struct ifnet *mli_ifp; /* interface this instance belongs to */
- uint32_t mli_version; /* MLDv1 Host Compatibility Mode */
- uint32_t mli_v1_timer; /* MLDv1 Querier Present timer (s) */
- uint32_t mli_v2_timer; /* MLDv2 General Query (interface) timer (s)*/
- uint32_t mli_flags; /* MLD per-interface flags */
- uint32_t mli_rv; /* MLDv2 Robustness Variable */
- uint32_t mli_qi; /* MLDv2 Query Interval (s) */
- uint32_t mli_qri; /* MLDv2 Query Response Interval (s) */
- uint32_t mli_uri; /* MLDv2 Unsolicited Report Interval (s) */
- SLIST_HEAD(,in6_multi) mli_relinmhead; /* released groups */
- struct ifqueue mli_gq; /* queue of general query responses */
+ struct ifnet *mli_ifp; /* interface this instance belongs to */
+ uint32_t mli_version; /* MLDv1 Host Compatibility Mode */
+ uint32_t mli_v1_timer; /* MLDv1 Querier Present timer (s) */
+ uint32_t mli_v2_timer; /* MLDv2 General Query (interface) timer (s)*/
+ uint32_t mli_flags; /* MLD per-interface flags */
+ uint32_t mli_rv; /* MLDv2 Robustness Variable */
+ uint32_t mli_qi; /* MLDv2 Query Interval (s) */
+ uint32_t mli_qri; /* MLDv2 Query Response Interval (s) */
+ uint32_t mli_uri; /* MLDv2 Unsolicited Report Interval (s) */
+ SLIST_HEAD(, in6_multi) mli_relinmhead; /* released groups */
+ struct ifqueue mli_gq; /* queue of general query responses */
struct ifqueue mli_v1q; /* MLDv1 message queue */
};
-#define MLI_LOCK_ASSERT_HELD(_mli) \
- lck_mtx_assert(&(_mli)->mli_lock, LCK_MTX_ASSERT_OWNED)
+#define MLI_LOCK_ASSERT_HELD(_mli) \
+ LCK_MTX_ASSERT(&(_mli)->mli_lock, LCK_MTX_ASSERT_OWNED)
-#define MLI_LOCK_ASSERT_NOTHELD(_mli) \
- lck_mtx_assert(&(_mli)->mli_lock, LCK_MTX_ASSERT_NOTOWNED)
+#define MLI_LOCK_ASSERT_NOTHELD(_mli) \
+ LCK_MTX_ASSERT(&(_mli)->mli_lock, LCK_MTX_ASSERT_NOTOWNED)
-#define MLI_LOCK(_mli) \
+#define MLI_LOCK(_mli) \
lck_mtx_lock(&(_mli)->mli_lock)
-#define MLI_LOCK_SPIN(_mli) \
+#define MLI_LOCK_SPIN(_mli) \
lck_mtx_lock_spin(&(_mli)->mli_lock)
-#define MLI_CONVERT_LOCK(_mli) do { \
- MLI_LOCK_ASSERT_HELD(_mli); \
- lck_mtx_convert_spin(&(_mli)->mli_lock); \
+#define MLI_CONVERT_LOCK(_mli) do { \
+ MLI_LOCK_ASSERT_HELD(_mli); \
+ lck_mtx_convert_spin(&(_mli)->mli_lock); \
} while (0)
-#define MLI_UNLOCK(_mli) \
+#define MLI_UNLOCK(_mli) \
lck_mtx_unlock(&(_mli)->mli_lock)
-#define MLI_ADDREF(_mli) \
+#define MLI_ADDREF(_mli) \
mli_addref(_mli, 0)
-#define MLI_ADDREF_LOCKED(_mli) \
+#define MLI_ADDREF_LOCKED(_mli) \
mli_addref(_mli, 1)
-#define MLI_REMREF(_mli) \
+#define MLI_REMREF(_mli) \
mli_remref(_mli)
/*
* Per-link MLD context.
*/
-#define MLD_IFINFO(ifp) ((ifp)->if_mli)
+#define MLD_IFINFO(ifp) ((ifp)->if_mli)
/*
* MLD timer schedule parameters
*/
struct mld_tparams {
- int qpt; /* querier_present_timers_running6 */
- int it; /* interface_timers_running6 */
- int cst; /* current_state_timers_running6 */
- int sct; /* state_change_timers_running6 */
+ int qpt; /* querier_present_timers_running6 */
+ int it; /* interface_timers_running6 */
+ int cst; /* current_state_timers_running6 */
+ int sct; /* state_change_timers_running6 */
};
extern int mld_change_state(struct in6_multi *, struct mld_tparams *,
const int);
-extern struct mld_ifinfo *mld_domifattach(struct ifnet *, int);
+extern struct mld_ifinfo *mld_domifattach(struct ifnet *, zalloc_flags_t);
extern void mld_domifreattach(struct mld_ifinfo *);
extern void mld_domifdetach(struct ifnet *);
extern void mld_fasttimo(void);