git: 484e977f2441 - main - pflow: observation domain is an unsigned integer

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Mon, 22 Jan 2024 18:20:05 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=484e977f24418afa848d7ea1531b4379446d6065

commit 484e977f24418afa848d7ea1531b4379446d6065
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-01-22 16:34:44 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-01-22 17:02:10 +0000

    pflow: observation domain is an unsigned integer
    
    Ensure we print it as such, rather than as a signed integer, as that
    would lead to confusion.
    
    Reported by:    Jim Pingle <jimp@netgate.com>
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pflowctl/pflowctl.c      |  2 +-
 tests/sys/netpfil/pf/pflow.sh | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/sbin/pflowctl/pflowctl.c b/sbin/pflowctl/pflowctl.c
index 35daedfdf478..4186598dd9bc 100644
--- a/sbin/pflowctl/pflowctl.c
+++ b/sbin/pflowctl/pflowctl.c
@@ -340,7 +340,7 @@ get(int id)
 		if (! snl_parse_nlmsg(&ss, hdr, &get_parser, &g))
 			continue;
 
-		printf("pflow%d: version %d domain %d", g.id, g.version, g.obs_dom);
+		printf("pflow%d: version %d domain %u", g.id, g.version, g.obs_dom);
 		print_sockaddr(" src ", &g.src.storage);
 		print_sockaddr(" dst ", &g.dst.storage);
 		printf("\n");
diff --git a/tests/sys/netpfil/pf/pflow.sh b/tests/sys/netpfil/pf/pflow.sh
index 3cef5f5a2d98..10efcbb93ac4 100644
--- a/tests/sys/netpfil/pf/pflow.sh
+++ b/tests/sys/netpfil/pf/pflow.sh
@@ -282,6 +282,30 @@ rule_cleanup()
 	pft_cleanup
 }
 
+atf_test_case "obs_dom" "cleanup"
+obs_dom_head()
+{
+	atf_set descr 'Test configuring observation domain values'
+	atf_set require.user root
+}
+
+obs_dom_body()
+{
+	pflow_init
+
+	vnet_mkjail alcatraz
+
+	pflow=$(jexec alcatraz pflowctl -c)
+	jexec alcatraz pflowctl -s ${pflow} domain 2300000000
+	atf_check -o match:".*domain 2300000000.*" -s exit:0 \
+	    jexec alcatraz pflowctl -l
+}
+
+obs_dom_cleanup()
+{
+	pft_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "basic"
@@ -289,4 +313,5 @@ atf_init_test_cases()
 	atf_add_test_case "v6"
 	atf_add_test_case "nat"
 	atf_add_test_case "rule"
+	atf_add_test_case "obs_dom"
 }