git: 361ac40b0ff6 - main - IfAPI: Hide the in6m_lookup_locked() implementation.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 31 Jan 2023 20:03:10 UTC
The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=361ac40b0ff6776fb65269c41759abdff6560044 commit 361ac40b0ff6776fb65269c41759abdff6560044 Author: Justin Hibbits <jhibbits@FreeBSD.org> AuthorDate: 2023-01-25 19:09:09 +0000 Commit: Justin Hibbits <jhibbits@FreeBSD.org> CommitDate: 2023-01-31 20:02:14 +0000 IfAPI: Hide the in6m_lookup_locked() implementation. Summary: in6m_lookup_locked() iterates over the ifnet's multiaddrs list. Keep this implementation detail private, by moving the implementation to the netstack source from the header. Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, melifaro Differential Revision: https://reviews.freebsd.org/D38201 --- sys/netinet6/in6_mcast.c | 25 +++++++++++++++++++++++++ sys/netinet6/in6_var.h | 26 ++------------------------ 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 0cc8971d60d3..04c4f1aa9d93 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -345,6 +345,31 @@ im6o_mc_filter(const struct ip6_moptions *imo, const struct ifnet *ifp, return (MCAST_PASS); } +/* + * Look up an in6_multi record for an IPv6 multicast address + * on the interface ifp. + * If no record found, return NULL. + * + * SMPng: The IN6_MULTI_LOCK and must be held and must be in network epoch. + */ +struct in6_multi * +in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) +{ + struct ifmultiaddr *ifma; + struct in6_multi *inm; + + NET_EPOCH_ASSERT(); + + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) + continue; + if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) + return (inm); + } + return (NULL); +} + /* * Find and return a reference to an in6_multi record for (ifp, group), * and bump its reference count. diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index d1192201bd44..63dadf6b5207 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -776,35 +776,13 @@ static __inline struct in6_multi * in6m_ifmultiaddr_get_inm(struct ifmultiaddr *ifma) { - NET_EPOCH_ASSERT(); - return ((ifma->ifma_addr->sa_family != AF_INET6 || (ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : ifma->ifma_protospec); } -/* - * Look up an in6_multi record for an IPv6 multicast address - * on the interface ifp. - * If no record found, return NULL. - * - * SMPng: The IN6_MULTI_LOCK and must be held and must be in network epoch. - */ -static __inline struct in6_multi * -in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) -{ - struct ifmultiaddr *ifma; - struct in6_multi *inm; - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - inm = in6m_ifmultiaddr_get_inm(ifma); - if (inm == NULL) - continue; - if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) - return (inm); - } - return (NULL); -} +struct in6_multi * +in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr); /* * Wrapper for in6m_lookup_locked().