* Delete a multicast group membership by network-layer group address. * * Returns ENOENT if the entry could not be found. If ifp no longer * exists, results are undefined. This entry point should only be used * from subsystems which do appropriate locking to hold ifp for the * duration of the call. * Network-layer protocol domains must use if_delmulti_ifma(). */
| 3588 | * Network-layer protocol domains must use if_delmulti_ifma(). |
| 3589 | */ |
| 3590 | int |
| 3591 | if_delmulti(struct ifnet *ifp, struct sockaddr *sa) |
| 3592 | { |
| 3593 | struct ifmultiaddr *ifma; |
| 3594 | int lastref; |
| 3595 | |
| 3596 | KASSERT(ifp, ("%s: NULL ifp", __func__)); |
| 3597 | |
| 3598 | IF_ADDR_WLOCK(ifp); |
| 3599 | lastref = 0; |
| 3600 | ifma = if_findmulti(ifp, sa); |
| 3601 | if (ifma != NULL) |
| 3602 | lastref = if_delmulti_locked(ifp, ifma, 0); |
| 3603 | IF_ADDR_WUNLOCK(ifp); |
| 3604 | |
| 3605 | if (ifma == NULL) |
| 3606 | return (ENOENT); |
| 3607 | |
| 3608 | if (lastref && ifp->if_ioctl != NULL) { |
| 3609 | (void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); |
| 3610 | } |
| 3611 | |
| 3612 | return (0); |
| 3613 | } |
| 3614 | |
| 3615 | /* |
| 3616 | * Delete all multicast group membership for an interface. |
no test coverage detected