Merge pull request #5240 from donaldsharp/zebra_nhg_sa

ZEBRA COVERITY STUFF
This commit is contained in:
Donatas Abraitis 2019-10-29 15:53:27 +02:00 committed by GitHub
commit 8bee6401b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View File

@ -2246,6 +2246,7 @@ static struct nexthop netlink_nexthop_process_nh(struct rtattr **tb,
enum nexthop_types_t type = 0; enum nexthop_types_t type = 0;
int if_index = 0; int if_index = 0;
size_t sz = 0; size_t sz = 0;
struct interface *ifp_lookup;
if_index = *(int *)RTA_DATA(tb[NHA_OIF]); if_index = *(int *)RTA_DATA(tb[NHA_OIF]);
@ -2280,9 +2281,13 @@ static struct nexthop netlink_nexthop_process_nh(struct rtattr **tb,
if (if_index) if (if_index)
nh.ifindex = if_index; nh.ifindex = if_index;
*ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), nh.ifindex); ifp_lookup =
if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), nh.ifindex);
if (ifp) if (ifp)
nh.vrf_id = (*ifp)->vrf_id; *ifp = ifp_lookup;
if (ifp_lookup)
nh.vrf_id = ifp_lookup->vrf_id;
else { else {
flog_warn( flog_warn(
EC_ZEBRA_UNKNOWN_INTERFACE, EC_ZEBRA_UNKNOWN_INTERFACE,

View File

@ -886,8 +886,7 @@ static void nhg_ctx_process_finish(struct nhg_ctx *ctx)
nexthop_del_labels(nh); nexthop_del_labels(nh);
done: done:
if (ctx) nhg_ctx_free(ctx);
nhg_ctx_free(ctx);
} }
static int queue_add(struct nhg_ctx *ctx) static int queue_add(struct nhg_ctx *ctx)

View File

@ -5775,12 +5775,14 @@ static void process_remote_macip_del(vni_t vni,
vlan_if = zvni_map_to_svi(vxl->access_vlan, vlan_if = zvni_map_to_svi(vxl->access_vlan,
zif->brslave_info.br_if); zif->brslave_info.br_if);
if (IS_ZEBRA_DEBUG_VXLAN) if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("%s: IP %s (flags 0x%x intf %s) is remote and duplicate, read kernel for local entry", zlog_debug(
__PRETTY_FUNCTION__, "%s: IP %s (flags 0x%x intf %s) is remote and duplicate, read kernel for local entry",
ipaddr2str(ipaddr, buf1, __PRETTY_FUNCTION__,
sizeof(buf1)), n->flags, ipaddr2str(ipaddr, buf1, sizeof(buf1)),
vlan_if->name); n->flags,
neigh_read_specific_ip(ipaddr, vlan_if); vlan_if ? vlan_if->name : "Unknown");
if (vlan_if)
neigh_read_specific_ip(ipaddr, vlan_if);
} }
/* When the MAC changes for an IP, it is possible the /* When the MAC changes for an IP, it is possible the