mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 23:09:34 +00:00
Merge pull request #8079 from pjdruddy/pr-snmp-coverity
MPLSL3VPN snmp coverity fixes
This commit is contained in:
commit
dc86ef74e6
@ -1023,14 +1023,17 @@ static struct bgp *bgpL3vpnVrfRt_lookup(struct variable *v, oid name[],
|
|||||||
*rt_type = name[namelen + vrf_name_len + sizeof(uint32_t)];
|
*rt_type = name[namelen + vrf_name_len + sizeof(uint32_t)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* validate the RT index is in range */
|
||||||
|
if (*rt_index > AFI_IP6)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (exact) {
|
if (exact) {
|
||||||
l3vpn_bgp = bgp_lookup_by_name(vrf_name);
|
l3vpn_bgp = bgp_lookup_by_name(vrf_name);
|
||||||
if (l3vpn_bgp && !is_bgp_vrf_mplsvpn(l3vpn_bgp))
|
if (l3vpn_bgp && !is_bgp_vrf_mplsvpn(l3vpn_bgp))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!l3vpn_bgp)
|
if (!l3vpn_bgp)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* check the index and type match up */
|
if ((*rt_index != AFI_IP) && (*rt_index != AFI_IP6))
|
||||||
if ((*rt_index != AFI_IP) || (*rt_index != AFI_IP6))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
/* do we have RT config */
|
/* do we have RT config */
|
||||||
if (!(l3vpn_bgp->vpn_policy[*rt_index]
|
if (!(l3vpn_bgp->vpn_policy[*rt_index]
|
||||||
@ -1408,8 +1411,7 @@ static struct bgp_path_info *bgpL3vpnRte_lookup(struct variable *v, oid name[],
|
|||||||
break;
|
break;
|
||||||
case INETADDRESSTYPEIPV6:
|
case INETADDRESSTYPEIPV6:
|
||||||
prefix.family = AF_INET6;
|
prefix.family = AF_INET6;
|
||||||
oid2in_addr(&name[i], sizeof(struct in6_addr),
|
oid2in6_addr(&name[i], &prefix.u.prefix6);
|
||||||
&prefix.u.prefix4); /* sic */
|
|
||||||
i += sizeof(struct in6_addr);
|
i += sizeof(struct in6_addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1431,8 +1433,7 @@ static struct bgp_path_info *bgpL3vpnRte_lookup(struct variable *v, oid name[],
|
|||||||
break;
|
break;
|
||||||
case INETADDRESSTYPEIPV6:
|
case INETADDRESSTYPEIPV6:
|
||||||
nexthop.ipa_type = IPADDR_V6;
|
nexthop.ipa_type = IPADDR_V6;
|
||||||
oid2in_addr(&name[i], sizeof(struct in6_addr),
|
oid2in6_addr(&name[i], &nexthop.ip._v6_addr);
|
||||||
&nexthop.ip._v4_addr); /* sic */
|
|
||||||
/* i += sizeof(struct in6_addr); */
|
/* i += sizeof(struct in6_addr); */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1458,7 +1459,7 @@ static struct bgp_path_info *bgpL3vpnRte_lookup(struct variable *v, oid name[],
|
|||||||
/* otherwise lookup the one we have */
|
/* otherwise lookup the one we have */
|
||||||
*l3vpn_bgp = bgp_lookup_by_name(vrf_name);
|
*l3vpn_bgp = bgp_lookup_by_name(vrf_name);
|
||||||
|
|
||||||
if (l3vpn_bgp == NULL)
|
if (*l3vpn_bgp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pi = bgp_lookup_route_next(l3vpn_bgp, dest, &prefix, policy,
|
pi = bgp_lookup_route_next(l3vpn_bgp, dest, &prefix, policy,
|
||||||
|
@ -143,6 +143,7 @@ extern int smux_trap_multi_index(struct variable *vp, size_t vp_len,
|
|||||||
size_t trapobjlen, uint8_t sptrap);
|
size_t trapobjlen, uint8_t sptrap);
|
||||||
extern int oid_compare(const oid *, int, const oid *, int);
|
extern int oid_compare(const oid *, int, const oid *, int);
|
||||||
extern void oid2in_addr(oid[], int, struct in_addr *);
|
extern void oid2in_addr(oid[], int, struct in_addr *);
|
||||||
|
extern void oid2in6_addr(oid oid[], struct in6_addr *addr);
|
||||||
extern void oid2int(oid oid[], int *dest);
|
extern void oid2int(oid oid[], int *dest);
|
||||||
extern void *oid_copy(void *, const void *, size_t);
|
extern void *oid_copy(void *, const void *, size_t);
|
||||||
extern void oid_copy_addr(oid[], const struct in_addr *, int);
|
extern void oid_copy_addr(oid[], const struct in_addr *, int);
|
||||||
|
11
lib/snmp.c
11
lib/snmp.c
@ -64,6 +64,17 @@ void oid2in_addr(oid oid[], int len, struct in_addr *addr)
|
|||||||
*pnt++ = oid[i];
|
*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)
|
void oid2int(oid oid[], int *dest)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
Loading…
Reference in New Issue
Block a user