Skip to content

Commit

Permalink
Merge pull request #6248 from donaldsharp/zebra_snmp
Browse files Browse the repository at this point in the history
some more coverity fixups
  • Loading branch information
ton31337 authored Apr 17, 2020
2 parents bece779 + 85948e7 commit 4110aa2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,7 @@ DEFUN (ipv6_access_list_exact,
if (argv_find(argv, argc, "exact-match", &idx))
exact = 1;

assert(prefix);
return filter_set_zebra(vty, argv[idx_word]->arg, seq, permit_deny,
AFI_IP6, prefix, exact, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion ospfd/ospf_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ static struct ospf_area *ospfStubAreaLookup(struct variable *v, oid name[],

area = ospf_area_lookup_by_area_id(ospf, *addr);

if (area->external_routing == OSPF_AREA_STUB)
if (area && area->external_routing == OSPF_AREA_STUB)
return area;
else
return NULL;
Expand Down
6 changes: 5 additions & 1 deletion pimd/pim_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,11 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
case NEXTHOP_TYPE_IPV6_IFINDEX:
ifp1 = if_lookup_by_index(nexthop->ifindex,
pim->vrf_id);
nbr = pim_neighbor_find_if(ifp1);

if (!ifp1)
nbr = NULL;
else
nbr = pim_neighbor_find_if(ifp1);
/* Overwrite with Nbr address as NH addr */
if (nbr)
nexthop->gate.ipv4 = nbr->source_addr;
Expand Down
20 changes: 10 additions & 10 deletions pimd/pim_zlookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,17 @@ static int zclient_read_nexthop(struct pim_instance *pim,
* If we are sending v6 secondary assume we receive v6
* secondary
*/
if (pim->send_v6_secondary)
nbr = pim_neighbor_find_by_secondary(
if_lookup_by_index(
nexthop_tab[num_ifindex]
.ifindex,
nexthop_vrf_id),
&p);
struct interface *ifp = if_lookup_by_index(
nexthop_tab[num_ifindex].ifindex,
nexthop_vrf_id);

if (!ifp)
nbr = NULL;
else if (pim->send_v6_secondary)
nbr = pim_neighbor_find_by_secondary(ifp, &p);
else
nbr = pim_neighbor_find_if(if_lookup_by_index(
nexthop_tab[num_ifindex].ifindex,
nexthop_vrf_id));
nbr = pim_neighbor_find_if(ifp);

if (nbr) {
nexthop_tab[num_ifindex].nexthop_addr.family =
AF_INET;
Expand Down
4 changes: 2 additions & 2 deletions zebra/zebra_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ static void check_replace(struct route_node *np2, struct route_entry *re2,
return;
}

if (in_addr_cmp(&(*np)->p.u.prefix, &np2->p.u.prefix) < 0)
if (prefix_cmp(&(*np)->p, &np2->p) < 0)
return;
if (in_addr_cmp(&(*np)->p.u.prefix, &np2->p.u.prefix) > 0) {
if (prefix_cmp(&(*np)->p, &np2->p) > 0) {
*np = np2;
*re = re2;
return;
Expand Down

0 comments on commit 4110aa2

Please sign in to comment.