git: 12ee292aaee2 - stable/14 - ipfilter/ippool: Dump a copy of ippool dstlist data in "new" format

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 09 Oct 2025 12:36:48 UTC
The branch stable/14 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=12ee292aaee20d190125d58d73da80907435ea03

commit 12ee292aaee20d190125d58d73da80907435ea03
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-03-01 03:18:07 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2025-10-09 12:36:40 +0000

    ipfilter/ippool: Dump a copy of ippool dstlist data in "new" format
    
    As with 7531c434a593, which dumped ippool table data in the "new"
    format, print dstlist data in the "new" format.
    
    (cherry picked from commit eee36ffa0d874f1c8aca912f7c2a8eba34509927)
---
 sbin/ipf/libipf/printdstl_live.c   | 3 +++
 sbin/ipf/libipf/printdstlist.c     | 2 ++
 sbin/ipf/libipf/printdstlistdata.c | 5 ++---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sbin/ipf/libipf/printdstl_live.c b/sbin/ipf/libipf/printdstl_live.c
index 088448e6656d..72cb75a832c9 100644
--- a/sbin/ipf/libipf/printdstl_live.c
+++ b/sbin/ipf/libipf/printdstl_live.c
@@ -40,6 +40,9 @@ printdstl_live( ippool_dst_t *d, int fd, char *name, int opts,
 	if ((d->ipld_flags & IPHASH_DELETE) != 0)
 		PRINTF("# ");
 
+	if (opts & OPT_SAVEOUT)
+		PRINTF("{\n");
+
 	if ((opts & OPT_DEBUG) == 0)
 		PRINTF("\t{");
 
diff --git a/sbin/ipf/libipf/printdstlist.c b/sbin/ipf/libipf/printdstlist.c
index 2cf41ffe414c..497d7004c94c 100644
--- a/sbin/ipf/libipf/printdstlist.c
+++ b/sbin/ipf/libipf/printdstlist.c
@@ -42,6 +42,8 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,
 				return (NULL);
 			}
 
+			if (opts & OPT_SAVEOUT)
+				PRINTF("\t");
 			node = printdstlistnode(n, bcopywrap, opts, fields);
 
 			free(n);
diff --git a/sbin/ipf/libipf/printdstlistdata.c b/sbin/ipf/libipf/printdstlistdata.c
index 7940d2ae021b..546bf35cabf6 100644
--- a/sbin/ipf/libipf/printdstlistdata.c
+++ b/sbin/ipf/libipf/printdstlistdata.c
@@ -11,8 +11,7 @@
 void
 printdstlistdata( ippool_dst_t *pool, int opts)
 {
-
-	if ((opts & OPT_DEBUG) == 0) {
+	if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {
 		if ((pool->ipld_flags & IPDST_DELETE) != 0)
 			PRINTF("# ");
 		PRINTF("pool ");
@@ -24,7 +23,7 @@ printdstlistdata( ippool_dst_t *pool, int opts)
 
 	printunit(pool->ipld_unit);
 
-	if ((opts & OPT_DEBUG) == 0) {
+	if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {
 		PRINTF("/dstlist (name %s;", pool->ipld_name);
 		if (pool->ipld_policy != IPLDP_NONE) {
 			PRINTF(" policy ");