wg: detach bpf upon destroy as well

bpfattach() is called in wg_clone_create(), but the bpfdetach() is
missing from wg_close_destroy().  Add the missing bpfdetach() to avoid
leaking both the associated bpf bits as well as the ifnet that bpf will
hold a reference to.

PR:		276526
MFC after:	3 days
This commit is contained in:
Aaron LI
2024-01-22 10:18:56 -06:00
committed by Kyle Evans
parent c19fb1f963
commit 43be2d7aaf
+1
View File
@@ -2876,6 +2876,7 @@ wg_clone_destroy(struct if_clone *ifc, if_t ifp, uint32_t flags)
if (cred != NULL)
crfree(cred);
bpfdetach(sc->sc_ifp);
if_detach(sc->sc_ifp);
if_free(sc->sc_ifp);