mld6.c (33cde13046eaba762428c55bb5d5e07c1a7c5f33) mld6.c (f6dfe47a145263dc5eb67fa4789925ab708709bc)
1/*-
2 * Copyright (c) 2009 Bruce Simpson.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 421 unchanged lines hidden (view full) ---

430 * Note: This is not the same as the *multicast* scope.
431 *
432 * Return zero if the given group is one for which MLD reports
433 * should be suppressed, or non-zero if reports should be issued.
434 */
435static __inline int
436mld_is_addr_reported(const struct in6_addr *addr)
437{
1/*-
2 * Copyright (c) 2009 Bruce Simpson.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 421 unchanged lines hidden (view full) ---

430 * Note: This is not the same as the *multicast* scope.
431 *
432 * Return zero if the given group is one for which MLD reports
433 * should be suppressed, or non-zero if reports should be issued.
434 */
435static __inline int
436mld_is_addr_reported(const struct in6_addr *addr)
437{
438 INIT_VNET_INET6(curvnet);
439
440 KASSERT(IN6_IS_ADDR_MULTICAST(addr), ("%s: not multicast", __func__));
441
442 if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_NODELOCAL)
443 return (0);
444
445 if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_LINKLOCAL) {
446 struct in6_addr tmp = *addr;

--- 187 unchanged lines hidden (view full) ---

634/*
635 * Process a received MLDv1 general or address-specific query.
636 * Assumes that the query header has been pulled up to sizeof(mld_hdr).
637 */
638static int
639mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6,
640 const struct mld_hdr *mld)
641{
438
439 KASSERT(IN6_IS_ADDR_MULTICAST(addr), ("%s: not multicast", __func__));
440
441 if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_NODELOCAL)
442 return (0);
443
444 if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_LINKLOCAL) {
445 struct in6_addr tmp = *addr;

--- 187 unchanged lines hidden (view full) ---

633/*
634 * Process a received MLDv1 general or address-specific query.
635 * Assumes that the query header has been pulled up to sizeof(mld_hdr).
636 */
637static int
638mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6,
639 const struct mld_hdr *mld)
640{
642 INIT_VNET_INET6(ifp->if_vnet);
643 struct ifmultiaddr *ifma;
644 struct mld_ifinfo *mli;
645 struct in6_multi *inm;
646 uint16_t timer;
647#ifdef KTR
648 char ip6tbuf[INET6_ADDRSTRLEN];
649#endif
650

--- 378 unchanged lines hidden (view full) ---

1029/*
1030 * Process a received MLDv1 host membership report.
1031 * Assumes mld points to mld_hdr in pulled up mbuf chain.
1032 */
1033static int
1034mld_v1_input_report(struct ifnet *ifp, const struct ip6_hdr *ip6,
1035 const struct mld_hdr *mld)
1036{
641 struct ifmultiaddr *ifma;
642 struct mld_ifinfo *mli;
643 struct in6_multi *inm;
644 uint16_t timer;
645#ifdef KTR
646 char ip6tbuf[INET6_ADDRSTRLEN];
647#endif
648

--- 378 unchanged lines hidden (view full) ---

1027/*
1028 * Process a received MLDv1 host membership report.
1029 * Assumes mld points to mld_hdr in pulled up mbuf chain.
1030 */
1031static int
1032mld_v1_input_report(struct ifnet *ifp, const struct ip6_hdr *ip6,
1033 const struct mld_hdr *mld)
1034{
1037 INIT_VNET_INET6(curvnet);
1038 struct in6_ifaddr *ia;
1039 struct in6_multi *inm;
1040#ifdef KTR
1041 char ip6tbuf[INET6_ADDRSTRLEN];
1042#endif
1043
1044 if (ifp->if_flags & IFF_LOOPBACK)
1045 return (0);

--- 595 unchanged lines hidden (view full) ---

1641
1642/*
1643 * Update the Older Version Querier Present timers for a link.
1644 * See Section 9.12 of RFC 3810.
1645 */
1646static void
1647mld_v1_process_querier_timers(struct mld_ifinfo *mli)
1648{
1035 struct in6_ifaddr *ia;
1036 struct in6_multi *inm;
1037#ifdef KTR
1038 char ip6tbuf[INET6_ADDRSTRLEN];
1039#endif
1040
1041 if (ifp->if_flags & IFF_LOOPBACK)
1042 return (0);

--- 595 unchanged lines hidden (view full) ---

1638
1639/*
1640 * Update the Older Version Querier Present timers for a link.
1641 * See Section 9.12 of RFC 3810.
1642 */
1643static void
1644mld_v1_process_querier_timers(struct mld_ifinfo *mli)
1645{
1649 INIT_VNET_INET6(curvnet);
1650
1651 MLD_LOCK_ASSERT();
1652
1653 if (mli->mli_v1_timer == 0) {
1654 /*
1655 * MLDv1 Querier Present timers expired; revert to MLDv2.
1656 */
1657 if (mli->mli_version != MLD_VERSION_2) {

--- 1346 unchanged lines hidden (view full) ---

3004 * and that the IPv6 header be prepended in a separate mbuf.
3005 *
3006 * Returns a pointer to the new mbuf chain head, or NULL if the
3007 * allocation failed.
3008 */
3009static struct mbuf *
3010mld_v2_encap_report(struct ifnet *ifp, struct mbuf *m)
3011{
1646
1647 MLD_LOCK_ASSERT();
1648
1649 if (mli->mli_v1_timer == 0) {
1650 /*
1651 * MLDv1 Querier Present timers expired; revert to MLDv2.
1652 */
1653 if (mli->mli_version != MLD_VERSION_2) {

--- 1346 unchanged lines hidden (view full) ---

3000 * and that the IPv6 header be prepended in a separate mbuf.
3001 *
3002 * Returns a pointer to the new mbuf chain head, or NULL if the
3003 * allocation failed.
3004 */
3005static struct mbuf *
3006mld_v2_encap_report(struct ifnet *ifp, struct mbuf *m)
3007{
3012 INIT_VNET_INET6(curvnet);
3013 struct mbuf *mh;
3014 struct mldv2_report *mld;
3015 struct ip6_hdr *ip6;
3016 struct in6_ifaddr *ia;
3017 int mldreclen;
3018
3019 KASSERT(ifp != NULL, ("%s: null ifp", __func__));
3020 KASSERT((m->m_flags & M_PKTHDR),

--- 184 unchanged lines hidden ---
3008 struct mbuf *mh;
3009 struct mldv2_report *mld;
3010 struct ip6_hdr *ip6;
3011 struct in6_ifaddr *ia;
3012 int mldreclen;
3013
3014 KASSERT(ifp != NULL, ("%s: null ifp", __func__));
3015 KASSERT((m->m_flags & M_PKTHDR),

--- 184 unchanged lines hidden ---