diff options
| author | Pat Ruddy <pat@voltanet.io> | 2021-02-14 12:09:55 +0000 | 
|---|---|---|
| committer | Pat Ruddy <pat@voltanet.io> | 2021-02-17 13:35:31 +0000 | 
| commit | 5a224c19f195c03275011b0b642b844182485334 (patch) | |
| tree | 09dfbb7db61ece54fa7bdb596af91893c2fd3689 /lib/snmp.c | |
| parent | 23b88a967da32cc719554e50187127a9cc6d5b42 (diff) | |
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 <pat@voltanet.io>
Diffstat (limited to 'lib/snmp.c')
| -rw-r--r-- | lib/snmp.c | 11 | 
1 files changed, 11 insertions, 0 deletions
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;  | 
