Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6_var.h
Show First 20 Lines • Show All 723 Lines • ▼ Show 20 Lines | in6m_ifmultiaddr_get_inm(struct ifmultiaddr *ifma) | ||||
NET_EPOCH_ASSERT(); | NET_EPOCH_ASSERT(); | ||||
return ((ifma->ifma_addr->sa_family != AF_INET6 || | return ((ifma->ifma_addr->sa_family != AF_INET6 || | ||||
(ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : | (ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : | ||||
ifma->ifma_protospec); | ifma->ifma_protospec); | ||||
} | } | ||||
/* Acquire an in6_multi record. */ | |||||
static __inline void | |||||
in6m_acquire_locked(struct in6_multi *inm) | |||||
{ | |||||
IN6_MULTI_LIST_LOCK_ASSERT(); | |||||
++inm->in6m_refcount; | |||||
} | |||||
static __inline void | |||||
in6m_acquire(struct in6_multi *inm) | |||||
{ | |||||
IN6_MULTI_LIST_LOCK(); | |||||
in6m_acquire_locked(inm); | |||||
IN6_MULTI_LIST_UNLOCK(); | |||||
} | |||||
static __inline void | |||||
in6m_rele_locked(struct in6_multi_head *inmh, struct in6_multi *inm) | |||||
{ | |||||
KASSERT(inm->in6m_refcount > 0, ("refcount == %d inm: %p", inm->in6m_refcount, inm)); | |||||
IN6_MULTI_LIST_LOCK_ASSERT(); | |||||
if (--inm->in6m_refcount == 0) { | |||||
in6m_disconnect_locked(inmh, inm); | |||||
MPASS(inm->in6m_ifp == NULL); | |||||
inm->in6m_ifma->ifma_protospec = NULL; | |||||
MPASS(inm->in6m_ifma->ifma_llifma == NULL); | |||||
SLIST_INSERT_HEAD(inmh, inm, in6m_nrele); | |||||
} | |||||
} | |||||
/* | /* | ||||
* Look up an in6_multi record for an IPv6 multicast address | * Look up an in6_multi record for an IPv6 multicast address | ||||
* on the interface ifp. | * on the interface ifp. | ||||
* If no record found, return NULL. | * If no record found, return NULL. | ||||
*/ | */ | ||||
static __inline struct in6_multi * | static __inline struct in6_multi * | ||||
in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) | in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) | ||||
{ | { | ||||
struct ifmultiaddr *ifma; | struct ifmultiaddr *ifma; | ||||
struct in6_multi *inm; | struct in6_multi *inm; | ||||
CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { | CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { | ||||
inm = in6m_ifmultiaddr_get_inm(ifma); | inm = in6m_ifmultiaddr_get_inm(ifma); | ||||
if (inm == NULL) | if (inm == NULL) | ||||
continue; | continue; | ||||
if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) | if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) { | ||||
in6m_acquire_locked(inm); | |||||
return (inm); | return (inm); | ||||
} | } | ||||
} | |||||
return (NULL); | return (NULL); | ||||
} | } | ||||
int in6m_remove_members(struct in6_multi_head *inmh, struct in6_multi *inm); | |||||
/* | /* | ||||
* Wrapper for in6m_lookup_locked(). | * Wrapper for in6m_lookup_locked(). | ||||
* | * | ||||
* SMPng: Assumes that neithr the IN6_MULTI_LOCK() or IF_ADDR_LOCK() are held. | * SMPng: Assumes that neithr the IN6_MULTI_LOCK() or IF_ADDR_LOCK() are held. | ||||
*/ | */ | ||||
static __inline struct in6_multi * | static __inline struct in6_multi * | ||||
in6m_lookup(struct ifnet *ifp, const struct in6_addr *mcaddr) | in6m_lookup(struct ifnet *ifp, const struct in6_addr *mcaddr) | ||||
{ | { | ||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
struct in6_multi *inm; | struct in6_multi *inm; | ||||
IN6_MULTI_LIST_LOCK(); | IN6_MULTI_LIST_LOCK(); | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
inm = in6m_lookup_locked(ifp, mcaddr); | inm = in6m_lookup_locked(ifp, mcaddr); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
IN6_MULTI_LIST_UNLOCK(); | IN6_MULTI_LIST_UNLOCK(); | ||||
return (inm); | return (inm); | ||||
} | } | ||||
/* Acquire an in6_multi record. */ | |||||
static __inline void | |||||
in6m_acquire_locked(struct in6_multi *inm) | |||||
{ | |||||
IN6_MULTI_LIST_LOCK_ASSERT(); | |||||
++inm->in6m_refcount; | |||||
} | |||||
static __inline void | |||||
in6m_acquire(struct in6_multi *inm) | |||||
{ | |||||
IN6_MULTI_LIST_LOCK(); | |||||
in6m_acquire_locked(inm); | |||||
IN6_MULTI_LIST_UNLOCK(); | |||||
} | |||||
static __inline void | |||||
in6m_rele_locked(struct in6_multi_head *inmh, struct in6_multi *inm) | |||||
{ | |||||
KASSERT(inm->in6m_refcount > 0, ("refcount == %d inm: %p", inm->in6m_refcount, inm)); | |||||
IN6_MULTI_LIST_LOCK_ASSERT(); | |||||
if (--inm->in6m_refcount == 0) { | |||||
MPASS(inm->in6m_ifp == NULL); | |||||
inm->in6m_ifma->ifma_protospec = NULL; | |||||
MPASS(inm->in6m_ifma->ifma_llifma == NULL); | |||||
SLIST_INSERT_HEAD(inmh, inm, in6m_nrele); | |||||
} | |||||
} | |||||
struct ip6_moptions; | struct ip6_moptions; | ||||
struct sockopt; | struct sockopt; | ||||
struct inpcbinfo; | struct inpcbinfo; | ||||
/* Multicast KPIs. */ | /* Multicast KPIs. */ | ||||
int im6o_mc_filter(const struct ip6_moptions *, const struct ifnet *, | int im6o_mc_filter(const struct ip6_moptions *, const struct ifnet *, | ||||
const struct sockaddr *, const struct sockaddr *); | const struct sockaddr *, const struct sockaddr *); | ||||
int in6_joingroup(struct ifnet *, const struct in6_addr *, | int in6_joingroup(struct ifnet *, const struct in6_addr *, | ||||
struct in6_mfilter *, struct in6_multi **, int); | struct in6_mfilter *, struct in6_multi **, int); | ||||
int in6_joingroup_locked(struct ifnet *, const struct in6_addr *, | int in6_joingroup_locked(struct ifnet *, const struct in6_addr *, | ||||
struct in6_mfilter *, struct in6_multi **, int); | struct in6_mfilter *, struct in6_multi **, int); | ||||
int in6_leavegroup(struct in6_multi *, struct in6_mfilter *); | int in6_leavegroup(struct in6_multi *, struct in6_mfilter *); | ||||
int in6_leavegroup_locked(struct in6_multi *, struct in6_mfilter *); | int in6_leavegroup_locked(struct in6_multi *, struct in6_mfilter *); | ||||
void in6m_clear_recorded(struct in6_multi *); | void in6m_clear_recorded(struct in6_multi *); | ||||
void in6m_commit(struct in6_multi *); | void in6m_commit(struct in6_multi *); | ||||
void in6m_print(const struct in6_multi *); | void in6m_print(const struct in6_multi *); | ||||
int in6m_record_source(struct in6_multi *, const struct in6_addr *); | int in6m_record_source(struct in6_multi *, const struct in6_addr *); | ||||
void in6m_release_list_deferred(struct in6_multi_head *); | void in6m_release_list_deferred(struct in6_multi_head *); | ||||
void in6m_release_deferred(struct in6_multi *); | |||||
void in6m_release_wait(void); | void in6m_release_wait(void); | ||||
void ip6_freemoptions(struct ip6_moptions *); | void ip6_freemoptions(struct ip6_moptions *); | ||||
int ip6_getmoptions(struct inpcb *, struct sockopt *); | int ip6_getmoptions(struct inpcb *, struct sockopt *); | ||||
int ip6_setmoptions(struct inpcb *, struct sockopt *); | int ip6_setmoptions(struct inpcb *, struct sockopt *); | ||||
/* flags to in6_update_ifa */ | /* flags to in6_update_ifa */ | ||||
#define IN6_IFAUPDATE_DADDELAY 0x1 /* first time to configure an address */ | #define IN6_IFAUPDATE_DADDELAY 0x1 /* first time to configure an address */ | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |