summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPat Ruddy <pat@voltanet.io>2020-09-28 16:35:35 +0100
committerPat Ruddy <pat@voltanet.io>2021-02-02 09:37:06 +0000
commit0d020cd6d98f454f22723f404da99fa48b7b2751 (patch)
treefe2605ddf46460c25b38c03276b21b93dc049f25 /lib
parentaa53f69348d2d6c5817e10b32b85345ea4399025 (diff)
bgpd, lib: add mplsL3VpnVrf table
Add SNMP support for L3vpn Vrf table as defined in [RFC4382] Keep track of vrf status for the table and for future traps. Signed-off-by: Pat Ruddy <pat@voltanet.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/smux.h2
-rw-r--r--lib/snmp.c28
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/smux.h b/lib/smux.h
index 6896f02354..0efe029d3d 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -106,6 +106,8 @@ extern int oid_compare(const oid *, int, const oid *, int);
extern void oid2in_addr(oid[], int, struct in_addr *);
extern void *oid_copy(void *, const void *, size_t);
extern void oid_copy_addr(oid[], const struct in_addr *, int);
+extern void oid2string(oid oid[], int len, char *string);
+extern void oid_copy_str(oid oid[], const char *string, int len);
#ifdef __cplusplus
}
diff --git a/lib/snmp.c b/lib/snmp.c
index 736a3c62b8..cc317d7a3b 100644
--- a/lib/snmp.c
+++ b/lib/snmp.c
@@ -78,6 +78,34 @@ void oid_copy_addr(oid oid[], const struct in_addr *addr, int len)
oid[i] = *pnt++;
}
+void oid2string(oid oid[], int len, char *string)
+{
+ int i;
+ uint8_t *pnt;
+
+ if (len == 0)
+ return;
+
+ pnt = (uint8_t *)string;
+
+ for (i = 0; i < len; i++)
+ *pnt++ = oid[i];
+}
+
+void oid_copy_str(oid oid[], const char *string, int len)
+{
+ int i;
+ const uint8_t *pnt;
+
+ if (len == 0)
+ return;
+
+ pnt = (uint8_t *)string;
+
+ for (i = 0; i < len; i++)
+ oid[i] = *pnt++;
+}
+
int smux_header_generic(struct variable *v, oid *name, size_t *length,
int exact, size_t *var_len, WriteMethod **write_method)
{