> But, surely, it seems to me the simple thing to do is to just grep for > PFIL_IFNET_ATTACH and PFIL_IFNET_DETACH and look at the surrounding > code to see what circumstances they're used in.
Yea just a quick look, they only really appear here. src/sys/net/if.c:755: pfil_run_ifhooks(if_pfil, PFIL_IFNET_ATTACH, ifp); src/sys/net/if.c:1527: pfil_run_ifhooks(if_pfil, PFIL_IFNET_DETACH, ifp); Which are both within *if_initialize* and *if_detatch* respectively, and those methods are only called to either attach or detach an interface of some kind, virtual interfaces as well. Something else interesting, looks like when a device driver initialises itself, it defines an object of type *struct cfattach* by usually invoking some variant of the *CFATTACH_DECL_NEW* macro. And within this structure are a bunch of methods, and what concerns us is *ca_detach* and *ca_attach*, so I guess that is kinda the bottom of the chain. On Mon, Mar 24, 2025 at 2:37 PM Mouse <mo...@rodents-montreal.org> wrote: > > when I create hook with parameter PFIL_IFNET what actions should > > invoke hook with PFIL_IFNET_ATTACH or PFIL_IFNET_DETACH ? > > I don't actually know, though my guess would be an interface attaching > or detaching (eg, USB Ethernet plugged in or removed). > > But, surely, it seems to me the simple thing to do is to just grep for > PFIL_IFNET_ATTACH and PFIL_IFNET_DETACH and look at the surrounding > code to see what circumstances they're used in. > > /~\ The ASCII Mouse > \ / Ribbon Campaign > X Against HTML mo...@rodents-montreal.org > / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B >