* Drop a reference to an in_multi record. * * If the refcount drops to 0, free the in_multi record and * delete the underlying link-layer membership. */
| 622 | * delete the underlying link-layer membership. |
| 623 | */ |
| 624 | static void |
| 625 | inm_release(struct in_multi *inm) |
| 626 | { |
| 627 | struct ifmultiaddr *ifma; |
| 628 | struct ifnet *ifp; |
| 629 | |
| 630 | CTR2(KTR_IGMPV3, "%s: refcount is %d", __func__, inm->inm_refcount); |
| 631 | MPASS(inm->inm_refcount == 0); |
| 632 | CTR2(KTR_IGMPV3, "%s: freeing inm %p", __func__, inm); |
| 633 | |
| 634 | ifma = inm->inm_ifma; |
| 635 | ifp = inm->inm_ifp; |
| 636 | |
| 637 | /* XXX this access is not covered by IF_ADDR_LOCK */ |
| 638 | CTR2(KTR_IGMPV3, "%s: purging ifma %p", __func__, ifma); |
| 639 | if (ifp != NULL) { |
| 640 | CURVNET_SET(ifp->if_vnet); |
| 641 | inm_purge(inm); |
| 642 | free(inm, M_IPMADDR); |
| 643 | if_delmulti_ifma_flags(ifma, 1); |
| 644 | CURVNET_RESTORE(); |
| 645 | if_rele(ifp); |
| 646 | } else { |
| 647 | inm_purge(inm); |
| 648 | free(inm, M_IPMADDR); |
| 649 | if_delmulti_ifma_flags(ifma, 1); |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | /* |
| 654 | * Clear recorded source entries for a group. |
no test coverage detected