int is_zebra_import_table_enabled(afi_t afi, u_int32_t table_id)
{
+ /*
+ * Make sure that what we are called with actualy makes sense
+ */
+ if (afi == AFI_MAX)
+ return 0;
+
if (is_zebra_valid_kernel_table(table_id))
return zebra_import_table_used[afi][table_id];
return 0;
safe_strerror(errno));
if (sock < 0) {
- close(sock);
return -1;
}
if (ptm_cb.wb)
buffer_free(ptm_cb.wb);
- if (ptm_cb.ptm_sock != -1)
+ if (ptm_cb.ptm_sock >= 0)
close(ptm_cb.ptm_sock);
}
void rib_close_table(struct route_table *table)
{
struct route_node *rn;
- rib_table_info_t *info = table->info;
+ rib_table_info_t *info;
struct route_entry *re;
- if (table)
- for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
- if (!CHECK_FLAG(re->status,
- ROUTE_ENTRY_SELECTED_FIB))
- continue;
+ if (!table)
+ return;
- if (info->safi == SAFI_UNICAST)
- hook_call(rib_update, rn, NULL);
+ info = table->info;
- if (!RIB_SYSTEM_ROUTE(re))
- rib_uninstall_kernel(rn, re);
- }
+ for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
+ RNODE_FOREACH_RE(rn, re)
+ {
+ if (!CHECK_FLAG(re->status,
+ ROUTE_ENTRY_SELECTED_FIB))
+ continue;
+
+ if (info->safi == SAFI_UNICAST)
+ hook_call(rib_update, rn, NULL);
+
+ if (!RIB_SYSTEM_ROUTE(re))
+ rib_uninstall_kernel(rn, re);
+ }
}
/* Routing information base initialize. */
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
{
zvrf = vrf->info;
+
+ if (!zvrf)
+ continue;
+
if (strcmp(zvrf_name(zvrf), VRF_DEFAULT_NAME)) {
vty_out(vty, "vrf %s\n", zvrf_name(zvrf));
vty_out(vty, "!\n");
if (!(n->flags & ZEBRA_NEIGH_REMOTE))
return 0;
- zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
- assert(zvrf);
if (!zvni->vxlan_if) {
zlog_err("VNI %u hash %p couldn't be uninstalled - no intf",
zvni->vni, zvni);
return -1;
}
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
+ assert(zvrf);
+
zif = zvni->vxlan_if->info;
if (!zif)
return -1;
zlog_debug(
"%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s add to BGP",
ifp->vrf_id, ifp->name, ifp->ifindex, zvni->vni,
- prefix_mac2str(macaddr, NULL, ETHER_ADDR_STRLEN),
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
ipaddr2str(ip, buf2, sizeof(buf2)));
zvni_neigh_send_add_to_client(zvrf, zvni->vni, ip, macaddr,
zvni_neigh_del(zvni, n);
/* see if the mac needs to be deleted as well*/
- zvni_deref_ip2mac(zvni, mac, 0);
+ if (mac)
+ zvni_deref_ip2mac(zvni, mac, 0);
return 0;
}
api.safi = stream_getw(s);
/* IPv4 prefix. */
- memset(&p, 0, sizeof(struct prefix_ipv6));
+ memset(&p, 0, sizeof(struct prefix));
p.family = AF_INET6;
p.prefixlen = stream_getc(s);
stream_get(&p.u.prefix6, s, PSIZE(p.prefixlen));