#include "vty.h"
#include "zebra/zebra_router.h"
+#include "zebra/rtadv.h"
#include "zebra/debug.h"
#include "zebra/zapi_msg.h"
#include "zebra/rib.h"
static void zebra_rnhtable_node_cleanup(struct route_table *table,
struct route_node *node);
-DEFINE_MTYPE_STATIC(ZEBRA, OTHER_TABLE, "Other Table");
+DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_VRF, "ZEBRA VRF")
+DEFINE_MTYPE_STATIC(ZEBRA, OTHER_TABLE, "Other Table")
/* VRF information update. */
static void zebra_vrf_add_update(struct zebra_vrf *zvrf)
struct zebra_vrf *zvrf;
if (IS_ZEBRA_DEBUG_EVENT)
- zlog_info("VRF %s created, id %u", vrf->name, vrf->vrf_id);
+ zlog_debug("VRF %s created, id %u", vrf->name, vrf->vrf_id);
zvrf = zebra_vrf_alloc();
vrf->info = zvrf;
zvrf->zns = zebra_ns_lookup((ns_id_t)vrf->vrf_id);
else
zvrf->zns = zebra_ns_lookup(NS_DEFAULT);
+#if defined(HAVE_RTADV)
+ rtadv_init(zvrf);
+#endif
+
/* Inform clients that the VRF is now active. This is an
* add for the clients.
*/
/* Stop any VxLAN-EVPN processing. */
zebra_vxlan_vrf_disable(zvrf);
+#if defined(HAVE_RTADV)
+ rtadv_terminate(zvrf);
+#endif
+
/* Inform clients that the VRF is now inactive. This is a
* delete for the clients.
*/
* - case VRF backend is default : on default VRF only
* - case VRF backend is netns : on all VRFs
*/
-struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi,
- vrf_id_t vrf_id,
- uint32_t table_id)
+struct route_table *zebra_vrf_lookup_table_with_table_id(afi_t afi, safi_t safi,
+ vrf_id_t vrf_id,
+ uint32_t table_id)
{
struct zebra_vrf *zvrf = vrf_info_lookup(vrf_id);
struct other_route_table ort, *otable;
- struct route_table *table;
if (!zvrf)
return NULL;
ort.safi = safi;
ort.table_id = table_id;
otable = otable_find(&zvrf->other_tables, &ort);
+
if (otable)
return otable->table;
+ return NULL;
+}
+
+struct route_table *zebra_vrf_get_table_with_table_id(afi_t afi, safi_t safi,
+ vrf_id_t vrf_id,
+ uint32_t table_id)
+{
+ struct zebra_vrf *zvrf = vrf_info_lookup(vrf_id);
+ struct other_route_table *otable;
+ struct route_table *table;
+
+ table = zebra_vrf_lookup_table_with_table_id(afi, safi, vrf_id,
+ table_id);
+
+ if (table)
+ goto done;
+
+ /* Create it as an `other` table */
table = zebra_router_get_table(zvrf, table_id, afi, safi);
otable = XCALLOC(MTYPE_OTHER_TABLE, sizeof(*otable));
otable->table = table;
otable_add(&zvrf->other_tables, otable);
+done:
return table;
}
if (zvrf_id(zvrf) == VRF_DEFAULT) {
if (zvrf->l3vni)
- vty_out(vty, "vni %u\n", zvrf->l3vni);
+ vty_out(vty, "vni %u%s\n", zvrf->l3vni,
+ is_l3vni_for_prefix_routes_only(
+ zvrf->l3vni)
+ ? " prefix-routes-only"
+ : "");
+ if (zvrf->zebra_rnh_ip_default_route)
+ vty_out(vty, "ip nht resolve-via-default\n");
+
+ if (zvrf->zebra_rnh_ipv6_default_route)
+ vty_out(vty, "ipv6 nht resolve-via-default\n");
} else {
vty_frame(vty, "vrf %s\n", zvrf_name(zvrf));
if (zvrf->l3vni)
? " prefix-routes-only"
: "");
zebra_ns_config_write(vty, (struct ns *)vrf->ns_ctxt);
+ if (zvrf->zebra_rnh_ip_default_route)
+ vty_out(vty, " ip nht resolve-via-default\n");
+
+ if (zvrf->zebra_rnh_ipv6_default_route)
+ vty_out(vty, " ipv6 nht resolve-via-default\n");
}
+
zebra_routemap_config_write_protocol(vty, zvrf);
if (zvrf_id(zvrf) != VRF_DEFAULT)