*: fix assorted issues detected by Coverity Scan

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2017-08-24 21:43:29 -03:00
parent e691f179b6
commit 0af35d90a1
22 changed files with 48 additions and 97 deletions

View File

@ -2042,7 +2042,7 @@ static void evpn_mpattr_encode_type5(struct stream *s, struct prefix *p,
/* Prefix contains RD, ESI, EthTag, IP length, IP, GWIP and VNI */ /* Prefix contains RD, ESI, EthTag, IP length, IP, GWIP and VNI */
stream_putc(s, 8 + 10 + 4 + 1 + len + 3); stream_putc(s, 8 + 10 + 4 + 1 + len + 3);
stream_put(s, prd->val, 8); stream_put(s, prd->val, 8);
if (attr && attr) if (attr)
stream_put(s, &(attr->evpn_overlay.eth_s_id), 10); stream_put(s, &(attr->evpn_overlay.eth_s_id), 10);
else else
stream_put(s, &temp, 10); stream_put(s, &temp, 10);
@ -2052,7 +2052,7 @@ static void evpn_mpattr_encode_type5(struct stream *s, struct prefix *p,
stream_put_ipv4(s, p_evpn_p->ip.ipaddr_v4.s_addr); stream_put_ipv4(s, p_evpn_p->ip.ipaddr_v4.s_addr);
else else
stream_put(s, &p_evpn_p->ip.ipaddr_v6, 16); stream_put(s, &p_evpn_p->ip.ipaddr_v6, 16);
if (attr && attr) { if (attr) {
if (IS_IPADDR_V4(&p_evpn_p->ip)) if (IS_IPADDR_V4(&p_evpn_p->ip))
stream_put_ipv4(s, stream_put_ipv4(s,
attr->evpn_overlay.gw_ip.ipv4.s_addr); attr->evpn_overlay.gw_ip.ipv4.s_addr);

View File

@ -10298,10 +10298,6 @@ static int bgp_show_neighbor_route(struct vty *vty, struct peer *peer,
return CMD_WARNING; return CMD_WARNING;
} }
/* labeled-unicast routes live in the unicast table */
if (safi == SAFI_LABELED_UNICAST)
safi = SAFI_UNICAST;
return bgp_show(vty, peer->bgp, afi, safi, type, &peer->su, use_json); return bgp_show(vty, peer->bgp, afi, safi, type, &peer->su, use_json);
} }

View File

@ -658,8 +658,10 @@ static void *route_match_vni_compile(const char *arg)
return NULL; return NULL;
*vni = strtoul(arg, &end, 10); *vni = strtoul(arg, &end, 10);
if (*end != '\0') if (*end != '\0') {
XFREE(MTYPE_ROUTE_MAP_COMPILED, vni);
return NULL; return NULL;
}
return vni; return vni;
} }

View File

@ -2977,11 +2977,6 @@ DEFUN_NOSH (vnc_vrf_policy,
struct rfapi_nve_group_cfg *rfg; struct rfapi_nve_group_cfg *rfg;
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* Search for name */ /* Search for name */
rfg = bgp_rfapi_cfg_match_byname(bgp, argv[1]->arg, rfg = bgp_rfapi_cfg_match_byname(bgp, argv[1]->arg,
RFAPI_GROUP_CFG_VRF); RFAPI_GROUP_CFG_VRF);
@ -3012,10 +3007,6 @@ DEFUN (vnc_no_vrf_policy,
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
return bgp_rfapi_delete_named_nve_group(vty, bgp, argv[2]->arg, return bgp_rfapi_delete_named_nve_group(vty, bgp, argv[2]->arg,
RFAPI_GROUP_CFG_VRF); RFAPI_GROUP_CFG_VRF);
} }
@ -3031,11 +3022,6 @@ DEFUN (vnc_vrf_policy_label,
uint32_t label; uint32_t label;
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3145,11 +3131,6 @@ DEFUN (vnc_vrf_policy_rt_import,
int is_export_bgp = 0; int is_export_bgp = 0;
int is_export_zebra = 0; int is_export_zebra = 0;
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3213,11 +3194,6 @@ DEFUN (vnc_vrf_policy_rt_export,
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
int rc; int rc;
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3253,11 +3229,6 @@ DEFUN (vnc_vrf_policy_rt_both,
struct listnode *node; struct listnode *node;
struct rfapi_rfg_name *rfgn; struct rfapi_rfg_name *rfgn;
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3333,11 +3304,6 @@ DEFUN (vnc_vrf_policy_rd,
VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg); VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->nve_groups_sequential, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3420,11 +3386,6 @@ DEFUN_NOSH (vnc_l2_group,
struct rfapi_l2_group_cfg *rfg; struct rfapi_l2_group_cfg *rfg;
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* Search for name */ /* Search for name */
rfg = rfapi_l2_group_lookup_byname(bgp, argv[1]->arg); rfg = rfapi_l2_group_lookup_byname(bgp, argv[1]->arg);
@ -3505,10 +3466,6 @@ DEFUN (vnc_no_l2_group,
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
return bgp_rfapi_delete_named_l2_group(vty, bgp, argv[3]->arg); return bgp_rfapi_delete_named_l2_group(vty, bgp, argv[3]->arg);
} }
@ -3522,11 +3479,6 @@ DEFUN (vnc_l2_group_lni,
VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg); VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg);
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3549,11 +3501,6 @@ DEFUN (vnc_l2_group_labels,
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
struct list *ll; struct list *ll;
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3589,11 +3536,6 @@ DEFUN (vnc_l2_group_no_labels,
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
struct list *ll; struct list *ll;
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) {
/* Not in list anymore */ /* Not in list anymore */
@ -3646,10 +3588,6 @@ DEFUN (vnc_l2_group_rt,
vty_out(vty, "Unknown option, %s\n", argv[1]->arg); vty_out(vty, "Unknown option, %s\n", argv[1]->arg);
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
} }
if (!bgp) {
vty_out(vty, "No BGP process is configured\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* make sure it's still in list */ /* make sure it's still in list */
if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) { if (!listnode_lookup(bgp->rfapi_cfg->l2_groups, rfg)) {

View File

@ -3875,10 +3875,9 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
default: default:
/* not expected */ /* not expected */
zlog_err("%s: bad safi %d", __func__, safi);
return NULL; return NULL;
} }
zlog_err("%s: bad safi %d", __func__, safi);
return NULL;
} }
void rfapiProcessUpdate(struct peer *peer, void rfapiProcessUpdate(struct peer *peer,

View File

@ -2201,7 +2201,7 @@ DEFUN (no_set_ip_nexthop,
"Next hop address\n" "Next hop address\n"
"IP address of next hop\n") "IP address of next hop\n")
{ {
int idx; int idx = 0;
VTY_DECLVAR_CONTEXT(route_map_index, index); VTY_DECLVAR_CONTEXT(route_map_index, index);
const char *arg = NULL; const char *arg = NULL;

View File

@ -231,11 +231,7 @@ static int ospf6_zebra_read_route(int command, struct zclient *zclient,
char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128]; char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
prefix2str((struct prefix *)&api.prefix, prefixstr, prefix2str((struct prefix *)&api.prefix, prefixstr,
sizeof(prefixstr)); sizeof(prefixstr));
if (nexthop) inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr));
inet_ntop(AF_INET6, nexthop, nexthopstr,
sizeof(nexthopstr));
else
snprintf(nexthopstr, sizeof(nexthopstr), "::");
zlog_debug( zlog_debug(
"Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI, "Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI,

View File

@ -2425,7 +2425,7 @@ DEFUN (show_ip_ospf_mpls_te_router,
if (ntohs(OspfMplsTE.router_addr.header.type) != 0) if (ntohs(OspfMplsTE.router_addr.header.type) != 0)
show_vty_router_addr(vty, show_vty_router_addr(vty,
&OspfMplsTE.router_addr.header); &OspfMplsTE.router_addr.header);
else if (vty != NULL) else
vty_out(vty, " N/A\n"); vty_out(vty, " N/A\n");
} }
return CMD_SUCCESS; return CMD_SUCCESS;

View File

@ -1685,6 +1685,7 @@ int rip_recvmsg(int sock, u_char *buf, int size, struct sockaddr_in *from,
struct cmsghdr *ptr; struct cmsghdr *ptr;
char adata[1024]; char adata[1024];
memset(&msg, 0, sizeof(msg));
msg.msg_name = (void *)from; msg.msg_name = (void *)from;
msg.msg_namelen = sizeof(struct sockaddr_in); msg.msg_namelen = sizeof(struct sockaddr_in);
msg.msg_iov = &iov; msg.msg_iov = &iov;

View File

@ -176,6 +176,7 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to,
addr.sin6_port = htons(RIPNG_PORT_DEFAULT); addr.sin6_port = htons(RIPNG_PORT_DEFAULT);
} }
memset(&msg, 0, sizeof(msg));
msg.msg_name = (void *)&addr; msg.msg_name = (void *)&addr;
msg.msg_namelen = sizeof(struct sockaddr_in6); msg.msg_namelen = sizeof(struct sockaddr_in6);
msg.msg_iov = &iov; msg.msg_iov = &iov;
@ -228,6 +229,7 @@ static int ripng_recv_packet(int sock, u_char *buf, int bufsize,
char adata[1024]; char adata[1024];
/* Fill in message and iovec. */ /* Fill in message and iovec. */
memset(&msg, 0, sizeof(msg));
msg.msg_name = (void *)from; msg.msg_name = (void *)from;
msg.msg_namelen = sizeof(struct sockaddr_in6); msg.msg_namelen = sizeof(struct sockaddr_in6);
msg.msg_iov = &iov; msg.msg_iov = &iov;

View File

@ -393,7 +393,7 @@ static int get_iflink_speed(const char *ifname)
memset(&ifdata, 0, sizeof(ifdata)); memset(&ifdata, 0, sizeof(ifdata));
/* set interface name */ /* set interface name */
strcpy(ifdata.ifr_name, ifname); strlcpy(ifdata.ifr_name, ifname, sizeof(ifdata.ifr_name));
/* initialize ethtool interface */ /* initialize ethtool interface */
memset(&ecmd, 0, sizeof(ecmd)); memset(&ecmd, 0, sizeof(ecmd));

View File

@ -493,7 +493,7 @@ void if_add_update(struct interface *ifp)
if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) { if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) {
SET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE); SET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE);
if (if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) { if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) {
if (IS_ZEBRA_DEBUG_KERNEL) if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug( zlog_debug(
"interface %s vrf %u index %d is shutdown. " "interface %s vrf %u index %d is shutdown. "

View File

@ -44,7 +44,7 @@ extern struct zebra_privs_t zserv_privs;
/* clear and set interface name string */ /* clear and set interface name string */
void ifreq_set_name(struct ifreq *ifreq, struct interface *ifp) void ifreq_set_name(struct ifreq *ifreq, struct interface *ifp)
{ {
strncpy(ifreq->ifr_name, ifp->name, IFNAMSIZ); strlcpy(ifreq->ifr_name, ifp->name, sizeof(ifreq->ifr_name));
} }
/* call ioctl system call */ /* call ioctl system call */

View File

@ -182,6 +182,7 @@ static int irdp_recvmsg(int sock, u_char *buf, int size, int *ifindex)
char adata[CMSG_SPACE(SOPT_SIZE_CMSG_PKTINFO_IPV4())]; char adata[CMSG_SPACE(SOPT_SIZE_CMSG_PKTINFO_IPV4())];
int ret; int ret;
memset(&msg, 0, sizeof(msg));
msg.msg_name = (void *)0; msg.msg_name = (void *)0;
msg.msg_namelen = 0; msg.msg_namelen = 0;
msg.msg_iov = &iov; msg.msg_iov = &iov;

View File

@ -558,8 +558,8 @@ static int netlink_route_change_read_multicast(struct sockaddr_nl *snl,
if (IS_ZEBRA_DEBUG_KERNEL) { if (IS_ZEBRA_DEBUG_KERNEL) {
struct interface *ifp; struct interface *ifp;
strcpy(sbuf, inet_ntoa(m->sg.src)); strlcpy(sbuf, inet_ntoa(m->sg.src), sizeof(sbuf));
strcpy(gbuf, inet_ntoa(m->sg.grp)); strlcpy(gbuf, inet_ntoa(m->sg.grp), sizeof(gbuf));
for (count = 0; count < oif_count; count++) { for (count = 0; count < oif_count; count++) {
ifp = if_lookup_by_index(oif[count], vrf); ifp = if_lookup_by_index(oif[count], vrf);
char temp[256]; char temp[256];
@ -1553,6 +1553,8 @@ int kernel_get_ipmr_sg_stats(struct zebra_vrf *zvrf, void *in)
int kernel_route_rib(struct prefix *p, struct prefix *src_p, int kernel_route_rib(struct prefix *p, struct prefix *src_p,
struct route_entry *old, struct route_entry *new) struct route_entry *old, struct route_entry *new)
{ {
assert(old || new);
if (!old && new) if (!old && new)
return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 0); return netlink_route_multipath(RTM_NEWROUTE, p, src_p, new, 0);
if (old && !new) if (old && !new)

View File

@ -107,6 +107,7 @@ static int rtadv_recv_packet(struct zebra_ns *zns, int sock, u_char *buf,
char adata[1024]; char adata[1024];
/* Fill in message and iovec. */ /* Fill in message and iovec. */
memset(&msg, 0, sizeof(msg));
msg.msg_name = (void *)from; msg.msg_name = (void *)from;
msg.msg_namelen = sizeof(struct sockaddr_in6); msg.msg_namelen = sizeof(struct sockaddr_in6);
msg.msg_iov = &iov; msg.msg_iov = &iov;

View File

@ -840,7 +840,7 @@ static void lsp_schedule(struct hash_backet *backet, void *ctxt)
zebra_lsp_t *lsp; zebra_lsp_t *lsp;
lsp = (zebra_lsp_t *)backet->data; lsp = (zebra_lsp_t *)backet->data;
lsp_processq_add(lsp); (void)lsp_processq_add(lsp);
} }
/* /*
@ -2718,10 +2718,10 @@ int zebra_mpls_write_lsp_config(struct vty *vty, struct zebra_vrf *zvrf)
for (ALL_LIST_ELEMENTS_RO(slsp_list, node, slsp)) { for (ALL_LIST_ELEMENTS_RO(slsp_list, node, slsp)) {
for (snhlfe = slsp->snhlfe_list; snhlfe; for (snhlfe = slsp->snhlfe_list; snhlfe;
snhlfe = snhlfe->next) { snhlfe = snhlfe->next) {
char buf[INET6_ADDRSTRLEN]; char buf[BUFSIZ];
char lstr[30]; char lstr[30];
snhlfe2str(snhlfe, buf, BUFSIZ); snhlfe2str(snhlfe, buf, sizeof(buf));
switch (snhlfe->out_label) { switch (snhlfe->out_label) {
case MPLS_V4_EXP_NULL_LABEL: case MPLS_V4_EXP_NULL_LABEL:
case MPLS_V6_EXP_NULL_LABEL: case MPLS_V6_EXP_NULL_LABEL:

View File

@ -48,8 +48,8 @@ int zebra_ipmr_route_stats(struct zserv *client, int fd, u_short length,
char sbuf[40]; char sbuf[40];
char gbuf[40]; char gbuf[40];
strcpy(sbuf, inet_ntoa(mroute.sg.src)); strlcpy(sbuf, inet_ntoa(mroute.sg.src), sizeof(sbuf));
strcpy(gbuf, inet_ntoa(mroute.sg.grp)); strlcpy(gbuf, inet_ntoa(mroute.sg.grp), sizeof(gbuf));
zlog_debug("Asking for (%s,%s) mroute information", sbuf, gbuf); zlog_debug("Asking for (%s,%s) mroute information", sbuf, gbuf);
} }

View File

@ -328,6 +328,7 @@ DEFUN_NOSH (pseudowire_if,
if (!pw) if (!pw)
return CMD_SUCCESS; return CMD_SUCCESS;
zebra_pw_del(zvrf, pw); zebra_pw_del(zvrf, pw);
return CMD_SUCCESS;
} }
if (!pw) if (!pw)

View File

@ -470,7 +470,7 @@ static int vrf_config_write(struct vty *vty)
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
{ {
zvrf = vrf->info; zvrf = vrf->info;
if (!zvrf || strcmp(zvrf_name(zvrf), VRF_DEFAULT_NAME)) { if (strcmp(zvrf_name(zvrf), VRF_DEFAULT_NAME)) {
vty_out(vty, "vrf %s\n", zvrf_name(zvrf)); vty_out(vty, "vrf %s\n", zvrf_name(zvrf));
vty_out(vty, "!\n"); vty_out(vty, "!\n");
} }

View File

@ -1181,7 +1181,10 @@ DEFUN (show_ip_route,
tag = strtoul(argv[idx + 1]->arg, NULL, 10); tag = strtoul(argv[idx + 1]->arg, NULL, 10);
else if (argv_find(argv, argc, "A.B.C.D/M", &idx)) { else if (argv_find(argv, argc, "A.B.C.D/M", &idx)) {
str2prefix(argv[idx]->arg, &p); if (str2prefix(argv[idx]->arg, &p) <= 0) {
vty_out(vty, "%% Malformed prefix\n");
return CMD_WARNING;
}
longer_prefixes = true; longer_prefixes = true;
} }
@ -1834,7 +1837,10 @@ DEFUN (show_ipv6_route,
tag = strtoul(argv[idx + 1]->arg, NULL, 10); tag = strtoul(argv[idx + 1]->arg, NULL, 10);
else if (argv_find(argv, argc, "X:X::X:X/M", &idx)) { else if (argv_find(argv, argc, "X:X::X:X/M", &idx)) {
str2prefix(argv[idx]->arg, &p); if (str2prefix(argv[idx]->arg, &p) <= 0) {
vty_out(vty, "%% Malformed prefix\n");
return CMD_WARNING;
}
longer_prefixes = true; longer_prefixes = true;
} }
@ -2572,6 +2578,8 @@ DEFUN (ip_zebra_import_table_distance,
vty_out(vty, vty_out(vty,
"Invalid routing table ID, %d. Must be in range 1-252\n", "Invalid routing table ID, %d. Must be in range 1-252\n",
table_id); table_id);
if (rmap)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap);
return CMD_WARNING; return CMD_WARNING;
} }
@ -2579,6 +2587,8 @@ DEFUN (ip_zebra_import_table_distance,
vty_out(vty, vty_out(vty,
"Invalid routing table ID, %d. Must be non-default table\n", "Invalid routing table ID, %d. Must be non-default table\n",
table_id); table_id);
if (rmap)
XFREE(MTYPE_ROUTE_MAP_NAME, rmap);
return CMD_WARNING; return CMD_WARNING;
} }

View File

@ -1343,8 +1343,7 @@ static int zvni_gw_macip_add(struct interface *ifp, zebra_vni_t *zvni,
zlog_err( zlog_err(
"%u:Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", "%u:Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u",
ifp->vrf_id, ipaddr2str(ip, buf2, sizeof(buf2)), ifp->vrf_id, ipaddr2str(ip, buf2, sizeof(buf2)),
prefix_mac2str(macaddr, NULL, prefix_mac2str(macaddr, buf, sizeof(buf)),
ETHER_ADDR_STRLEN),
ifp->name, ifp->ifindex, zvni->vni); ifp->name, ifp->ifindex, zvni->vni);
return -1; return -1;
} }
@ -1380,6 +1379,7 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
struct zebra_vrf *zvrf = NULL; struct zebra_vrf *zvrf = NULL;
zebra_neigh_t *n = NULL; zebra_neigh_t *n = NULL;
zebra_mac_t *mac = NULL; zebra_mac_t *mac = NULL;
char buf1[ETHER_ADDR_STRLEN];
char buf2[INET6_ADDRSTRLEN]; char buf2[INET6_ADDRSTRLEN];
zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id); zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
@ -1393,11 +1393,13 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
/* mac entry should be present */ /* mac entry should be present */
mac = zvni_mac_lookup(zvni, &n->emac); mac = zvni_mac_lookup(zvni, &n->emac);
if (!mac) if (!mac) {
zlog_err("%u: MAC %s doesnt exsists for neigh %s on VNI %u", zlog_err("%u: MAC %s doesnt exists for neigh %s on VNI %u",
ifp->vrf_id, ifp->vrf_id,
prefix_mac2str(&n->emac, NULL, ETHER_ADDR_STRLEN), prefix_mac2str(&n->emac, buf1, sizeof(buf1)),
ipaddr2str(ip, buf2, sizeof(buf2)), zvni->vni); ipaddr2str(ip, buf2, sizeof(buf2)), zvni->vni);
return -1;
}
/* If the entry is not local nothing to do*/ /* If the entry is not local nothing to do*/
if (!CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL)) if (!CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL))
@ -1407,7 +1409,7 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
zlog_debug( zlog_debug(
"%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP", "%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
ifp->vrf_id, ifp->name, ifp->ifindex, zvni->vni, ifp->vrf_id, ifp->name, ifp->ifindex, zvni->vni,
prefix_mac2str(&(n->emac), NULL, ETHER_ADDR_STRLEN), prefix_mac2str(&(n->emac), buf1, sizeof(buf1)),
ipaddr2str(ip, buf2, sizeof(buf2))); ipaddr2str(ip, buf2, sizeof(buf2)));
/* Remove neighbor from BGP. */ /* Remove neighbor from BGP. */