diff options
| author | Jose Luis Duran <jlduran@FreeBSD.org> | 2025-10-26 12:38:00 +0000 |
|---|---|---|
| committer | Jose Luis Duran <jlduran@FreeBSD.org> | 2025-10-28 11:31:20 +0000 |
| commit | 99560fe98c76371d7f0807c2088c78790ca9f943 (patch) | |
| tree | 1cd950b7efe4f4b0a6056f690771ef4be1684945 | |
| parent | a943a96a50ba7e9d1e1935bdd18df0e11d158acb (diff) | |
pfctl: Do not warn if there is no Ethernet anchor
Avoid emitting a warning if there is no Ethernet anchor. If the anchor
--regardless of its type-- is nonexistent, should be caught earlier.
This can be misleading when there is a layer 3 anchor but not an
Ethernet anchor, giving the user the impression that there is no layer 3
anchor with that name.
PR: 280516
Approved by: kp
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D53360
| -rw-r--r-- | sbin/pfctl/pfctl.c | 5 | ||||
| -rw-r--r-- | tests/sys/netpfil/pf/anchor.sh | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index ed317495c2e0..3d2632c1cf74 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3167,10 +3167,7 @@ pfctl_show_eth_anchors(int dev, int opts, char *anchorname) int ret; if ((ret = pfctl_get_eth_rulesets_info(dev, &ri, anchorname)) != 0) { - if (ret == ENOENT) - fprintf(stderr, "Anchor '%s' not found.\n", - anchorname); - else + if (ret != ENOENT) errc(1, ret, "DIOCGETETHRULESETS"); return (-1); } diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh index 034fe0d3d574..f321c742788e 100644 --- a/tests/sys/netpfil/pf/anchor.sh +++ b/tests/sys/netpfil/pf/anchor.sh @@ -157,10 +157,10 @@ deeply_nested_body() atf_check -s exit:0 -o \ inline:" foo\n foo/bar\n foo/bar/foobar\n foo/bar/quux\n foo/baz\n foo/qux\n" \ - -e ignore jexec alcatraz pfctl -sA + jexec alcatraz pfctl -sA atf_check -s exit:0 -o inline:" foo/bar/foobar\n foo/bar/quux\n" \ - -e ignore jexec alcatraz pfctl -a foo/bar -sA + jexec alcatraz pfctl -a foo/bar -sA } deeply_nested_cleanup() |
