From 8046ba6ec4d6e87bf8da6563c0f3e5e66c4652b3 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 31 May 2012 13:30:28 +0200 Subject: 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. --- zebra/zebra_snmp.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'zebra/zebra_snmp.c') diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index 3dbfb587..f52bbcb8 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -451,6 +451,10 @@ ipFwTable (struct variable *v, oid objid[], size_t *objid_len, static struct in_addr netmask; struct nexthop *nexthop; + if (smux_header_table(v, objid, objid_len, exact, val_len, write_method) + == MATCH_FAILED) + return NULL; + get_fwtable_route_node(v, objid, objid_len, exact, &np, &rib); if (!np) return NULL; @@ -549,6 +553,10 @@ static u_char * ipCidrTable (struct variable *v, oid objid[], size_t *objid_len, int exact, size_t *val_len, WriteMethod **write_method) { + if (smux_header_table(v, objid, objid_len, exact, val_len, write_method) + == MATCH_FAILED) + return NULL; + switch (v->magic) { case IPCIDRROUTEDEST: -- cgit v1.2.1