summaryrefslogtreecommitdiff
path: root/bgpd
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
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 'bgpd')
-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 36fd4ef4..c8f2aa54 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);