svn commit: r205312 - head/usr.sbin/bsnmpd/modules/snmp_pf
Shteryana Shopova
syrinx at FreeBSD.org
Fri Mar 19 09:53:25 UTC 2010
Author: syrinx
Date: Fri Mar 19 09:53:25 2010
New Revision: 205312
URL: http://svn.freebsd.org/changeset/base/205312
Log:
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
Modified:
head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Fri Mar 19 09:20:06 2010 (r205311)
+++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Fri Mar 19 09:53:25 2010 (r205312)
@@ -534,6 +534,9 @@ pf_iftable(struct snmp_context __unused
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
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
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
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 *c
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 *c
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
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
abort();
}
- if ((time(NULL) - pfl_table_age) > PFL_TABLE_MAXAGE)
- pfl_refresh();
-
switch (which) {
case LEAF_pfLabelsLblName:
return (string_get(val, e->name, -1));
More information about the svn-src-all
mailing list