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.
diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c
index 803ac85..090ebfa 100644
--- a/ripd/rip_snmp.c
+++ b/ripd/rip_snmp.c
@@ -345,6 +345,10 @@
static struct in_addr addr;
static long valid = SNMP_VALID;
+ if (smux_header_table(v, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&addr, 0, sizeof (struct in_addr));
/* Lookup interface. */
@@ -448,6 +452,10 @@
struct interface *ifp;
struct rip_interface *ri;
+ if (smux_header_table(v, name, length, exact, val_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&addr, 0, sizeof (struct in_addr));
/* Lookup interface. */
@@ -518,6 +526,10 @@
struct rip_peer *peer;
+ if (smux_header_table(v, name, length, exact, val_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
memset (&addr, 0, sizeof (struct in_addr));
/* Lookup interface. */