mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
lib, zebra: Fixup if.c to work in the new regime
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
287a4acf83
commit
2511cb40e6
77
lib/if.c
77
lib/if.c
@ -750,36 +750,37 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id)
|
|||||||
|
|
||||||
DEFUN (interface,
|
DEFUN (interface,
|
||||||
interface_cmd,
|
interface_cmd,
|
||||||
"interface IFNAME",
|
"interface IFNAME" VRF_CMD_STR_OPT,
|
||||||
"Select an interface to configure\n"
|
"Select an interface to configure\n"
|
||||||
"Interface's name\n")
|
"Interface's name\n"
|
||||||
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
size_t sl;
|
size_t sl;
|
||||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||||
|
|
||||||
if ((sl = strlen(argv[0])) > INTERFACE_NAMSIZ)
|
if ((sl = strlen(argv[0]->arg)) > INTERFACE_NAMSIZ)
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% Interface name %s is invalid: length exceeds "
|
vty_out (vty, "%% Interface name %s is invalid: length exceeds "
|
||||||
"%d characters%s",
|
"%d characters%s",
|
||||||
argv[0], INTERFACE_NAMSIZ, VTY_NEWLINE);
|
argv[0]->arg, INTERFACE_NAMSIZ, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Pending: need proper vrf name based lookup/(possible creation of VRF)
|
/*Pending: need proper vrf name based lookup/(possible creation of VRF)
|
||||||
Imagine forward reference of a vrf by name in this interface config */
|
Imagine forward reference of a vrf by name in this interface config */
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
VRF_GET_ID (vrf_id, argv[1]);
|
VRF_GET_ID (vrf_id, argv[1]->arg);
|
||||||
|
|
||||||
#ifdef SUNOS_5
|
#ifdef SUNOS_5
|
||||||
ifp = if_sunwzebra_get (argv[0], sl, vrf_id);
|
ifp = if_sunwzebra_get (argv[0]->arg, sl, vrf_id);
|
||||||
#else
|
#else
|
||||||
ifp = if_get_by_name_len_vrf (argv[0], sl, vrf_id, 1);
|
ifp = if_get_by_name_len_vrf (argv[0]->arg, sl, vrf_id, 1);
|
||||||
#endif /* SUNOS_5 */
|
#endif /* SUNOS_5 */
|
||||||
|
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% interface %s not in %s%s", argv[0], argv[1], VTY_NEWLINE);
|
vty_out (vty, "%% interface %s not in %s%s", argv[0]->arg, argv[1]->arg, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
vty->index = ifp;
|
vty->index = ifp;
|
||||||
@ -788,32 +789,26 @@ DEFUN (interface,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (interface,
|
|
||||||
interface_vrf_cmd,
|
|
||||||
"interface IFNAME " VRF_CMD_STR,
|
|
||||||
"Select an interface to configure\n"
|
|
||||||
"Interface's name\n"
|
|
||||||
VRF_CMD_HELP_STR)
|
|
||||||
|
|
||||||
DEFUN_NOSH (no_interface,
|
DEFUN_NOSH (no_interface,
|
||||||
no_interface_cmd,
|
no_interface_cmd,
|
||||||
"no interface IFNAME",
|
"no interface IFNAME" VRF_CMD_STR_OPT,
|
||||||
NO_STR
|
NO_STR
|
||||||
"Delete a pseudo interface's configuration\n"
|
"Delete a pseudo interface's configuration\n"
|
||||||
"Interface's name\n")
|
"Interface's name\n"
|
||||||
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
// deleting interface
|
// deleting interface
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
VRF_GET_ID (vrf_id, argv[1]);
|
VRF_GET_ID (vrf_id, argv[1]->arg);
|
||||||
|
|
||||||
ifp = if_lookup_by_name_vrf (argv[0], vrf_id);
|
ifp = if_lookup_by_name_vrf (argv[0]->arg, vrf_id);
|
||||||
|
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% Interface %s does not exist%s", argv[0], VTY_NEWLINE);
|
vty_out (vty, "%% Interface %s does not exist%s", argv[0]->arg, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,32 +824,23 @@ DEFUN_NOSH (no_interface,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (no_interface,
|
|
||||||
no_interface_vrf_cmd,
|
|
||||||
"no interface IFNAME " VRF_CMD_STR,
|
|
||||||
NO_STR
|
|
||||||
"Delete a pseudo interface's configuration\n"
|
|
||||||
"Interface's name\n"
|
|
||||||
VRF_CMD_HELP_STR)
|
|
||||||
|
|
||||||
DEFUN (vrf,
|
DEFUN (vrf,
|
||||||
vrf_cmd,
|
vrf_cmd,
|
||||||
"vrf NAME",
|
VRF_CMD_STR,
|
||||||
"Select a VRF to configure\n"
|
VRF_CMD_HELP_STR)
|
||||||
"VRF's name\n")
|
|
||||||
{
|
{
|
||||||
struct vrf *vrfp;
|
struct vrf *vrfp;
|
||||||
size_t sl;
|
size_t sl;
|
||||||
|
|
||||||
if ((sl = strlen(argv[0])) > VRF_NAMSIZ)
|
if ((sl = strlen(argv[0]->arg)) > VRF_NAMSIZ)
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% VRF name %s is invalid: length exceeds "
|
vty_out (vty, "%% VRF name %s is invalid: length exceeds "
|
||||||
"%d characters%s",
|
"%d characters%s",
|
||||||
argv[0], VRF_NAMSIZ, VTY_NEWLINE);
|
argv[0]->arg, VRF_NAMSIZ, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
vrfp = vrf_get (VRF_UNKNOWN, argv[0]);
|
vrfp = vrf_get (VRF_UNKNOWN, argv[0]->arg);
|
||||||
|
|
||||||
vty->index = vrfp;
|
vty->index = vrfp;
|
||||||
vty->node = VRF_NODE;
|
vty->node = VRF_NODE;
|
||||||
@ -864,18 +850,17 @@ DEFUN (vrf,
|
|||||||
|
|
||||||
DEFUN_NOSH (no_vrf,
|
DEFUN_NOSH (no_vrf,
|
||||||
no_vrf_cmd,
|
no_vrf_cmd,
|
||||||
"no vrf NAME",
|
"no " VRF_CMD_STR,
|
||||||
NO_STR
|
NO_STR
|
||||||
"Delete a pseudo VRF's configuration\n"
|
VRF_CMD_HELP_STR)
|
||||||
"VRF's name\n")
|
|
||||||
{
|
{
|
||||||
struct vrf *vrfp;
|
struct vrf *vrfp;
|
||||||
|
|
||||||
vrfp = vrf_list_lookup_by_name (argv[0]);
|
vrfp = vrf_list_lookup_by_name (argv[0]->arg);
|
||||||
|
|
||||||
if (vrfp == NULL)
|
if (vrfp == NULL)
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% VRF %s does not exist%s", argv[0], VTY_NEWLINE);
|
vty_out (vty, "%% VRF %s does not exist%s", argv[0]->arg, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,9 +880,10 @@ DEFUN_NOSH (no_vrf,
|
|||||||
/* For debug purpose. */
|
/* For debug purpose. */
|
||||||
DEFUN (show_address,
|
DEFUN (show_address,
|
||||||
show_address_cmd,
|
show_address_cmd,
|
||||||
"show address",
|
"show address" VRF_CMD_STR_OPT,
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
"address\n")
|
"address\n"
|
||||||
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
struct listnode *node2;
|
struct listnode *node2;
|
||||||
@ -907,7 +893,7 @@ DEFUN (show_address,
|
|||||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||||
|
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
VRF_GET_ID (vrf_id, argv[0]);
|
VRF_GET_ID (vrf_id, argv[0]->arg);
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp))
|
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp))
|
||||||
{
|
{
|
||||||
@ -923,13 +909,6 @@ DEFUN (show_address,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (show_address,
|
|
||||||
show_address_vrf_cmd,
|
|
||||||
"show address " VRF_CMD_STR,
|
|
||||||
SHOW_STR
|
|
||||||
"address\n"
|
|
||||||
VRF_CMD_HELP_STR)
|
|
||||||
|
|
||||||
DEFUN (show_address_vrf_all,
|
DEFUN (show_address_vrf_all,
|
||||||
show_address_vrf_all_cmd,
|
show_address_vrf_all_cmd,
|
||||||
"show address " VRF_ALL_CMD_STR,
|
"show address " VRF_ALL_CMD_STR,
|
||||||
|
3
lib/if.h
3
lib/if.h
@ -491,12 +491,9 @@ extern struct cmd_element interface_desc_cmd;
|
|||||||
extern struct cmd_element no_interface_desc_cmd;
|
extern struct cmd_element no_interface_desc_cmd;
|
||||||
extern struct cmd_element interface_cmd;
|
extern struct cmd_element interface_cmd;
|
||||||
extern struct cmd_element no_interface_cmd;
|
extern struct cmd_element no_interface_cmd;
|
||||||
extern struct cmd_element interface_vrf_cmd;
|
|
||||||
extern struct cmd_element no_interface_vrf_cmd;
|
|
||||||
extern struct cmd_element interface_pseudo_cmd;
|
extern struct cmd_element interface_pseudo_cmd;
|
||||||
extern struct cmd_element no_interface_pseudo_cmd;
|
extern struct cmd_element no_interface_pseudo_cmd;
|
||||||
extern struct cmd_element show_address_cmd;
|
extern struct cmd_element show_address_cmd;
|
||||||
extern struct cmd_element show_address_vrf_cmd;
|
|
||||||
extern struct cmd_element show_address_vrf_all_cmd;
|
extern struct cmd_element show_address_vrf_all_cmd;
|
||||||
extern struct cmd_element vrf_cmd;
|
extern struct cmd_element vrf_cmd;
|
||||||
extern struct cmd_element no_vrf_cmd;
|
extern struct cmd_element no_vrf_cmd;
|
||||||
|
@ -50,7 +50,7 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* The command strings
|
* The command strings
|
||||||
*/
|
*/
|
||||||
|
#define VRF_CMD_STR_OPT "[vrf NAME]"
|
||||||
#define VRF_CMD_STR "vrf NAME"
|
#define VRF_CMD_STR "vrf NAME"
|
||||||
#define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n"
|
#define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n"
|
||||||
|
|
||||||
|
@ -2960,7 +2960,6 @@ zebra_if_init (void)
|
|||||||
install_element (CONFIG_NODE, &zebra_interface_cmd);
|
install_element (CONFIG_NODE, &zebra_interface_cmd);
|
||||||
install_element (CONFIG_NODE, &zebra_interface_vrf_cmd);
|
install_element (CONFIG_NODE, &zebra_interface_vrf_cmd);
|
||||||
install_element (CONFIG_NODE, &no_interface_cmd);
|
install_element (CONFIG_NODE, &no_interface_cmd);
|
||||||
install_element (CONFIG_NODE, &no_interface_vrf_cmd);
|
|
||||||
install_default (INTERFACE_NODE);
|
install_default (INTERFACE_NODE);
|
||||||
install_element (INTERFACE_NODE, &interface_desc_cmd);
|
install_element (INTERFACE_NODE, &interface_desc_cmd);
|
||||||
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
|
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user