Page MenuHomeFreeBSD

iflib: Fix detach of pseudo interfaces
ClosedPublic

Authored by markj on Feb 18 2021, 3:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 5:52 AM
Unknown Object (File)
Mar 17 2024, 7:12 AM
Unknown Object (File)
Mar 17 2024, 7:12 AM
Unknown Object (File)
Mar 17 2024, 7:12 AM
Unknown Object (File)
Mar 14 2024, 2:23 PM
Unknown Object (File)
Feb 10 2024, 1:46 AM
Unknown Object (File)
Jan 13 2024, 4:34 PM
Unknown Object (File)
Jan 6 2024, 5:50 PM
Subscribers

Details

Summary

When creating a pseudo interface we also create a device_t with which
the iflib context is associated. I believe this is done just so iflib
can consistently pass around a device_t.

In commit 38bfc6dee33b we added an IFDI_DETACH() call to
iflib_pseudo_deregister() since it looked like it was missing. One is
present in the error handling path of iflib_pseudo_register(). However,
the detach actually comes from the DEVICE_DETACH() method for the
above-mentioned device_t, so now we're calling IFDI_DETACH() twice when
destroying a pseudo interface.

Fix the problem by not calling IFDI_DETACH() from the device detach
routine. This way we can ensure that iflib de-initialization always
happens in a consistent order. It also ensures that you can't do silly
things like "devctl detach <pseudo ifnet>", which currently panics the
system.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37161
Build 34050: arc lint + arc unit