git: 3810b3790322 - main - mac_ddb: Make db_show_vnet_valid() handle !VIMAGE

From: Allan Jude <allanjude_at_FreeBSD.org>
Date: Thu, 21 Jul 2022 14:01:09 UTC
The branch main has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=3810b37903220af1a369d3c4032ae25fb2d7949d

commit 3810b37903220af1a369d3c4032ae25fb2d7949d
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2022-07-21 13:58:05 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2022-07-21 14:01:01 +0000

    mac_ddb: Make db_show_vnet_valid() handle !VIMAGE
    
    Reported by:    kib
    Sponsored by:   Juniper Networks, Inc.
    Sponsored by:   Klara, Inc.
---
 sys/security/mac_ddb/mac_ddb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/security/mac_ddb/mac_ddb.c b/sys/security/mac_ddb/mac_ddb.c
index 847be4997226..8f2f0d78bb07 100644
--- a/sys/security/mac_ddb/mac_ddb.c
+++ b/sys/security/mac_ddb/mac_ddb.c
@@ -196,6 +196,7 @@ db_show_rman_valid(db_expr_t addr, bool have_addr, db_expr_t count, char *modif)
 static int
 db_show_vnet_valid(db_expr_t addr, bool have_addr, db_expr_t count, char *modif)
 {
+#ifdef VIMAGE
 	VNET_ITERATOR_DECL(vnet);
 
 	if (!have_addr)
@@ -207,6 +208,9 @@ db_show_vnet_valid(db_expr_t addr, bool have_addr, db_expr_t count, char *modif)
 	}
 
 	return (EACCES);
+#else
+	return (EOPNOTSUPP);
+#endif
 }
 #endif