diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2021-03-25 19:40:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-25 19:40:34 -0400 |
| commit | 1267dd416ede8beebf5c3e55a5506f6aff8d59b8 (patch) | |
| tree | 4caaaf06106fdcda51750d54eb27cb1303707ea5 /lib/snmp.c | |
| parent | 1a6aa9d0984daa5c2f137314e6d288ebbc88f9b2 (diff) | |
| parent | 9e26322126ed6daef7ae16b4c9a547ae28a02226 (diff) | |
Merge pull request #8344 from pjdruddy/coverity_mpls_l3vpn
lib, bgpd: add a specific oid_copy function for IPv6 addrs
Diffstat (limited to 'lib/snmp.c')
| -rw-r--r-- | lib/snmp.c | 17 |
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; |
