* Free multicast structures. */
| 1474 | * Free multicast structures. |
| 1475 | */ |
| 1476 | static void |
| 1477 | carp_multicast_cleanup(struct carp_if *cif, sa_family_t sa) |
| 1478 | { |
| 1479 | #ifdef INET |
| 1480 | struct ip_moptions *imo = &cif->cif_imo; |
| 1481 | struct in_mfilter *imf; |
| 1482 | #endif |
| 1483 | #ifdef INET6 |
| 1484 | struct ip6_moptions *im6o = &cif->cif_im6o; |
| 1485 | struct in6_mfilter *im6f; |
| 1486 | #endif |
| 1487 | sx_assert(&carp_sx, SA_XLOCKED); |
| 1488 | |
| 1489 | switch (sa) { |
| 1490 | #ifdef INET |
| 1491 | case AF_INET: |
| 1492 | if (cif->cif_naddrs != 0) |
| 1493 | break; |
| 1494 | |
| 1495 | while ((imf = ip_mfilter_first(&imo->imo_head)) != NULL) { |
| 1496 | ip_mfilter_remove(&imo->imo_head, imf); |
| 1497 | in_leavegroup(imf->imf_inm, NULL); |
| 1498 | ip_mfilter_free(imf); |
| 1499 | } |
| 1500 | break; |
| 1501 | #endif |
| 1502 | #ifdef INET6 |
| 1503 | case AF_INET6: |
| 1504 | if (cif->cif_naddrs6 != 0) |
| 1505 | break; |
| 1506 | |
| 1507 | while ((im6f = ip6_mfilter_first(&im6o->im6o_head)) != NULL) { |
| 1508 | ip6_mfilter_remove(&im6o->im6o_head, im6f); |
| 1509 | in6_leavegroup(im6f->im6f_in6m, NULL); |
| 1510 | ip6_mfilter_free(im6f); |
| 1511 | } |
| 1512 | break; |
| 1513 | #endif |
| 1514 | } |
| 1515 | } |
| 1516 | |
| 1517 | int |
| 1518 | carp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa) |
no test coverage detected