From 5a224c19f195c03275011b0b642b844182485334 Mon Sep 17 00:00:00 2001 From: Pat Ruddy Date: Sun, 14 Feb 2021 12:09:55 +0000 Subject: bgpd, lib: add oid2in6_addr utility and use it The existing code was using the oid2in_addr API to copy IPv6 addresses passing an IPv6 length. Create a utility to do this properly and avoid annoying coverity with type checking. Signed-off-by: Pat Ruddy --- lib/snmp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/snmp.c') diff --git a/lib/snmp.c b/lib/snmp.c index e92f622bb9..17a4ed4a1d 100644 --- a/lib/snmp.c +++ b/lib/snmp.c @@ -64,6 +64,17 @@ void oid2in_addr(oid oid[], int len, struct in_addr *addr) *pnt++ = oid[i]; } +void oid2in6_addr(oid oid[], struct in6_addr *addr) +{ + unsigned int i; + uint8_t *pnt; + + pnt = (uint8_t *)addr; + + for (i = 0; i < sizeof(struct in6_addr); i++) + *pnt++ = oid[i]; +} + void oid2int(oid oid[], int *dest) { uint8_t i; -- cgit v1.2.3