summaryrefslogtreecommitdiff
path: root/lib/smux.h
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2022-11-22 14:58:22 -0500
committerGitHub <noreply@github.com>2022-11-22 14:58:22 -0500
commit2387dca4dcf35c7adf936c94816f5ab8f92fb550 (patch)
treef1a39437bdbe2bb830dcfdcaaf28c0fd1787c028 /lib/smux.h
parentf5a6f8202d179a904256d46cdaf7fe4d26d11661 (diff)
parentff18b7b078e1f195d923db1ad5c1c68f1eb453de (diff)
Merge pull request #12311 from opensourcerouting/feature/bgp_snmp_bgp4v2-mib
bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry)
Diffstat (limited to 'lib/smux.h')
-rw-r--r--lib/smux.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/smux.h b/lib/smux.h
index 74447341d8..48c3374236 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -44,6 +44,7 @@ extern "C" {
#define SNMP_INVALID 2
#define IN_ADDR_SIZE sizeof(struct in_addr)
+#define IN6_ADDR_SIZE sizeof(struct in6_addr)
/* IANAipRouteProtocol */
#define IANAIPROUTEPROTOCOLOTHER 1
@@ -87,8 +88,9 @@ struct index_oid {
/* Declare SMUX return value. */
#define SNMP_LOCAL_VARIABLES \
static long snmp_int_val __attribute__((unused)); \
- static struct in_addr snmp_in_addr_val __attribute__((unused));
- static uint8_t snmp_octet_val __attribute__((unused));
+ static struct in_addr snmp_in_addr_val __attribute__((unused)); \
+ static uint8_t snmp_octet_val __attribute__((unused)); \
+ static char snmp_string_val[255] __attribute__((unused));
#define SNMP_INTEGER(V) \
(*var_len = sizeof(snmp_int_val), snmp_int_val = V, \
(uint8_t *)&snmp_int_val)
@@ -97,6 +99,10 @@ struct index_oid {
(*var_len = sizeof(snmp_octet_val), snmp_octet_val = V, \
(uint8_t *)&snmp_octet_val)
+#define SNMP_STRING(V) \
+ (*var_len = MIN(sizeof(snmp_string_val), strlen(V) + 1), \
+ strlcpy(snmp_string_val, V, *var_len), (uint8_t *)&snmp_string_val)
+
#define SNMP_IPADDRESS(V) \
(*var_len = sizeof(struct in_addr), snmp_in_addr_val = V, \
(uint8_t *)&snmp_in_addr_val)