summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
authorVincent Bernat <bernat@luffy.cx>2012-05-31 13:30:28 +0200
committerVincent Bernat <bernat@luffy.cx>2012-06-25 19:03:23 +0200
commit8046ba6ec4d6e87bf8da6563c0f3e5e66c4652b3 (patch)
tree1b38b2eae4e1cee042f96a42217b14647159bf0f /ospfd
parent0ff4b9c96793898429052de576d8da368e48997e (diff)
snmp: let handlers accept OID from a lesser prefix
Most table handlers do not expect to be given an OID whose prefix is outside what they can handle. This is not a problem with the SMUX implementation since it always correct the OID such that the prefix matches. However, this is not the case for the AgentX implementation. A new function, smux_header_table() is used to do this normalization.
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_snmp.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index c8416de6..1daf0d6a 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -704,6 +704,10 @@ ospfAreaEntry (struct variable *v, oid *name, size_t *length, int exact,
struct ospf_area *area;
struct in_addr addr;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&addr, 0, sizeof (struct in_addr));
area = ospfAreaLookup (v, name, length, &addr, exact);
@@ -847,6 +851,10 @@ ospfStubAreaEntry (struct variable *v, oid *name, size_t *length,
struct ospf_area *area;
struct in_addr addr;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&addr, 0, sizeof (struct in_addr));
area = ospfStubAreaLookup (v, name, length, &addr, exact);
@@ -1078,6 +1086,10 @@ ospfLsdbEntry (struct variable *v, oid *name, size_t *length, int exact,
struct in_addr router_id;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
/* INDEX { ospfLsdbAreaId, ospfLsdbType,
ospfLsdbLsid, ospfLsdbRouterId } */
@@ -1240,6 +1252,10 @@ ospfAreaRangeEntry (struct variable *v, oid *name, size_t *length, int exact,
struct in_addr mask;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
/* Check OSPF instance. */
ospf = ospf_lookup ();
if (ospf == NULL)
@@ -1344,6 +1360,10 @@ ospfHostEntry (struct variable *v, oid *name, size_t *length, int exact,
struct in_addr addr;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
/* Check OSPF instance. */
ospf = ospf_lookup ();
if (ospf == NULL)
@@ -1679,6 +1699,10 @@ ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact,
struct ospf_interface *oi;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
ifindex = 0;
memset (&ifaddr, 0, sizeof (struct in_addr));
@@ -1847,6 +1871,10 @@ ospfIfMetricEntry (struct variable *v, oid *name, size_t *length, int exact,
struct ospf_interface *oi;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
ifindex = 0;
memset (&ifaddr, 0, sizeof (struct in_addr));
@@ -2039,6 +2067,10 @@ ospfVirtIfEntry (struct variable *v, oid *name, size_t *length, int exact,
struct in_addr area_id;
struct in_addr neighbor;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&area_id, 0, sizeof (struct in_addr));
memset (&neighbor, 0, sizeof (struct in_addr));
@@ -2272,6 +2304,10 @@ ospfNbrEntry (struct variable *v, oid *name, size_t *length, int exact,
struct ospf_neighbor *nbr;
struct ospf_interface *oi;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&nbr_addr, 0, sizeof (struct in_addr));
ifindex = 0;
@@ -2334,6 +2370,10 @@ ospfVirtNbrEntry (struct variable *v, oid *name, size_t *length, int exact,
struct in_addr neighbor;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&area_id, 0, sizeof (struct in_addr));
memset (&neighbor, 0, sizeof (struct in_addr));
@@ -2482,6 +2522,10 @@ ospfExtLsdbEntry (struct variable *v, oid *name, size_t *length, int exact,
struct in_addr router_id;
struct ospf *ospf;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
type = OSPF_AS_EXTERNAL_LSA;
memset (&ls_id, 0, sizeof (struct in_addr));
memset (&router_id, 0, sizeof (struct in_addr));
@@ -2533,6 +2577,10 @@ static u_char *
ospfAreaAggregateEntry (struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
/* Return the current value of the variable */
switch (v->magic)
{