summaryrefslogtreecommitdiff
path: root/zebra/zebra_vrf.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-27 13:11:08 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-28 23:28:40 +0200
commitd6bd4fca97966f0ec52aaa8fef2f01475e8214b0 (patch)
treef10746d9984aa8c5575d30c30a149a46a8376f7f /zebra/zebra_vrf.c
parent86855aed7824d89cfe9829a7ee9ab604ac15d02f (diff)
zebra: make vrf netns commands do nothing
These commands don't really provide any functionality. VRF is associated with netns automatically based on its name, and it's not possible to associate VRF and netns with different names with these commands: - When trying to assosiate a VRF with an already existing netns with a different name: `NS /run/netns/test is already configured with VRF 1(test)` - When trying to assiciate a VRF with a non-existing netns, so they become linked once the netns is created: `Invalid pathname for /run/netns/test: No such file or directory` - When doing "no netns" to unlink the netns and link it back to the same VRF: `VRF 1 is already configured with VRF test` - When doing "no netns" to unlink the netns and link it to another VRF: `Can not associate NS 4294967295 with NETNS /run/netns/test` As shown above, not a single usecase is working. We can't remove them completely to preserve backwards-compatibility, so just make them empty. The main reason for this change is not to spend a lot of time trying to figure out how to convert them to northbound. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'zebra/zebra_vrf.c')
-rw-r--r--zebra/zebra_vrf.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 92982f25c8..8a8b42b65f 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -536,20 +536,7 @@ DEFPY (vrf_netns,
"Attach VRF to a Namespace\n"
"The file name in " NS_RUN_DIR ", or a full pathname\n")
{
- char *pathname = ns_netns_pathname(vty, netns_name);
- int ret;
-
- VTY_DECLVAR_CONTEXT(vrf, vrf);
-
- if (!pathname)
- return CMD_WARNING_CONFIG_FAILED;
-
- frr_with_privs(&zserv_privs) {
- ret = zebra_vrf_netns_handler_create(
- vty, vrf, pathname, NS_UNKNOWN, NS_UNKNOWN, NS_UNKNOWN);
- }
-
- return ret;
+ return CMD_SUCCESS;
}
DEFUN (no_vrf_netns,
@@ -559,29 +546,6 @@ DEFUN (no_vrf_netns,
"Detach VRF from a Namespace\n"
"The file name in " NS_RUN_DIR ", or a full pathname\n")
{
- struct ns *ns = NULL;
-
- VTY_DECLVAR_CONTEXT(vrf, vrf);
-
- if (!vrf_is_backend_netns()) {
- vty_out(vty, "VRF backend is not Netns. Aborting\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
- if (!vrf->ns_ctxt) {
- vty_out(vty, "VRF %s(%u) is not configured with NetNS\n",
- vrf->name, vrf->vrf_id);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- ns = (struct ns *)vrf->ns_ctxt;
-
- ns->vrf_ctxt = NULL;
- vrf_disable(vrf);
- /* vrf ID from VRF is necessary for Zebra
- * so that propagate to other clients is done
- */
- ns_delete(ns);
- vrf->ns_ctxt = NULL;
return CMD_SUCCESS;
}