1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

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
This commit is contained in:
Shteryana Shopova 2010-03-19 09:53:25 +00:00
parent ae84e39b61
commit 9315567023
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205312

View File

@ -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));