git: fda33ae0a1ac - stable/15 - snmp_pf: fix refresh
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 May 2026 09:06:54 UTC
The branch stable/15 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=fda33ae0a1ac8fd070efd6a0da2c1beae9f3428a
commit fda33ae0a1ac8fd070efd6a0da2c1beae9f3428a
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-12-17 13:22:05 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-05-26 09:03:06 +0000
snmp_pf: fix refresh
Some refresh functions had two layers of 'do we need to refresh now?'
checks, leading to inconsistent refreshes.
Consolidate them.
PR: 291725
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit a862e4b5a27c356e2584ee74fd9e211c18b1b125)
---
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
index f0f9e0f0e149..12cb7bb71616 100644
--- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
+++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
@@ -673,7 +673,7 @@ pf_tables(struct snmp_context __unused *ctx, struct snmp_value *val,
return (SNMP_ERR_NOT_WRITEABLE);
if (op == SNMP_OP_GET) {
- if ((time(NULL) - pft_table_age) > PFT_TABLE_MAXAGE)
+ if (! started || (time(NULL) - pft_table_age) > PFT_TABLE_MAXAGE)
if (pft_refresh() == -1)
return (SNMP_ERR_GENERR);
@@ -812,7 +812,7 @@ pf_tbladdr(struct snmp_context __unused *ctx, struct snmp_value __unused *val,
asn_subid_t which = val->var.subs[sub - 1];
struct pfa_entry *e = NULL;
- if ((time(NULL) - pfa_table_age) > PFA_TABLE_MAXAGE)
+ if (! started || (time(NULL) - pfa_table_age) > PFA_TABLE_MAXAGE)
pfa_refresh();
switch (op) {
@@ -1035,7 +1035,7 @@ pf_lbltable(struct snmp_context __unused *ctx, struct snmp_value *val,
asn_subid_t which = val->var.subs[sub - 1];
struct pfl_entry *e = NULL;
- if ((time(NULL) - pfl_table_age) > PFL_TABLE_MAXAGE)
+ if (! started || (time(NULL) - pfl_table_age) > PFL_TABLE_MAXAGE)
pfl_refresh();
switch (op) {
@@ -1322,9 +1322,6 @@ pft_refresh(void)
struct pft_entry *e;
int i, numtbls = 1;
- if (started && this_tick <= pf_tick)
- return (0);
-
while (!TAILQ_EMPTY(&pft_table)) {
e = TAILQ_FIRST(&pft_table);
TAILQ_REMOVE(&pft_table, e, link);
@@ -1427,9 +1424,6 @@ pfa_refresh(void)
struct pfa_entry *e;
int i, numtbls = 1, cidx, naddrs;
- if (started && this_tick <= pf_tick)
- return (0);
-
while (!TAILQ_EMPTY(&pfa_table)) {
e = TAILQ_FIRST(&pfa_table);
TAILQ_REMOVE(&pfa_table, e, link);
@@ -1595,9 +1589,6 @@ pfl_refresh(void)
{
struct pfl_entry *e;
- if (started && this_tick <= pf_tick)
- return (0);
-
while (!TAILQ_EMPTY(&pfl_table)) {
e = TAILQ_FIRST(&pfl_table);
TAILQ_REMOVE(&pfl_table, e, link);