in_mcast: garbage collect inp_gcmoptions()

It is is used only once, merge it into inp_freemoptions().
This commit is contained in:
Gleb Smirnoff 2021-10-18 11:36:07 -07:00
parent 0f617ae48a
commit 9b7501e797

View File

@ -1588,13 +1588,16 @@ inp_findmoptions(struct inpcb *inp)
return (imo);
}
static void
inp_gcmoptions(struct ip_moptions *imo)
void
inp_freemoptions(struct ip_moptions *imo)
{
struct in_mfilter *imf;
struct in_multi *inm;
struct ifnet *ifp;
if (imo == NULL)
return;
while ((imf = ip_mfilter_first(&imo->imo_head)) != NULL) {
ip_mfilter_remove(&imo->imo_head, imf);
@ -1613,20 +1616,6 @@ inp_gcmoptions(struct ip_moptions *imo)
free(imo, M_IPMOPTS);
}
/*
* Discard the IP multicast options (and source filters). To minimize
* the amount of work done while holding locks such as the INP's
* pcbinfo lock (which is used in the receive path), the free
* operation is deferred to the epoch callback task.
*/
void
inp_freemoptions(struct ip_moptions *imo)
{
if (imo == NULL)
return;
inp_gcmoptions(imo);
}
/*
* Atomically get source filters on a socket for an IPv4 multicast group.
* Called with INP lock held; returns with lock released.