]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: make vrf netns commands do nothing
authorIgor Ryzhov <iryzhov@nfware.com>
Sat, 27 Jan 2024 11:11:08 +0000 (13:11 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Sun, 28 Jan 2024 21:28:40 +0000 (23:28 +0200)
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>
zebra/zebra_vrf.c

index 92982f25c8d5175e124e23782e20ce791bc64887..8a8b42b65f1e4cd5b945a08d37fdd5e62cc48c08 100644 (file)
@@ -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;
 }