diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/if.c | 54 | ||||
| -rw-r--r-- | lib/ns.c | 16 | ||||
| -rw-r--r-- | lib/ns.h | 16 | ||||
| -rw-r--r-- | lib/vrf.c | 54 |
4 files changed, 70 insertions, 70 deletions
@@ -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, @@ -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 { @@ -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 */ @@ -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 */ |
