Date: Thu, 18 Dec 2025 13:45:27 +0000 From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: a862e4b5a27c - main - snmp_pf: fix refresh Message-ID: <69440577.31af0.55d25d79@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a862e4b5a27c356e2584ee74fd9e211c18b1b125 commit a862e4b5a27c356e2584ee74fd9e211c18b1b125 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2025-12-17 13:22:05 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-12-18 13:39:27 +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") --- 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 91194516614f..b62ecf791500 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); @@ -1422,9 +1419,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); @@ -1590,9 +1584,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);help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69440577.31af0.55d25d79>
