mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-03 19:51:09 +00:00
Vtysh cleanup part 2. No any functional changes yet except VTYSH_INTERFACE.
This commit is contained in:
parent
c89f64948d
commit
95e735b544
@ -1,3 +1,14 @@
|
|||||||
|
2004-08-26 Hasso Tepper <hasso@estpak.ee>
|
||||||
|
|
||||||
|
* *.c: Cosmetical changes - strip long lines, fix multiline comments
|
||||||
|
style, indentation fixes, remove useless comments.
|
||||||
|
* vtysh.h: define VTYSH_INTERFACE.
|
||||||
|
* vtysh.c: Use VTYSH_INTERFACE where possible. Added some related TODO
|
||||||
|
items.
|
||||||
|
* vtysh.c: Move things around a little to reduce spaghetti mess.
|
||||||
|
* Makefile.am: Parse only needed files from zebra daemon while
|
||||||
|
building vtysh_cmd.c file to supress warnings.
|
||||||
|
|
||||||
2004-06-30 Greg Troxel <gdt@poblano.ir.bbn.com>
|
2004-06-30 Greg Troxel <gdt@poblano.ir.bbn.com>
|
||||||
|
|
||||||
* extract.pl.in: Rename from extract.pl, with @PERL@.
|
* extract.pl.in: Rename from extract.pl, with @PERL@.
|
||||||
|
@ -21,11 +21,16 @@ EXTRA_DIST = extract.pl
|
|||||||
rebuild4:
|
rebuild4:
|
||||||
./extract.pl $(top_srcdir)/zebra/*.c $(top_srcdir)/ripd/*.c $(top_srcdir)/ospfd/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/isisd/*.c $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c $(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c > vtysh_cmd.c
|
./extract.pl $(top_srcdir)/zebra/*.c $(top_srcdir)/ripd/*.c $(top_srcdir)/ospfd/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/isisd/*.c $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c $(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c > vtysh_cmd.c
|
||||||
|
|
||||||
vtysh_cmd.c: $(top_srcdir)/zebra/*.c $(top_srcdir)/ripd/*.c $(top_srcdir)/ripngd/*.c $(top_srcdir)/ospfd/*.c \
|
vtysh_cmd.c: $(top_srcdir)/ripd/*.c $(top_srcdir)/ripngd/*.c $(top_srcdir)/ospfd/*.c $(top_srcdir)/ospf6d/*.c \
|
||||||
$(top_srcdir)/ospf6d/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/isisd/*.c $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c \
|
$(top_srcdir)/isisd/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c \
|
||||||
$(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c
|
$(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c \
|
||||||
$(srcdir)/extract.pl $(top_srcdir)/zebra/*.c $(top_srcdir)/ripd/*.c $(top_srcdir)/ripngd/*.c $(top_srcdir)/ospfd/*.c \
|
$(top_srcdir)/zebra/debug.c $(top_srcdir)/zebra/interface.c $(top_srcdir)/zebra/irdp.c \
|
||||||
$(top_srcdir)/ospf6d/*.c $(top_srcdir)/isisd/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/lib/keychain.c \
|
$(top_srcdir)/zebra/irdp_interface.c $(top_srcdir)/zebra/rtadv.c $(top_srcdir)/zebra/zebra_vty.c \
|
||||||
$(top_srcdir)/lib/routemap.c $(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c \
|
$(top_srcdir)/zebra/zserv.c
|
||||||
$(top_srcdir)/lib/if_rmap.c > vtysh_cmd.c
|
$(srcdir)/extract.pl $(top_srcdir)/ripd/*.c $(top_srcdir)/ripngd/*.c $(top_srcdir)/ospfd/*.c $(top_srcdir)/ospf6d/*.c \
|
||||||
|
$(top_srcdir)/isisd/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c \
|
||||||
|
$(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c \
|
||||||
|
$(top_srcdir)/zebra/debug.c $(top_srcdir)/zebra/interface.c $(top_srcdir)/zebra/irdp.c \
|
||||||
|
$(top_srcdir)/zebra/irdp_interface.c $(top_srcdir)/zebra/rtadv.c $(top_srcdir)/zebra/zebra_vty.c \
|
||||||
|
$(top_srcdir)/zebra/zserv.c > vtysh_cmd.c
|
||||||
|
|
||||||
|
504
vtysh/vtysh.c
504
vtysh/vtysh.c
@ -46,139 +46,6 @@ struct vtysh_client
|
|||||||
int fd;
|
int fd;
|
||||||
} vtysh_client[VTYSH_INDEX_MAX];
|
} vtysh_client[VTYSH_INDEX_MAX];
|
||||||
|
|
||||||
/* When '^Z' is received from vty, move down to the enable mode. */
|
|
||||||
int
|
|
||||||
vtysh_end ()
|
|
||||||
{
|
|
||||||
switch (vty->node)
|
|
||||||
{
|
|
||||||
case VIEW_NODE:
|
|
||||||
case ENABLE_NODE:
|
|
||||||
/* Nothing to do. */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
vty->node = ENABLE_NODE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
vtysh_end_all,
|
|
||||||
vtysh_end_all_cmd,
|
|
||||||
"end",
|
|
||||||
"End current mode and down to previous mode\n")
|
|
||||||
{
|
|
||||||
return vtysh_end (vty);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
vtysh_log_stdout,
|
|
||||||
vtysh_log_stdout_cmd,
|
|
||||||
"log stdout",
|
|
||||||
"Logging control\n"
|
|
||||||
"Logging goes to stdout\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
no_vtysh_log_stdout,
|
|
||||||
no_vtysh_log_stdout_cmd,
|
|
||||||
"no log stdout",
|
|
||||||
NO_STR
|
|
||||||
"Logging control\n"
|
|
||||||
"Logging goes to stdout\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
vtysh_log_file,
|
|
||||||
vtysh_log_file_cmd,
|
|
||||||
"log file FILENAME",
|
|
||||||
"Logging control\n"
|
|
||||||
"Logging to file\n"
|
|
||||||
"Logging filename\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
no_vtysh_log_file,
|
|
||||||
no_vtysh_log_file_cmd,
|
|
||||||
"no log file [FILENAME]",
|
|
||||||
NO_STR
|
|
||||||
"Logging control\n"
|
|
||||||
"Cancel logging to file\n"
|
|
||||||
"Logging file name\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
vtysh_log_syslog,
|
|
||||||
vtysh_log_syslog_cmd,
|
|
||||||
"log syslog",
|
|
||||||
"Logging control\n"
|
|
||||||
"Logging goes to syslog\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
no_vtysh_log_syslog,
|
|
||||||
no_vtysh_log_syslog_cmd,
|
|
||||||
"no log syslog",
|
|
||||||
NO_STR
|
|
||||||
"Logging control\n"
|
|
||||||
"Cancel logging to syslog\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
vtysh_log_trap,
|
|
||||||
vtysh_log_trap_cmd,
|
|
||||||
"log trap (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)",
|
|
||||||
"Logging control\n"
|
|
||||||
"Limit logging to specifed level\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
no_vtysh_log_trap,
|
|
||||||
no_vtysh_log_trap_cmd,
|
|
||||||
"no log trap",
|
|
||||||
NO_STR
|
|
||||||
"Logging control\n"
|
|
||||||
"Permit all logging information\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
vtysh_log_record_priority,
|
|
||||||
vtysh_log_record_priority_cmd,
|
|
||||||
"log record-priority",
|
|
||||||
"Logging control\n"
|
|
||||||
"Log the priority of the message within the message\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
|
||||||
no_vtysh_log_record_priority,
|
|
||||||
no_vtysh_log_record_priority_cmd,
|
|
||||||
"no log record-priority",
|
|
||||||
NO_STR
|
|
||||||
"Logging control\n"
|
|
||||||
"Do not log the priority of the message within the message\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vclient_close (struct vtysh_client *vclient)
|
vclient_close (struct vtysh_client *vclient)
|
||||||
{
|
{
|
||||||
@ -187,10 +54,8 @@ vclient_close (struct vtysh_client *vclient)
|
|||||||
vclient->fd = -1;
|
vclient->fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Following filled with debug code to trace a problematic condition
|
/* Following filled with debug code to trace a problematic condition
|
||||||
under load - it SHOULD handle it.
|
* under load - it SHOULD handle it. */
|
||||||
*/
|
|
||||||
#define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
|
#define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
|
||||||
int
|
int
|
||||||
vtysh_client_config (struct vtysh_client *vclient, char *line)
|
vtysh_client_config (struct vtysh_client *vclient, char *line)
|
||||||
@ -215,8 +80,7 @@ vtysh_client_config (struct vtysh_client *vclient, char *line)
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow enough room for buffer to read more than a few pages from socket
|
/* Allow enough room for buffer to read more than a few pages from socket. */
|
||||||
*/
|
|
||||||
bufsz = 5 * getpagesize() + 1;
|
bufsz = 5 * getpagesize() + 1;
|
||||||
buf = XMALLOC(MTYPE_TMP, bufsz);
|
buf = XMALLOC(MTYPE_TMP, bufsz);
|
||||||
memset(buf, 0, bufsz);
|
memset(buf, 0, bufsz);
|
||||||
@ -265,7 +129,7 @@ vtysh_client_config (struct vtysh_client *vclient, char *line)
|
|||||||
pbuf += nbytes;
|
pbuf += nbytes;
|
||||||
|
|
||||||
/* See if a line exists in buffer, if so parse and consume it, and
|
/* See if a line exists in buffer, if so parse and consume it, and
|
||||||
reset read position */
|
* reset read position. */
|
||||||
if ((eoln = strrchr(buf, '\n')) == NULL)
|
if ((eoln = strrchr(buf, '\n')) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -283,7 +147,7 @@ vtysh_client_config (struct vtysh_client *vclient, char *line)
|
|||||||
pbuf = buf + strlen(buf);
|
pbuf = buf + strlen(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse anything left in the buffer */
|
/* Parse anything left in the buffer. */
|
||||||
vtysh_config_parse (buf);
|
vtysh_config_parse (buf);
|
||||||
|
|
||||||
XFREE(MTYPE_TMP, buf);
|
XFREE(MTYPE_TMP, buf);
|
||||||
@ -363,7 +227,7 @@ vtysh_execute_func (char *line, int pager)
|
|||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
int closepager=0;
|
int closepager=0;
|
||||||
|
|
||||||
/* Split readline string up into the vector */
|
/* Split readline string up into the vector. */
|
||||||
vline = cmd_make_strvec (line);
|
vline = cmd_make_strvec (line);
|
||||||
|
|
||||||
if (vline == NULL)
|
if (vline == NULL)
|
||||||
@ -412,17 +276,20 @@ vtysh_execute_func (char *line, int pager)
|
|||||||
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP],
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIP],
|
||||||
line, fp);
|
line, fp);
|
||||||
if (cmd_stat != CMD_WARNING)
|
if (cmd_stat != CMD_WARNING)
|
||||||
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIPNG], line, fp);
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_RIPNG],
|
||||||
|
line, fp);
|
||||||
if (cmd_stat != CMD_WARNING)
|
if (cmd_stat != CMD_WARNING)
|
||||||
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF],
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF],
|
||||||
line, fp);
|
line, fp);
|
||||||
if (cmd_stat != CMD_WARNING)
|
if (cmd_stat != CMD_WARNING)
|
||||||
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF6], line, fp);
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_OSPF6],
|
||||||
|
line, fp);
|
||||||
if (cmd_stat != CMD_WARNING)
|
if (cmd_stat != CMD_WARNING)
|
||||||
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_BGP],
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_BGP],
|
||||||
line, fp);
|
line, fp);
|
||||||
if (cmd_stat != CMD_WARNING)
|
if (cmd_stat != CMD_WARNING)
|
||||||
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ISIS], line, fp);
|
cmd_stat = vtysh_client_execute (&vtysh_client[VTYSH_INDEX_ISIS],
|
||||||
|
line, fp);
|
||||||
if (cmd_stat)
|
if (cmd_stat)
|
||||||
{
|
{
|
||||||
line = "end";
|
line = "end";
|
||||||
@ -523,14 +390,14 @@ vtysh_config_from_file (struct vty *vty, FILE *fp)
|
|||||||
|
|
||||||
vline = cmd_make_strvec (vty->buf);
|
vline = cmd_make_strvec (vty->buf);
|
||||||
|
|
||||||
/* In case of comment line */
|
/* In case of comment line. */
|
||||||
if (vline == NULL)
|
if (vline == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Execute configuration command : this is strict match */
|
/* Execute configuration command : this is strict match. */
|
||||||
ret = cmd_execute_command_strict (vline, vty, &cmd);
|
ret = cmd_execute_command_strict (vline, vty, &cmd);
|
||||||
|
|
||||||
/* Try again with setting node to CONFIG_NODE */
|
/* Try again with setting node to CONFIG_NODE. */
|
||||||
if (ret != CMD_SUCCESS
|
if (ret != CMD_SUCCESS
|
||||||
&& ret != CMD_SUCCESS_DAEMON
|
&& ret != CMD_SUCCESS_DAEMON
|
||||||
&& ret != CMD_WARNING)
|
&& ret != CMD_WARNING)
|
||||||
@ -700,9 +567,9 @@ vtysh_rl_describe ()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* result of cmd_complete_command() call will be stored here
|
/* Result of cmd_complete_command() call will be stored here
|
||||||
and used in new_completion() in order to put the space in
|
* and used in new_completion() in order to put the space in
|
||||||
correct places only */
|
* correct places only. */
|
||||||
int complete_status;
|
int complete_status;
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@ -778,26 +645,23 @@ vtysh_completion (char *text, int start, int end)
|
|||||||
return (char **) matched;
|
return (char **) matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BGP node structure. */
|
/* Vty node structures. */
|
||||||
struct cmd_node bgp_node =
|
struct cmd_node bgp_node =
|
||||||
{
|
{
|
||||||
BGP_NODE,
|
BGP_NODE,
|
||||||
"%s(config-router)# ",
|
"%s(config-router)# ",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* BGP node structure. */
|
|
||||||
struct cmd_node rip_node =
|
struct cmd_node rip_node =
|
||||||
{
|
{
|
||||||
RIP_NODE,
|
RIP_NODE,
|
||||||
"%s(config-router)# ",
|
"%s(config-router)# ",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ISIS node structure. */
|
|
||||||
struct cmd_node isis_node =
|
struct cmd_node isis_node =
|
||||||
{
|
{
|
||||||
ISIS_NODE,
|
ISIS_NODE,
|
||||||
"%s(config-router)# ",
|
"%s(config-router)# ",
|
||||||
1
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_node interface_node =
|
struct cmd_node interface_node =
|
||||||
@ -806,6 +670,98 @@ struct cmd_node interface_node =
|
|||||||
"%s(config-if)# ",
|
"%s(config-if)# ",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct cmd_node rmap_node =
|
||||||
|
{
|
||||||
|
RMAP_NODE,
|
||||||
|
"%s(config-route-map)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node zebra_node =
|
||||||
|
{
|
||||||
|
ZEBRA_NODE,
|
||||||
|
"%s(config-router)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node bgp_vpnv4_node =
|
||||||
|
{
|
||||||
|
BGP_VPNV4_NODE,
|
||||||
|
"%s(config-router-af)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node bgp_ipv4_node =
|
||||||
|
{
|
||||||
|
BGP_IPV4_NODE,
|
||||||
|
"%s(config-router-af)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node bgp_ipv4m_node =
|
||||||
|
{
|
||||||
|
BGP_IPV4M_NODE,
|
||||||
|
"%s(config-router-af)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node bgp_ipv6_node =
|
||||||
|
{
|
||||||
|
BGP_IPV6_NODE,
|
||||||
|
"%s(config-router-af)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node ospf_node =
|
||||||
|
{
|
||||||
|
OSPF_NODE,
|
||||||
|
"%s(config-router)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node ripng_node =
|
||||||
|
{
|
||||||
|
RIPNG_NODE,
|
||||||
|
"%s(config-router)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node ospf6_node =
|
||||||
|
{
|
||||||
|
OSPF6_NODE,
|
||||||
|
"%s(config-ospf6)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node keychain_node =
|
||||||
|
{
|
||||||
|
KEYCHAIN_NODE,
|
||||||
|
"%s(config-keychain)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmd_node keychain_key_node =
|
||||||
|
{
|
||||||
|
KEYCHAIN_KEY_NODE,
|
||||||
|
"%s(config-keychain-key)# "
|
||||||
|
};
|
||||||
|
|
||||||
|
/* When '^Z' is received from vty, move down to the enable mode. */
|
||||||
|
int
|
||||||
|
vtysh_end ()
|
||||||
|
{
|
||||||
|
switch (vty->node)
|
||||||
|
{
|
||||||
|
case VIEW_NODE:
|
||||||
|
case ENABLE_NODE:
|
||||||
|
/* Nothing to do. */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
vty->node = ENABLE_NODE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
vtysh_end_all,
|
||||||
|
vtysh_end_all_cmd,
|
||||||
|
"end",
|
||||||
|
"End current mode and down to previous mode\n")
|
||||||
|
{
|
||||||
|
return vtysh_end (vty);
|
||||||
|
}
|
||||||
|
|
||||||
DEFUNSH (VTYSH_BGPD,
|
DEFUNSH (VTYSH_BGPD,
|
||||||
router_bgp,
|
router_bgp,
|
||||||
router_bgp_cmd,
|
router_bgp_cmd,
|
||||||
@ -981,7 +937,6 @@ DEFUNSH (VTYSH_RMAP,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable command */
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
vtysh_enable,
|
vtysh_enable,
|
||||||
vtysh_enable_cmd,
|
vtysh_enable_cmd,
|
||||||
@ -992,7 +947,6 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable command */
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
vtysh_disable,
|
vtysh_disable,
|
||||||
vtysh_disable_cmd,
|
vtysh_disable_cmd,
|
||||||
@ -1004,7 +958,6 @@ DEFUNSH (VTYSH_ALL,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configration from terminal */
|
|
||||||
DEFUNSH (VTYSH_ALL,
|
DEFUNSH (VTYSH_ALL,
|
||||||
vtysh_config_terminal,
|
vtysh_config_terminal,
|
||||||
vtysh_config_terminal_cmd,
|
vtysh_config_terminal_cmd,
|
||||||
@ -1199,7 +1152,7 @@ ALIAS (vtysh_exit_isisd,
|
|||||||
"quit",
|
"quit",
|
||||||
"Exit current mode and down to previous mode\n")
|
"Exit current mode and down to previous mode\n")
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD,
|
DEFUNSH (VTYSH_INTERFACE,
|
||||||
vtysh_interface,
|
vtysh_interface,
|
||||||
vtysh_interface_cmd,
|
vtysh_interface_cmd,
|
||||||
"interface IFNAME",
|
"interface IFNAME",
|
||||||
@ -1210,6 +1163,7 @@ DEFUNSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISIS
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO Implement "no interface command in isisd. */
|
||||||
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
|
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
|
||||||
vtysh_no_interface_cmd,
|
vtysh_no_interface_cmd,
|
||||||
"no interface IFNAME",
|
"no interface IFNAME",
|
||||||
@ -1217,6 +1171,8 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
|
|||||||
"Delete a pseudo interface's configuration\n"
|
"Delete a pseudo interface's configuration\n"
|
||||||
"Interface's name\n")
|
"Interface's name\n")
|
||||||
|
|
||||||
|
/* TODO Implement interface description commands in ripngd, ospf6d
|
||||||
|
* and isisd. */
|
||||||
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
|
DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
|
||||||
interface_desc_cmd,
|
interface_desc_cmd,
|
||||||
"description .LINE",
|
"description .LINE",
|
||||||
@ -1229,7 +1185,7 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
|
|||||||
NO_STR
|
NO_STR
|
||||||
"Interface specific description\n")
|
"Interface specific description\n")
|
||||||
|
|
||||||
DEFUNSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD,
|
DEFUNSH (VTYSH_INTERFACE,
|
||||||
vtysh_exit_interface,
|
vtysh_exit_interface,
|
||||||
vtysh_exit_interface_cmd,
|
vtysh_exit_interface_cmd,
|
||||||
"exit",
|
"exit",
|
||||||
@ -1243,6 +1199,115 @@ ALIAS (vtysh_exit_interface,
|
|||||||
"quit",
|
"quit",
|
||||||
"Exit current mode and down to previous mode\n")
|
"Exit current mode and down to previous mode\n")
|
||||||
|
|
||||||
|
/* Logging commands. */
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
vtysh_log_stdout,
|
||||||
|
vtysh_log_stdout_cmd,
|
||||||
|
"log stdout",
|
||||||
|
"Logging control\n"
|
||||||
|
"Logging goes to stdout\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
no_vtysh_log_stdout,
|
||||||
|
no_vtysh_log_stdout_cmd,
|
||||||
|
"no log stdout",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Logging goes to stdout\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
vtysh_log_file,
|
||||||
|
vtysh_log_file_cmd,
|
||||||
|
"log file FILENAME",
|
||||||
|
"Logging control\n"
|
||||||
|
"Logging to file\n"
|
||||||
|
"Logging filename\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
no_vtysh_log_file,
|
||||||
|
no_vtysh_log_file_cmd,
|
||||||
|
"no log file [FILENAME]",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Cancel logging to file\n"
|
||||||
|
"Logging file name\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
vtysh_log_syslog,
|
||||||
|
vtysh_log_syslog_cmd,
|
||||||
|
"log syslog",
|
||||||
|
"Logging control\n"
|
||||||
|
"Logging goes to syslog\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
no_vtysh_log_syslog,
|
||||||
|
no_vtysh_log_syslog_cmd,
|
||||||
|
"no log syslog",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Cancel logging to syslog\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
vtysh_log_trap,
|
||||||
|
vtysh_log_trap_cmd,
|
||||||
|
"log trap (emergencies|alerts|critical|errors|warnings|\
|
||||||
|
notifications|informational|debugging)",
|
||||||
|
"Logging control\n"
|
||||||
|
"Limit logging to specifed level\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
no_vtysh_log_trap,
|
||||||
|
no_vtysh_log_trap_cmd,
|
||||||
|
"no log trap",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Permit all logging information\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
vtysh_log_record_priority,
|
||||||
|
vtysh_log_record_priority_cmd,
|
||||||
|
"log record-priority",
|
||||||
|
"Logging control\n"
|
||||||
|
"Log the priority of the message within the message\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUNSH (VTYSH_ALL,
|
||||||
|
no_vtysh_log_record_priority,
|
||||||
|
no_vtysh_log_record_priority_cmd,
|
||||||
|
"no log record-priority",
|
||||||
|
NO_STR
|
||||||
|
"Logging control\n"
|
||||||
|
"Do not log the priority of the message within the message\n")
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (vtysh_write_terminal,
|
DEFUN (vtysh_write_terminal,
|
||||||
vtysh_write_terminal_cmd,
|
vtysh_write_terminal_cmd,
|
||||||
"write terminal",
|
"write terminal",
|
||||||
@ -1305,28 +1370,26 @@ DEFUN (vtysh_write_config,
|
|||||||
"write-config (daemon|integrated)",
|
"write-config (daemon|integrated)",
|
||||||
"Specify config files to write to\n"
|
"Specify config files to write to\n"
|
||||||
"Write per daemon file\n"
|
"Write per daemon file\n"
|
||||||
"Write integrated file\n"
|
"Write integrated file\n")
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!strncmp(argv[0],"d",1)) {
|
if (!strncmp(argv[0],"d",1))
|
||||||
vtysh_wc.daemon = 1;
|
vtysh_wc.daemon = 1;
|
||||||
} else if (!strncmp(argv[0],"i",1)) {
|
else if (!strncmp(argv[0],"i",1))
|
||||||
vtysh_wc.integrated = 1;
|
vtysh_wc.integrated = 1;
|
||||||
}
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_vtysh_write_config,
|
DEFUN (no_vtysh_write_config,
|
||||||
no_vtysh_write_config_cmd,
|
no_vtysh_write_config_cmd,
|
||||||
"no write-config (daemon|integrated)",
|
"no write-config (daemon|integrated)",
|
||||||
"Negate per daemon and/or integrated config files\n"
|
"Negate per daemon and/or integrated config files\n")
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!strncmp(argv[0],"d",1)) {
|
if (!strncmp(argv[0],"d",1))
|
||||||
vtysh_wc.daemon = 0;
|
vtysh_wc.daemon = 0;
|
||||||
} else if (!strncmp(argv[0],"i",1)) {
|
else if (!strncmp(argv[0],"i",1))
|
||||||
vtysh_wc.integrated = 0;
|
vtysh_wc.integrated = 0;
|
||||||
}
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1337,15 +1400,14 @@ int write_config_integrated(void)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *integrate_sav = NULL;
|
char *integrate_sav = NULL;
|
||||||
|
|
||||||
integrate_sav = malloc (strlen (integrate_default)
|
integrate_sav = malloc (strlen (integrate_default) +
|
||||||
+ strlen (CONF_BACKUP_EXT) + 1);
|
strlen (CONF_BACKUP_EXT) + 1);
|
||||||
strcpy (integrate_sav, integrate_default);
|
strcpy (integrate_sav, integrate_default);
|
||||||
strcat (integrate_sav, CONF_BACKUP_EXT);
|
strcat (integrate_sav, CONF_BACKUP_EXT);
|
||||||
|
|
||||||
|
|
||||||
fprintf (stdout,"Building Configuration...\n");
|
fprintf (stdout,"Building Configuration...\n");
|
||||||
|
|
||||||
/* Move current configuration file to backup config file */
|
/* Move current configuration file to backup config file. */
|
||||||
unlink (integrate_sav);
|
unlink (integrate_sav);
|
||||||
rename (integrate_default, integrate_sav);
|
rename (integrate_default, integrate_sav);
|
||||||
free (integrate_sav);
|
free (integrate_sav);
|
||||||
@ -1353,7 +1415,8 @@ int write_config_integrated(void)
|
|||||||
fp = fopen (integrate_default, "w");
|
fp = fopen (integrate_default, "w");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stdout,"%% Can't open configuration file %s.\n", integrate_default);
|
fprintf (stdout,"%% Can't open configuration file %s.\n",
|
||||||
|
integrate_default);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,14 +1457,12 @@ DEFUN (vtysh_write_memory,
|
|||||||
int ret = CMD_SUCCESS;
|
int ret = CMD_SUCCESS;
|
||||||
char line[] = "write memory\n";
|
char line[] = "write memory\n";
|
||||||
|
|
||||||
/* if integrated Zebra.conf explicitely set */
|
/* If integrated Zebra.conf explicitely set. */
|
||||||
if (vtysh_wc.integrated == 1) {
|
if (vtysh_wc.integrated == 1)
|
||||||
ret = write_config_integrated();
|
ret = write_config_integrated();
|
||||||
}
|
|
||||||
|
|
||||||
if (!vtysh_wc.daemon) {
|
if (!vtysh_wc.daemon)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stdout,"Building Configuration...\n");
|
fprintf (stdout,"Building Configuration...\n");
|
||||||
|
|
||||||
@ -1607,76 +1668,6 @@ DEFUN (vtysh_start_zsh,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Route map node structure. */
|
|
||||||
struct cmd_node rmap_node =
|
|
||||||
{
|
|
||||||
RMAP_NODE,
|
|
||||||
"%s(config-route-map)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Zebra node structure. */
|
|
||||||
struct cmd_node zebra_node =
|
|
||||||
{
|
|
||||||
ZEBRA_NODE,
|
|
||||||
"%s(config-router)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node bgp_vpnv4_node =
|
|
||||||
{
|
|
||||||
BGP_VPNV4_NODE,
|
|
||||||
"%s(config-router-af)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node bgp_ipv4_node =
|
|
||||||
{
|
|
||||||
BGP_IPV4_NODE,
|
|
||||||
"%s(config-router-af)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node bgp_ipv4m_node =
|
|
||||||
{
|
|
||||||
BGP_IPV4M_NODE,
|
|
||||||
"%s(config-router-af)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node bgp_ipv6_node =
|
|
||||||
{
|
|
||||||
BGP_IPV6_NODE,
|
|
||||||
"%s(config-router-af)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node ospf_node =
|
|
||||||
{
|
|
||||||
OSPF_NODE,
|
|
||||||
"%s(config-router)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
/* RIPng node structure. */
|
|
||||||
struct cmd_node ripng_node =
|
|
||||||
{
|
|
||||||
RIPNG_NODE,
|
|
||||||
"%s(config-router)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
/* OSPF6 node structure. */
|
|
||||||
struct cmd_node ospf6_node =
|
|
||||||
{
|
|
||||||
OSPF6_NODE,
|
|
||||||
"%s(config-ospf6)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node keychain_node =
|
|
||||||
{
|
|
||||||
KEYCHAIN_NODE,
|
|
||||||
"%s(config-keychain)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmd_node keychain_key_node =
|
|
||||||
{
|
|
||||||
KEYCHAIN_KEY_NODE,
|
|
||||||
"%s(config-keychain-key)# "
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vtysh_install_default (enum node_type node)
|
vtysh_install_default (enum node_type node)
|
||||||
{
|
{
|
||||||
@ -1723,7 +1714,8 @@ vtysh_connect (struct vtysh_client *vclient, char *path)
|
|||||||
if (sock < 0)
|
if (sock < 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path, strerror(errno));
|
fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path,
|
||||||
|
strerror(errno));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1741,7 +1733,8 @@ vtysh_connect (struct vtysh_client *vclient, char *path)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path, strerror(errno));
|
fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path,
|
||||||
|
strerror(errno));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
close (sock);
|
close (sock);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1764,8 +1757,7 @@ vtysh_connect_all()
|
|||||||
vtysh_connect (&vtysh_client[VTYSH_INDEX_ISIS], ISIS_VTYSH_PATH);
|
vtysh_connect (&vtysh_client[VTYSH_INDEX_ISIS], ISIS_VTYSH_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* To disable readline's filename completion. */
|
||||||
/* To disable readline's filename completion */
|
|
||||||
char *
|
char *
|
||||||
vtysh_completion_entry_function (const char *ignore, int invoking_key)
|
vtysh_completion_entry_function (const char *ignore, int invoking_key)
|
||||||
{
|
{
|
||||||
@ -1780,7 +1772,7 @@ vtysh_readline_init ()
|
|||||||
rl_completion_entry_function = vtysh_completion_entry_function;
|
rl_completion_entry_function = vtysh_completion_entry_function;
|
||||||
rl_attempted_completion_function = (CPPFunction *)new_completion;
|
rl_attempted_completion_function = (CPPFunction *)new_completion;
|
||||||
/* do not append space after completion. It will be appended
|
/* do not append space after completion. It will be appended
|
||||||
in new_completion() function explicitly */
|
* in new_completion() function explicitly. */
|
||||||
rl_completion_append_character = '\0';
|
rl_completion_append_character = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1950,7 +1942,7 @@ vtysh_init_vty ()
|
|||||||
install_element (ENABLE_NODE, &vtysh_write_file_cmd);
|
install_element (ENABLE_NODE, &vtysh_write_file_cmd);
|
||||||
install_element (ENABLE_NODE, &vtysh_write_cmd);
|
install_element (ENABLE_NODE, &vtysh_write_cmd);
|
||||||
|
|
||||||
/* write terminal command */
|
/* "write terminal" command. */
|
||||||
install_element (ENABLE_NODE, &vtysh_write_terminal_cmd);
|
install_element (ENABLE_NODE, &vtysh_write_terminal_cmd);
|
||||||
install_element (CONFIG_NODE, &vtysh_write_terminal_cmd);
|
install_element (CONFIG_NODE, &vtysh_write_terminal_cmd);
|
||||||
install_element (BGP_NODE, &vtysh_write_terminal_cmd);
|
install_element (BGP_NODE, &vtysh_write_terminal_cmd);
|
||||||
@ -1968,7 +1960,7 @@ vtysh_init_vty ()
|
|||||||
install_element (KEYCHAIN_NODE, &vtysh_write_terminal_cmd);
|
install_element (KEYCHAIN_NODE, &vtysh_write_terminal_cmd);
|
||||||
install_element (KEYCHAIN_KEY_NODE, &vtysh_write_terminal_cmd);
|
install_element (KEYCHAIN_KEY_NODE, &vtysh_write_terminal_cmd);
|
||||||
|
|
||||||
/* write memory command */
|
/* "write memory" command. */
|
||||||
install_element (ENABLE_NODE, &vtysh_write_memory_cmd);
|
install_element (ENABLE_NODE, &vtysh_write_memory_cmd);
|
||||||
install_element (CONFIG_NODE, &vtysh_write_memory_cmd);
|
install_element (CONFIG_NODE, &vtysh_write_memory_cmd);
|
||||||
install_element (BGP_NODE, &vtysh_write_memory_cmd);
|
install_element (BGP_NODE, &vtysh_write_memory_cmd);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define VTYSH_ISISD 0x40
|
#define VTYSH_ISISD 0x40
|
||||||
#define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD
|
#define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD
|
||||||
#define VTYSH_RMAP VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD
|
#define VTYSH_RMAP VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD
|
||||||
|
#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD
|
||||||
|
|
||||||
#define VTYSH_INDEX_ZEBRA 0
|
#define VTYSH_INDEX_ZEBRA 0
|
||||||
#define VTYSH_INDEX_RIP 1
|
#define VTYSH_INDEX_RIP 1
|
||||||
|
@ -44,7 +44,7 @@ struct config
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct list *config_top;
|
struct list *config_top;
|
||||||
|
|
||||||
int
|
int
|
||||||
line_cmp (char *c1, char *c2)
|
line_cmp (char *c1, char *c2)
|
||||||
{
|
{
|
||||||
@ -164,13 +164,17 @@ vtysh_config_parse_line (char *line)
|
|||||||
/* Store line to current configuration. */
|
/* Store line to current configuration. */
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
if (strncmp (line, " address-family vpnv4", strlen (" address-family vpnv4")) == 0)
|
if (strncmp (line, " address-family vpnv4",
|
||||||
|
strlen (" address-family vpnv4")) == 0)
|
||||||
config = config_get (BGP_VPNV4_NODE, line);
|
config = config_get (BGP_VPNV4_NODE, line);
|
||||||
else if (strncmp (line, " address-family ipv4 multicast", strlen (" address-family ipv4 multicast")) == 0)
|
else if (strncmp (line, " address-family ipv4 multicast",
|
||||||
|
strlen (" address-family ipv4 multicast")) == 0)
|
||||||
config = config_get (BGP_IPV4M_NODE, line);
|
config = config_get (BGP_IPV4M_NODE, line);
|
||||||
else if (strncmp (line, " address-family ipv6", strlen (" address-family ipv6")) == 0)
|
else if (strncmp (line, " address-family ipv6",
|
||||||
|
strlen (" address-family ipv6")) == 0)
|
||||||
config = config_get (BGP_IPV6_NODE, line);
|
config = config_get (BGP_IPV6_NODE, line);
|
||||||
else if (config->index == RMAP_NODE || config->index == INTERFACE_NODE )
|
else if (config->index == RMAP_NODE ||
|
||||||
|
config->index == INTERFACE_NODE )
|
||||||
config_add_line_uniq (config->line, line);
|
config_add_line_uniq (config->line, line);
|
||||||
else
|
else
|
||||||
config_add_line (config->line, line);
|
config_add_line (config->line, line);
|
||||||
@ -199,15 +203,20 @@ vtysh_config_parse_line (char *line)
|
|||||||
config = config_get (RMAP_NODE, line);
|
config = config_get (RMAP_NODE, line);
|
||||||
else if (strncmp (line, "access-list", strlen ("access-list")) == 0)
|
else if (strncmp (line, "access-list", strlen ("access-list")) == 0)
|
||||||
config = config_get (ACCESS_NODE, line);
|
config = config_get (ACCESS_NODE, line);
|
||||||
else if (strncmp (line, "ipv6 access-list", strlen ("ipv6 access-list")) == 0)
|
else if (strncmp (line, "ipv6 access-list",
|
||||||
|
strlen ("ipv6 access-list")) == 0)
|
||||||
config = config_get (ACCESS_IPV6_NODE, line);
|
config = config_get (ACCESS_IPV6_NODE, line);
|
||||||
else if (strncmp (line, "ip prefix-list", strlen ("ip prefix-list")) == 0)
|
else if (strncmp (line, "ip prefix-list",
|
||||||
|
strlen ("ip prefix-list")) == 0)
|
||||||
config = config_get (PREFIX_NODE, line);
|
config = config_get (PREFIX_NODE, line);
|
||||||
else if (strncmp (line, "ipv6 prefix-list", strlen ("ipv6 prefix-list")) == 0)
|
else if (strncmp (line, "ipv6 prefix-list",
|
||||||
|
strlen ("ipv6 prefix-list")) == 0)
|
||||||
config = config_get (PREFIX_IPV6_NODE, line);
|
config = config_get (PREFIX_IPV6_NODE, line);
|
||||||
else if (strncmp (line, "ip as-path access-list", strlen ("ip as-path access-list")) == 0)
|
else if (strncmp (line, "ip as-path access-list",
|
||||||
|
strlen ("ip as-path access-list")) == 0)
|
||||||
config = config_get (AS_LIST_NODE, line);
|
config = config_get (AS_LIST_NODE, line);
|
||||||
else if (strncmp (line, "ip community-list", strlen ("ip community-list")) == 0)
|
else if (strncmp (line, "ip community-list",
|
||||||
|
strlen ("ip community-list")) == 0)
|
||||||
config = config_get (COMMUNITY_LIST_NODE, line);
|
config = config_get (COMMUNITY_LIST_NODE, line);
|
||||||
else if (strncmp (line, "ip route", strlen ("ip route")) == 0)
|
else if (strncmp (line, "ip route", strlen ("ip route")) == 0)
|
||||||
config = config_get (IP_NODE, line);
|
config = config_get (IP_NODE, line);
|
||||||
@ -253,7 +262,7 @@ vtysh_config_parse (char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Macro to check delimiter is needed between each configuration line
|
/* Macro to check delimiter is needed between each configuration line
|
||||||
or not. */
|
* or not. */
|
||||||
#define NO_DELIMITER(I) \
|
#define NO_DELIMITER(I) \
|
||||||
((I) == ACCESS_NODE || (I) == PREFIX_NODE || (I) == IP_NODE \
|
((I) == ACCESS_NODE || (I) == PREFIX_NODE || (I) == IP_NODE \
|
||||||
|| (I) == AS_LIST_NODE || (I) == COMMUNITY_LIST_NODE || \
|
|| (I) == AS_LIST_NODE || (I) == COMMUNITY_LIST_NODE || \
|
||||||
@ -328,7 +337,7 @@ vtysh_read_file (FILE *confp)
|
|||||||
vtysh_execute_no_pager ("enable");
|
vtysh_execute_no_pager ("enable");
|
||||||
vtysh_execute_no_pager ("configure terminal");
|
vtysh_execute_no_pager ("configure terminal");
|
||||||
|
|
||||||
/* Execute configuration file */
|
/* Execute configuration file. */
|
||||||
ret = vtysh_config_from_file (vty, confp);
|
ret = vtysh_config_from_file (vty, confp);
|
||||||
|
|
||||||
vtysh_execute_no_pager ("end");
|
vtysh_execute_no_pager ("end");
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
char *progname;
|
char *progname;
|
||||||
|
|
||||||
/* Configuration file name. Usually this is configurable, but vtysh
|
/* Configuration file name. Usually this is configurable, but vtysh
|
||||||
has static configuration file only. */
|
* has static configuration file only. */
|
||||||
char *config_file = NULL;
|
char *config_file = NULL;
|
||||||
|
|
||||||
/* Configuration file and directory. */
|
/* Configuration file and directory. */
|
||||||
@ -142,15 +142,13 @@ usage (int status)
|
|||||||
if (status != 0)
|
if (status != 0)
|
||||||
fprintf (stderr, "Try `%s --help' for more information.\n", progname);
|
fprintf (stderr, "Try `%s --help' for more information.\n", progname);
|
||||||
else
|
else
|
||||||
{
|
printf ("Usage : %s [OPTION...]\n\n" \
|
||||||
printf ("Usage : %s [OPTION...]\n\n\
|
"Integrated shell for Quagga routing software suite. \n\n"\
|
||||||
Integrated shell for Quagga routing software suite. \n\n\
|
"-b, --boot Execute boot startup configuration\n" \
|
||||||
-b, --boot Execute boot startup configuration\n\
|
"-c, --command Execute argument as command\n "\
|
||||||
-c, --command Execute argument as command\n\
|
"-h, --help Display this help and exit\n\n" \
|
||||||
-h, --help Display this help and exit\n\
|
"Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS);
|
||||||
\n\
|
|
||||||
Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS);
|
|
||||||
}
|
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +169,7 @@ vtysh_rl_gets ()
|
|||||||
{
|
{
|
||||||
HIST_ENTRY *last;
|
HIST_ENTRY *last;
|
||||||
/* If the buffer has already been allocated, return the memory
|
/* If the buffer has already been allocated, return the memory
|
||||||
to the free pool. */
|
* to the free pool. */
|
||||||
if (line_read)
|
if (line_read)
|
||||||
{
|
{
|
||||||
free (line_read);
|
free (line_read);
|
||||||
@ -182,8 +180,7 @@ vtysh_rl_gets ()
|
|||||||
line_read = readline (vtysh_prompt ());
|
line_read = readline (vtysh_prompt ());
|
||||||
|
|
||||||
/* If the line has any text in it, save it on the history. But only if
|
/* If the line has any text in it, save it on the history. But only if
|
||||||
* last command in history isn't the same one.
|
* last command in history isn't the same one. */
|
||||||
*/
|
|
||||||
if (line_read && *line_read)
|
if (line_read && *line_read)
|
||||||
{
|
{
|
||||||
using_history();
|
using_history();
|
||||||
@ -261,7 +258,7 @@ main (int argc, char **argv, char **env)
|
|||||||
/* Read vtysh configuration file. */
|
/* Read vtysh configuration file. */
|
||||||
vtysh_read_config (config_file, config_current, config_default);
|
vtysh_read_config (config_file, config_current, config_default);
|
||||||
|
|
||||||
/* If eval mode */
|
/* If eval mode. */
|
||||||
if (eval_flag)
|
if (eval_flag)
|
||||||
{
|
{
|
||||||
vtysh_execute_no_pager (eval_line);
|
vtysh_execute_no_pager (eval_line);
|
||||||
|
Loading…
Reference in New Issue
Block a user