summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c54
-rw-r--r--lib/ns.c16
-rw-r--r--lib/ns.h16
-rw-r--r--lib/vrf.c54
4 files changed, 70 insertions, 70 deletions
diff --git a/lib/if.c b/lib/if.c
index 6ae8500291..70304e584c 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -840,60 +840,6 @@ ALIAS (no_interface,
"Interface's name\n"
VRF_CMD_HELP_STR)
-DEFUN (vrf,
- vrf_cmd,
- "vrf NAME",
- "Select a VRF to configure\n"
- "VRF's name\n")
-{
- struct vrf *vrfp;
- size_t sl;
-
- if ((sl = strlen(argv[0])) > VRF_NAMSIZ)
- {
- vty_out (vty, "%% VRF name %s is invalid: length exceeds "
- "%d characters%s",
- argv[0], VRF_NAMSIZ, VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- vrfp = vrf_get (VRF_UNKNOWN, argv[0]);
-
- VTY_PUSH_CONTEXT_COMPAT (VRF_NODE, vrfp);
-
- return CMD_SUCCESS;
-}
-
-DEFUN_NOSH (no_vrf,
- no_vrf_cmd,
- "no vrf NAME",
- NO_STR
- "Delete a pseudo VRF's configuration\n"
- "VRF's name\n")
-{
- struct vrf *vrfp;
-
- vrfp = vrf_list_lookup_by_name (argv[0]);
-
- if (vrfp == NULL)
- {
- vty_out (vty, "%% VRF %s does not exist%s", argv[0], VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- if (CHECK_FLAG (vrfp->status, VRF_ACTIVE))
- {
- vty_out (vty, "%% Only inactive VRFs can be deleted%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- vrf_delete(vrfp);
-
- return CMD_SUCCESS;
-}
-
-
/* For debug purpose. */
DEFUN (show_address,
show_address_cmd,
diff --git a/lib/ns.c b/lib/ns.c
index 07e6ec5b9a..904fc6999c 100644
--- a/lib/ns.c
+++ b/lib/ns.c
@@ -91,22 +91,6 @@ static int have_netns(void)
#endif
}
-struct ns
-{
- /* Identifier, same as the vector index */
- ns_id_t ns_id;
- /* Name */
- char *name;
- /* File descriptor */
- int fd;
-
- /* Master list of interfaces belonging to this NS */
- struct list *iflist;
-
- /* User data */
- void *info;
-};
-
/* Holding NS hooks */
struct ns_master
{
diff --git a/lib/ns.h b/lib/ns.h
index c96f1b2743..74616cd62f 100644
--- a/lib/ns.h
+++ b/lib/ns.h
@@ -33,6 +33,22 @@ typedef u_int16_t ns_id_t;
/* Default netns directory (Linux) */
#define NS_RUN_DIR "/var/run/netns"
+struct ns
+{
+ /* Identifier, same as the vector index */
+ ns_id_t ns_id;
+ /* Name */
+ char *name;
+ /* File descriptor */
+ int fd;
+
+ /* Master list of interfaces belonging to this NS */
+ struct list *iflist;
+
+ /* User data */
+ void *info;
+};
+
/*
* NS hooks
*/
diff --git a/lib/vrf.c b/lib/vrf.c
index 63adea4aec..d87e38ebe8 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -740,6 +740,60 @@ vrf_socket (int domain, int type, int protocol, vrf_id_t vrf_id)
return ret;
}
+/* vrf CLI commands */
+DEFUN (vrf,
+ vrf_cmd,
+ "vrf NAME",
+ "Select a VRF to configure\n"
+ "VRF's name\n")
+{
+ struct vrf *vrfp;
+ size_t sl;
+
+ if ((sl = strlen(argv[0])) > VRF_NAMSIZ)
+ {
+ vty_out (vty, "%% VRF name %s is invalid: length exceeds "
+ "%d characters%s",
+ argv[0], VRF_NAMSIZ, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ vrfp = vrf_get (VRF_UNKNOWN, argv[0]);
+
+ VTY_PUSH_CONTEXT_COMPAT (VRF_NODE, vrfp);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN_NOSH (no_vrf,
+ no_vrf_cmd,
+ "no vrf NAME",
+ NO_STR
+ "Delete a pseudo VRF's configuration\n"
+ "VRF's name\n")
+{
+ struct vrf *vrfp;
+
+ vrfp = vrf_list_lookup_by_name (argv[0]);
+
+ if (vrfp == NULL)
+ {
+ vty_out (vty, "%% VRF %s does not exist%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (CHECK_FLAG (vrfp->status, VRF_ACTIVE))
+ {
+ vty_out (vty, "%% Only inactive VRFs can be deleted%s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ vrf_delete(vrfp);
+
+ return CMD_SUCCESS;
+}
+
/*
* Debug CLI for vrf's
*/