summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_snmp.c
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 /bgpd/bgp_snmp.c
parentagentx: add appropriate documentation (diff)
downloadfrr-8046ba6ec4d6e87bf8da6563c0f3e5e66c4652b3.tar.xz
frr-8046ba6ec4d6e87bf8da6563c0f3e5e66c4652b3.zip
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 'bgpd/bgp_snmp.c')
-rw-r--r--bgpd/bgp_snmp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 36fd4ef44..c8f2aa54b 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -455,7 +455,9 @@ bgpPeerTable (struct variable *v, oid name[], size_t *length,
static struct in_addr addr;
struct peer *peer;
- *write_method = NULL;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
memset (&addr, 0, sizeof (struct in_addr));
peer = bgpPeerTable_lookup (v, name, length, &addr, exact);
@@ -765,6 +767,9 @@ bgp4PathAttrTable (struct variable *v, oid name[], size_t *length,
if (! bgp)
return NULL;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
memset (&addr, 0, sizeof (struct prefix_ipv4));
binfo = bgp4PathAttrLookup (v, name, length, bgp, &addr, exact);