summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_vrf.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2021-07-23 16:56:28 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2021-09-21 18:37:30 +0200
commit42d4b30e00131923691ef260ed8b1ff11bf3f33c (patch)
tree2dbd7d0025c49dfe2605f53ad4d89fcf0fe57212 /zebra/zebra_vrf.c
parentMerge pull request #9581 from idryzhov/rpki-source-move (diff)
downloadfrr-42d4b30e00131923691ef260ed8b1ff11bf3f33c.tar.xz
frr-42d4b30e00131923691ef260ed8b1ff11bf3f33c.zip
zebra: extend table manager per vrf, add vty configuration
Because vrf backend may be based on namespaces, each vrf can use in the [16-(2^32-1)] range table identifier for daemons that request it. Extend the table manager to be hosted by vrf. That possibility is disabled in the case the vrf backend is vrflite. In that case, all vrf context use the same table manager instance. Add a configuration command to be able to configure the wished range of tables to use. This is a solution that permits to give chunks to bgp daemon when it works with bgp flowspec entries and wants to use specific iptables that do not override vrf tables. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_vrf.c')
-rw-r--r--zebra/zebra_vrf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 4fbcc6f59..e16234772 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -44,6 +44,7 @@
#ifndef VTYSH_EXTRACT_PL
#include "zebra/zebra_vrf_clippy.c"
#endif
+#include "zebra/table_manager.h"
static void zebra_vrf_table_create(struct zebra_vrf *zvrf, afi_t afi,
safi_t safi);
@@ -113,6 +114,10 @@ static int zebra_vrf_new(struct vrf *vrf)
otable_init(&zvrf->other_tables);
router_id_init(zvrf);
+
+ /* Initiate Table Manager per ZNS */
+ table_manager_enable(zvrf);
+
return 0;
}
@@ -176,6 +181,8 @@ static int zebra_vrf_disable(struct vrf *vrf)
zlog_debug("VRF %s id %u is now inactive", zvrf_name(zvrf),
zvrf_id(zvrf));
+ table_manager_disable(zvrf);
+
/* Stop any VxLAN-EVPN processing. */
zebra_vxlan_vrf_disable(zvrf);
@@ -503,6 +510,12 @@ static int vrf_config_write(struct vty *vty)
if (zvrf->zebra_rnh_ipv6_default_route)
vty_out(vty, "ipv6 nht resolve-via-default\n");
+
+ if (zvrf->tbl_mgr
+ && (zvrf->tbl_mgr->start || zvrf->tbl_mgr->end))
+ vty_out(vty, "ip table range %u %u\n",
+ zvrf->tbl_mgr->start,
+ zvrf->tbl_mgr->end);
} else {
vty_frame(vty, "vrf %s\n", zvrf_name(zvrf));
if (zvrf->l3vni)
@@ -517,6 +530,12 @@ static int vrf_config_write(struct vty *vty)
if (zvrf->zebra_rnh_ipv6_default_route)
vty_out(vty, " ipv6 nht resolve-via-default\n");
+
+ if (zvrf->tbl_mgr && vrf_is_backend_netns()
+ && (zvrf->tbl_mgr->start || zvrf->tbl_mgr->end))
+ vty_out(vty, " ip table range %u %u\n",
+ zvrf->tbl_mgr->start,
+ zvrf->tbl_mgr->end);
}