git: 91d4608d2165 - stable/13 - netdump: check the support status of the interface

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Fri, 27 May 2022 16:23:30 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=91d4608d21657cb6064f893001380a2f08da26a9

commit 91d4608d21657cb6064f893001380a2f08da26a9
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-05-14 13:23:58 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-05-27 16:22:47 +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
    
    (cherry picked from commit 38a36057ae56c8023878f3c3c2185bafc2896964)
---
 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 7b9d260bff44..dc209062b359 100644
--- a/sys/netinet/netdump/netdump_client.c
+++ b/sys/netinet/netdump/netdump_client.c
@@ -420,6 +420,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;