Deleted Added
full compact
28c28
< __FBSDID("$FreeBSD: head/sys/netinet/ip_carp.c 191528 2009-04-26 19:05:40Z rwatson $");
---
> __FBSDID("$FreeBSD: head/sys/netinet/ip_carp.c 191672 2009-04-29 19:19:13Z bms $");
403,405d402
< #ifdef INET6
< sc->sc_im6o.im6o_multicast_hlim = CARP_DFLTTL;
< #endif
411a409,416
> #ifdef INET6
> sc->sc_im6o.im6o_membership = (struct in6_multi **)malloc(
> (sizeof(struct in6_multi *) * IPV6_MIN_MEMBERSHIPS), M_CARP,
> M_WAITOK);
> sc->sc_im6o.im6o_mfilters = NULL;
> sc->sc_im6o.im6o_max_memberships = IPV6_MIN_MEMBERSHIPS;
> sc->sc_im6o.im6o_multicast_hlim = CARP_DFLTTL;
> #endif
450a456,458
> #ifdef INET6
> free(sc->sc_im6o.im6o_membership, M_CARP);
> #endif
1451a1460
> u_int16_t n = im6o->im6o_num_memberships;
1453,1458c1462,1466
< while (!LIST_EMPTY(&im6o->im6o_memberships)) {
< struct in6_multi_mship *imm =
< LIST_FIRST(&im6o->im6o_memberships);
<
< LIST_REMOVE(imm, i6mm_chain);
< in6_leavegroup(imm);
---
> while (n-- > 0) {
> if (im6o->im6o_membership[n] != NULL) {
> in6_mc_leave(im6o->im6o_membership[n], NULL);
> im6o->im6o_membership[n] = NULL;
> }
1459a1468,1470
> KASSERT(im6o->im6o_mfilters == NULL,
> ("%s: im6o_mfilters != NULL", __func__));
> im6o->im6o_num_memberships = 0;
1638d1648
< struct in6_multi_mship *imm;
1641a1652,1653
> error = 0;
>
1688a1701,1702
> struct in6_multi *in6m;
>
1697c1711,1713
< if ((imm = in6_joingroup(ifp, &in6, &error, 0)) == NULL)
---
> in6m = NULL;
> error = in6_mc_join(ifp, &in6, NULL, &in6m, 0);
> if (error)
1699c1715,1716
< LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain);
---
> im6o->im6o_membership[0] = in6m;
> im6o->im6o_num_memberships++;
1710c1727,1729
< if ((imm = in6_joingroup(ifp, &in6, &error, 0)) == NULL)
---
> in6m = NULL;
> error = in6_mc_join(ifp, &in6, NULL, &in6m, 0);
> if (error)
1712c1731,1732
< LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain);
---
> im6o->im6o_membership[1] = in6m;
> im6o->im6o_num_memberships++;
1784,1791c1804,1805
< /* clean up multicast memberships */
< if (!sc->sc_naddrs6) {
< while (!LIST_EMPTY(&im6o->im6o_memberships)) {
< imm = LIST_FIRST(&im6o->im6o_memberships);
< LIST_REMOVE(imm, i6mm_chain);
< in6_leavegroup(imm);
< }
< }
---
> if (!sc->sc_naddrs6)
> carp_multicast6_cleanup(sc);
1802d1815
< struct ip6_moptions *im6o = &sc->sc_im6o;
1809,1816c1822
< while (!LIST_EMPTY(&im6o->im6o_memberships)) {
< struct in6_multi_mship *imm =
< LIST_FIRST(&im6o->im6o_memberships);
<
< LIST_REMOVE(imm, i6mm_chain);
< in6_leavegroup(imm);
< }
< im6o->im6o_multicast_ifp = NULL;
---
> carp_multicast6_cleanup(sc);