summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py3
-rw-r--r--zebra/if_netlink.c23
-rw-r--r--zebra/interface.c21
-rw-r--r--zebra/interface.h3
-rw-r--r--zebra/zebra_dplane.c4
-rw-r--r--zebra/zebra_rib.c27
6 files changed, 67 insertions, 14 deletions
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py
index 096e97fa94..e9c1916f75 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py
@@ -10,7 +10,8 @@ luCommand('r3','vtysh -c "debug rfapi-dev close vn 10.0.0.2 un 2.2.2.2"','status
luCommand('r4','vtysh -c "debug rfapi-dev unregister vn 10.0.0.3 un 3.3.3.3 prefix 33.33.33.0/24"','', 'none', 'Prefix removed')
luCommand('r4','vtysh -c "debug rfapi-dev unregister vn 10.0.0.3 un 3.3.3.3 prefix 11.11.11.0/24"','', 'none', 'MP prefix removed')
luCommand('r4','vtysh -c "show vnc registrations"','Locally: *Active: 0 ','wait','Local registration removed')
-luCommand('r4','vtysh -c "debug rfapi-dev close vn 10.0.0.3 un 3.3.3.3"','status 0', 'pass', 'Closed RFAPI')
+#luCommand('r4','vtysh -c "debug rfapi-dev close vn 10.0.0.3 un 3.3.3.3"','status 0', 'pass', 'Closed RFAPI')
+luCommand('r4','vtysh -c "clear vnc nve *"','.', 'pass', 'Cleared NVEs')
luCommand('r1','vtysh -c "show vnc registrations"','Locally: *Active: 0 .* Remotely: *Active: 0','wait','All registrations cleared')
luCommand('r3','vtysh -c "show vnc registrations"','Locally: *Active: 0 .* Remotely: *Active: 0','wait','All registrations cleared')
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index ba518ea576..ce0834f190 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -690,9 +690,6 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifp->speed = get_iflink_speed(ifp);
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
- if (desc)
- ifp->desc = XSTRDUP(MTYPE_TMP, desc);
-
/* Set zebra interface type */
zebra_if_set_ziftype(ifp, zif_type, zif_slave_type);
if (IS_ZEBRA_IF_VRF(ifp))
@@ -707,6 +704,11 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
zif = (struct zebra_if *)ifp->info;
zif->link_ifindex = link_ifindex;
+ if (desc) {
+ XFREE(MTYPE_TMP, zif->desc);
+ zif->desc = XSTRDUP(MTYPE_TMP, desc);
+ }
+
/* Hardware type and address. */
ifp->ll_type = netlink_to_zebra_link_type(ifi->ifi_type);
netlink_interface_update_hw_addr(tb, ifp);
@@ -1106,7 +1108,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifindex_t bond_ifindex = IFINDEX_INTERNAL;
ifindex_t link_ifindex = IFINDEX_INTERNAL;
uint8_t old_hw_addr[INTERFACE_HWADDR_MAX];
-
+ struct zebra_if *zif;
zns = zebra_ns_lookup(ns_id);
ifi = NLMSG_DATA(h);
@@ -1186,12 +1188,6 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
/* See if interface is present. */
ifp = if_lookup_by_name_per_ns(zns, name);
- if (ifp) {
- XFREE(MTYPE_TMP, ifp->desc);
- if (desc)
- ifp->desc = XSTRDUP(MTYPE_TMP, desc);
- }
-
if (h->nlmsg_type == RTM_NEWLINK) {
if (tb[IFLA_MASTER]) {
if (slave_kind && (strcmp(slave_kind, "vrf") == 0)
@@ -1390,6 +1386,13 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if_delete_update(ifp);
}
+ zif = ifp->info;
+ if (zif) {
+ XFREE(MTYPE_TMP, zif->desc);
+ if (desc)
+ zif->desc = XSTRDUP(MTYPE_TMP, desc);
+ }
+
return 0;
}
diff --git a/zebra/interface.c b/zebra/interface.c
index 10f1f92100..b0ddcaf8bc 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -181,6 +181,7 @@ static int if_zebra_delete_hook(struct interface *ifp)
list_delete(&rtadv->AdvDNSSLList);
#endif /* HAVE_RTADV */
+ XFREE(MTYPE_TMP, zebra_if->desc);
THREAD_OFF(zebra_if->speed_update);
XFREE(MTYPE_ZINFO, zebra_if);
@@ -1303,6 +1304,9 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
if (ifp->desc)
vty_out(vty, " Description: %s\n", ifp->desc);
+ if (zebra_if->desc)
+ vty_out(vty, " OS Description: %s\n", zebra_if->desc);
+
if (ifp->ifindex == IFINDEX_INTERNAL) {
vty_out(vty, " pseudo interface\n");
return;
@@ -1696,6 +1700,10 @@ static void if_show_description(struct vty *vty, vrf_id_t vrf_id)
vty_out(vty, "Interface Status Protocol Description\n");
FOR_ALL_INTERFACES (vrf, ifp) {
int len;
+ struct zebra_if *zif;
+ bool intf_desc;
+
+ intf_desc = false;
len = vty_out(vty, "%s", ifp->name);
vty_out(vty, "%*s", (16 - len), " ");
@@ -1715,8 +1723,19 @@ static void if_show_description(struct vty *vty, vrf_id_t vrf_id)
vty_out(vty, "down down ");
}
- if (ifp->desc)
+ if (ifp->desc) {
+ intf_desc = true;
vty_out(vty, "%s", ifp->desc);
+ }
+ zif = ifp->info;
+ if (zif && zif->desc) {
+ vty_out(vty, "%s%s",
+ intf_desc
+ ? "\n "
+ : "",
+ zif->desc);
+ }
+
vty_out(vty, "\n");
}
}
diff --git a/zebra/interface.h b/zebra/interface.h
index ce404e8253..bbb5445cc6 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -342,6 +342,9 @@ struct zebra_if {
bool v6_2_v4_ll_neigh_entry;
char neigh_mac[6];
struct in6_addr v6_2_v4_ll_addr6;
+
+ /* The description of the interface */
+ char *desc;
};
DECLARE_HOOK(zebra_if_extra_info, (struct vty * vty, struct interface *ifp),
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index d1b28227c3..e6671bd87c 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -1706,7 +1706,7 @@ static enum zebra_dplane_result intf_addr_update_internal(
/* Init the interface-addr-specific area */
memset(&ctx->u.intf, 0, sizeof(ctx->u.intf));
- strncpy(ctx->u.intf.ifname, ifp->name, sizeof(ctx->u.intf.ifname));
+ strlcpy(ctx->u.intf.ifname, ifp->name, sizeof(ctx->u.intf.ifname));
ctx->u.intf.ifindex = ifp->ifindex;
ctx->u.intf.prefix = *(ifc->address);
@@ -1734,7 +1734,7 @@ static enum zebra_dplane_result intf_addr_update_internal(
len = strlen(ifc->label);
if (len < sizeof(ctx->u.intf.label_buf)) {
- strncpy(ctx->u.intf.label_buf, ifc->label,
+ strlcpy(ctx->u.intf.label_buf, ifc->label,
sizeof(ctx->u.intf.label_buf));
ctx->u.intf.label = ctx->u.intf.label_buf;
} else {
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 626583a848..2994911165 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -98,6 +98,10 @@ static const struct {
[ZEBRA_ROUTE_BGP_DIRECT_EXT] = {ZEBRA_ROUTE_BGP_DIRECT_EXT, 20, 3},
[ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 100, 2},
[ZEBRA_ROUTE_SHARP] = {ZEBRA_ROUTE_SHARP, 150, 4},
+ [ZEBRA_ROUTE_PBR] = {ZEBRA_ROUTE_PBR, 200, 4},
+ [ZEBRA_ROUTE_BFD] = {ZEBRA_ROUTE_BFD, 255, 4},
+ [ZEBRA_ROUTE_OPENFABRIC] = {ZEBRA_ROUTE_OPENFABRIC, 115, 2},
+ /* Any new route type added to zebra, should be mirrored here */
/* no entry/default: 150 */
};
@@ -3386,9 +3390,32 @@ static int rib_dplane_results(struct dplane_ctx_q *ctxlist)
return 0;
}
+/*
+ * Ensure there are no empty slots in the route_info array.
+ * Every route type in zebra should be present there.
+ */
+static void check_route_info(void)
+{
+ int len = array_size(route_info);
+
+ /*
+ * ZEBRA_ROUTE_SYSTEM is special cased since
+ * its key is 0 anyway.
+ *
+ * ZEBRA_ROUTE_ALL is also ignored.
+ */
+ for (int i = 0; i < len; i++) {
+ if (i == ZEBRA_ROUTE_SYSTEM || i == ZEBRA_ROUTE_ALL)
+ continue;
+ assert(route_info[i].key);
+ }
+}
+
/* Routing information base initialize. */
void rib_init(void)
{
+ check_route_info();
+
rib_queue_init();
/* Init dataplane, and register for results */