git: 38a36057ae56 - main - netdump: check the support status of the interface

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Sat, 14 May 2022 13:28:46 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=38a36057ae56c8023878f3c3c2185bafc2896964

commit 38a36057ae56c8023878f3c3c2185bafc2896964
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-05-14 13:23:58 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-05-14 13:27:53 +0000

    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
---
 sys/netinet/netdump/netdump_client.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/netinet/netdump/netdump_client.c b/sys/netinet/netdump/netdump_client.c
index 9f7b6d7965b8..9f7b3da8ea5e 100644
--- a/sys/netinet/netdump/netdump_client.c
+++ b/sys/netinet/netdump/netdump_client.c
@@ -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;