netdump: check the support status of the interface

If the interface does not support debugnet(4) we should bail early,
rather than having the user find this out at the time of the panic.
dumpon(8) already expects this return value and will print a helpful
error message.

Reviewed by:	cem, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35180
This commit is contained in:
Mitchell Horne 2022-05-14 10:23:58 -03:00
parent a84bf5eaa1
commit 38a36057ae

View File

@ -452,6 +452,10 @@ netdump_configure(struct diocskerneldump_arg *conf, struct thread *td)
CURVNET_SET(vnet0);
ifp = ifunit_ref(conf->kda_iface);
CURVNET_RESTORE();
if (!DEBUGNET_SUPPORTED_NIC(ifp)) {
if_rele(ifp);
return (ENODEV);
}
} else
ifp = NULL;