summaryrefslogtreecommitdiff
path: root/lib/snmp.c
diff options
context:
space:
mode:
authorPat Ruddy <pat@voltanet.io>2021-03-25 14:39:07 +0000
committerPat Ruddy <pat@voltanet.io>2021-03-25 15:24:50 +0000
commit9e26322126ed6daef7ae16b4c9a547ae28a02226 (patch)
tree2b80ff835e5368b6a70fe7cc87da585eeeca5c80 /lib/snmp.c
parent817f39203c46916a7d21f2b71adc2a1ef088aedd (diff)
lib, bgpd: add a specific oid_copy function for IPv6 addrs
Do not overload the v4 oid_copy_addr function for ipv6 coverity does not like this kind of thing. Signed-off-by: Pat Ruddy <pat@voltanet.io>
Diffstat (limited to 'lib/snmp.c')
-rw-r--r--lib/snmp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/snmp.c b/lib/snmp.c
index 17a4ed4a1d..23d3f38b31 100644
--- a/lib/snmp.c
+++ b/lib/snmp.c
@@ -88,13 +88,24 @@ void oid2int(oid oid[], int *dest)
*dest = ntohl(network_dest);
}
-void oid_copy_addr(oid oid[], const struct in_addr *addr, int len)
+void oid_copy_in_addr(oid oid[], const struct in_addr *addr)
{
int i;
const uint8_t *pnt;
+ int len = sizeof(struct in_addr);
- if (len == 0)
- return;
+ pnt = (uint8_t *)addr;
+
+ for (i = 0; i < len; i++)
+ oid[i] = *pnt++;
+}
+
+
+void oid_copy_in6_addr(oid oid[], const struct in6_addr *addr)
+{
+ int i;
+ const uint8_t *pnt;
+ int len = sizeof(struct in6_addr);
pnt = (uint8_t *)addr;