summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
authorsyrinx <syrinx@FreeBSD.org>2010-03-19 09:53:25 +0000
committersyrinx <syrinx@FreeBSD.org>2010-03-19 09:53:25 +0000
commit6d63213ed5739fcdd0a8462604e6ef1efb00f161 (patch)
tree24490e5ae6025a5c74f22d8b89be5568d3d97ce6 /usr.sbin/bsnmpd
parentb2778ce6f6fa97339f3b34f402f81a3e8b3d26de (diff)
downloadFreeBSD-src-6d63213ed5739fcdd0a8462604e6ef1efb00f161.zip
FreeBSD-src-6d63213ed5739fcdd0a8462604e6ef1efb00f161.tar.gz
Make sure the snmp_pf module will first refresh its entires if necessary,
then find a specific entry, and get the requested value. So far, it found the specific entry, refreshed the entry list if necessary, and got the requested value from the found entry. The problem is that refreshing nukes all old entries and replaces them with new ones and the obtained entry pointer was no longer valid after the refresh. Reviewed by: bz, philip MFC after: 1 week
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c24
1 files changed, 12 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 56c2cda..4e915f4 100644
--- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
+++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
@@ -534,6 +534,9 @@ pf_iftable(struct snmp_context __unused *ctx, struct snmp_value *val,
asn_subid_t which = val->var.subs[sub - 1];
struct pfi_entry *e = NULL;
+ if ((time(NULL) - pfi_table_age) > PFI_TABLE_MAXAGE)
+ pfi_refresh();
+
switch (op) {
case SNMP_OP_SET:
return (SNMP_ERR_NOT_WRITEABLE);
@@ -557,9 +560,6 @@ pf_iftable(struct snmp_context __unused *ctx, struct snmp_value *val,
abort();
}
- if ((time(NULL) - pfi_table_age) > PFI_TABLE_MAXAGE)
- pfi_refresh();
-
switch (which) {
case LEAF_pfInterfacesIfDescr:
return (string_get(val, e->pfi.pfik_name, -1));
@@ -684,6 +684,9 @@ pf_tbltable(struct snmp_context __unused *ctx, struct snmp_value *val,
asn_subid_t which = val->var.subs[sub - 1];
struct pft_entry *e = NULL;
+ if ((time(NULL) - pft_table_age) > PFT_TABLE_MAXAGE)
+ pft_refresh();
+
switch (op) {
case SNMP_OP_SET:
return (SNMP_ERR_NOT_WRITEABLE);
@@ -707,9 +710,6 @@ pf_tbltable(struct snmp_context __unused *ctx, struct snmp_value *val,
abort();
}
- if ((time(NULL) - pft_table_age) > PFT_TABLE_MAXAGE)
- pft_refresh();
-
switch (which) {
case LEAF_pfTablesTblDescr:
return (string_get(val, e->pft.pfrts_name, -1));
@@ -842,6 +842,9 @@ pf_altqq(struct snmp_context __unused *ctx, struct snmp_value *val,
return (SNMP_ERR_NOERROR);
}
+ if ((time(NULL) - pfq_table_age) > PFQ_TABLE_MAXAGE)
+ pfq_refresh();
+
switch (op) {
case SNMP_OP_SET:
return (SNMP_ERR_NOT_WRITEABLE);
@@ -865,9 +868,6 @@ pf_altqq(struct snmp_context __unused *ctx, struct snmp_value *val,
abort();
}
- if ((time(NULL) - pfq_table_age) > PFQ_TABLE_MAXAGE)
- pfq_refresh();
-
switch (which) {
case LEAF_pfAltqQueueDescr:
return (string_get(val, e->altq.qname, -1));
@@ -930,6 +930,9 @@ 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)
+ pfl_refresh();
+
switch (op) {
case SNMP_OP_SET:
return (SNMP_ERR_NOT_WRITEABLE);
@@ -953,9 +956,6 @@ pf_lbltable(struct snmp_context __unused *ctx, struct snmp_value *val,
abort();
}
- if ((time(NULL) - pfl_table_age) > PFL_TABLE_MAXAGE)
- pfl_refresh();
-
switch (which) {
case LEAF_pfLabelsLblName:
return (string_get(val, e->name, -1));
OpenPOWER on IntegriCloud