1 /* Virtual terminal interface shell.
2 * Copyright (C) 2000 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 #include <sys/resource.h>
30 #include <readline/readline.h>
31 #include <readline/history.h>
39 #include "vtysh/vtysh.h"
41 #include "bgpd/bgp_vty.h"
47 /* VTY shell pager name. */
48 char *vtysh_pager_name
= NULL
;
50 /* VTY shell client structure. */
57 struct vtysh_client
*next
;
60 struct vtysh_client vtysh_client
[] =
62 { .fd
= -1, .name
= "zebra", .flag
= VTYSH_ZEBRA
, .path
= ZEBRA_VTYSH_PATH
, .next
= NULL
},
63 { .fd
= -1, .name
= "ripd", .flag
= VTYSH_RIPD
, .path
= RIP_VTYSH_PATH
, .next
= NULL
},
64 { .fd
= -1, .name
= "ripngd", .flag
= VTYSH_RIPNGD
, .path
= RIPNG_VTYSH_PATH
, .next
= NULL
},
65 { .fd
= -1, .name
= "ospfd", .flag
= VTYSH_OSPFD
, .path
= OSPF_VTYSH_PATH
, .next
= NULL
},
66 { .fd
= -1, .name
= "ospf6d", .flag
= VTYSH_OSPF6D
, .path
= OSPF6_VTYSH_PATH
, .next
= NULL
},
67 { .fd
= -1, .name
= "bgpd", .flag
= VTYSH_BGPD
, .path
= BGP_VTYSH_PATH
, .next
= NULL
},
68 { .fd
= -1, .name
= "isisd", .flag
= VTYSH_ISISD
, .path
= ISIS_VTYSH_PATH
, .next
= NULL
},
72 * Compiler is warning about prototypes not being declared.
73 * The DEFUNSH and DEFUN macro's are messing with the
74 * compiler I believe. This is just to make it happy.
77 int vtysh_rl_describe(void);
78 void vtysh_exit_ripd_only(void);
79 int vtysh_connect_all_instances(struct vtysh_client
*);
82 /* We need direct access to ripd to implement vtysh_exit_ripd_only. */
83 static struct vtysh_client
*ripd_client
= NULL
;
86 /* Using integrated config from Quagga.conf. Default is no. */
87 int vtysh_writeconfig_integrated
= 0;
89 extern char config_default
[];
92 vclient_close (struct vtysh_client
*vclient
)
97 "Warning: closing connection to %s because of an I/O error!\n",
104 /* Return true if str begins with prefix, else return false */
106 begins_with(const char *str
, const char *prefix
)
110 size_t lenstr
= strlen(str
);
111 size_t lenprefix
= strlen(prefix
);
112 if (lenprefix
> lenstr
)
114 return strncmp(str
, prefix
, lenprefix
) == 0;
117 /* Following filled with debug code to trace a problematic condition
118 * under load - it SHOULD handle it. */
119 #define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
121 vtysh_client_config_one (struct vtysh_client
*vclient
, char *line
)
136 ret
= write (vclient
->fd
, line
, strlen (line
) + 1);
139 vclient_close (vclient
);
143 /* Allow enough room for buffer to read more than a few pages from socket. */
144 bufsz
= 5 * getpagesize() + 1;
145 buf
= XMALLOC(MTYPE_TMP
, bufsz
);
146 memset(buf
, 0, bufsz
);
151 if (pbuf
>= ((buf
+ bufsz
) -1))
153 fprintf (stderr
, ERR_WHERE_STRING \
154 "warning - pbuf beyond buffer end.\n");
158 readln
= (buf
+ bufsz
) - pbuf
- 1;
159 nbytes
= read (vclient
->fd
, pbuf
, readln
);
167 fprintf(stderr
, ERR_WHERE_STRING
"(%u)", errno
);
170 if (errno
== EAGAIN
|| errno
== EIO
)
173 vclient_close (vclient
);
174 XFREE(MTYPE_TMP
, buf
);
183 if (pbuf
[i
] == '\0' && pbuf
[i
+ 1] == '\0' && pbuf
[i
+ 2] == '\0')
191 /* See if a line exists in buffer, if so parse and consume it, and
192 * reset read position. */
193 if ((eoln
= strrchr(buf
, '\n')) == NULL
)
196 if (eoln
>= ((buf
+ bufsz
) - 1))
198 fprintf (stderr
, ERR_WHERE_STRING \
199 "warning - eoln beyond buffer end.\n");
201 vtysh_config_parse(buf
);
204 left
= (size_t)(buf
+ bufsz
- eoln
);
205 memmove(buf
, eoln
, left
);
207 pbuf
= buf
+ strlen(buf
);
210 /* Parse anything left in the buffer. */
212 vtysh_config_parse (buf
);
214 XFREE(MTYPE_TMP
, buf
);
219 vtysh_client_config (struct vtysh_client
*head_client
, char *line
)
221 struct vtysh_client
*client
;
224 rc
= vtysh_client_config_one(head_client
, line
);
225 if (rc
!= CMD_SUCCESS
)
228 client
= head_client
->next
;
231 rc
= vtysh_client_config_one(client
, line
);
232 if (rc
!= CMD_SUCCESS
)
234 client
= client
->next
;
240 vtysh_client_execute_one (struct vtysh_client
*vclient
, const char *line
, FILE *fp
)
251 ret
= write (vclient
->fd
, line
, strlen (line
) + 1);
254 vclient_close (vclient
);
260 nbytes
= read (vclient
->fd
, buf
, sizeof(buf
)-1);
262 if (nbytes
<= 0 && errno
!= EINTR
)
264 vclient_close (vclient
);
270 if ((numnulls
== 3) && (nbytes
== 1))
277 /* check for trailling \0\0\0<ret code>,
278 * even if split across reads
279 * (see lib/vty.c::vtysh_read)
289 while (i
< nbytes
&& numnulls
< 3)
291 if (buf
[i
++] == '\0')
297 /* got 3 or more trailing NULs? */
298 if ((numnulls
>= 3) && (i
< nbytes
))
299 return (buf
[nbytes
-1]);
305 vtysh_client_execute (struct vtysh_client
*head_client
, const char *line
, FILE *fp
)
307 struct vtysh_client
*client
;
310 rc
= vtysh_client_execute_one(head_client
, line
, fp
);
311 if (rc
!= CMD_SUCCESS
)
314 client
= head_client
->next
;
317 rc
= vtysh_client_execute_one(client
, line
, fp
);
318 if (rc
!= CMD_SUCCESS
)
320 client
= client
->next
;
326 vtysh_exit_ripd_only (void)
329 vtysh_client_execute (ripd_client
, "exit", stdout
);
334 vtysh_pager_init (void)
338 pager_defined
= getenv ("VTYSH_PAGER");
341 vtysh_pager_name
= strdup (pager_defined
);
343 vtysh_pager_name
= strdup ("more");
346 /* Command execution over the vty interface. */
348 vtysh_execute_func (const char *line
, int pager
)
353 struct cmd_element
*cmd
;
357 int saved_ret
, saved_node
;
359 /* Split readline string up into the vector. */
360 vline
= cmd_make_strvec (line
);
365 saved_ret
= ret
= cmd_execute_command (vline
, vty
, &cmd
, 1);
366 saved_node
= vty
->node
;
368 /* If command doesn't succeeded in current node, try to walk up in node tree.
369 * Changing vty->node is enough to try it just out without actual walkup in
371 while (ret
!= CMD_SUCCESS
&& ret
!= CMD_SUCCESS_DAEMON
&& ret
!= CMD_WARNING
372 && vty
->node
> CONFIG_NODE
)
374 vty
->node
= node_parent(vty
->node
);
375 ret
= cmd_execute_command (vline
, vty
, &cmd
, 1);
379 vty
->node
= saved_node
;
381 /* If command succeeded in any other node than current (tried > 0) we have
382 * to move into node in the vtysh where it succeeded. */
383 if (ret
== CMD_SUCCESS
|| ret
== CMD_SUCCESS_DAEMON
|| ret
== CMD_WARNING
)
385 if ((saved_node
== BGP_VPNV4_NODE
|| saved_node
== BGP_IPV4_NODE
386 || saved_node
== BGP_IPV6_NODE
|| saved_node
== BGP_IPV4M_NODE
387 || saved_node
== BGP_IPV6M_NODE
)
390 vtysh_execute("exit-address-family");
392 else if ((saved_node
== KEYCHAIN_KEY_NODE
) && (tried
== 1))
394 vtysh_execute("exit");
398 vtysh_execute ("end");
399 vtysh_execute ("configure terminal");
402 /* If command didn't succeed in any node, continue with return value from
409 cmd_free_strvec (vline
);
415 if (vty
->type
== VTY_FILE
)
416 fprintf (stdout
,"Warning...\n");
418 case CMD_ERR_AMBIGUOUS
:
419 fprintf (stdout
,"%% Ambiguous command.\n");
421 case CMD_ERR_NO_MATCH
:
422 fprintf (stdout
,"%% Unknown command.\n");
424 case CMD_ERR_INCOMPLETE
:
425 fprintf (stdout
,"%% Command incomplete.\n");
427 case CMD_SUCCESS_DAEMON
:
429 /* FIXME: Don't open pager for exit commands. popen() causes problems
430 * if exited from vtysh at all. This hack shouldn't cause any problem
431 * but is really ugly. */
432 if (pager
&& vtysh_pager_name
&& (strncmp(line
, "exit", 4) != 0))
434 fp
= popen (vtysh_pager_name
, "w");
437 perror ("popen failed for pager");
446 if (! strcmp(cmd
->string
,"configure terminal"))
448 for (i
= 0; i
< array_size(vtysh_client
); i
++)
450 cmd_stat
= vtysh_client_execute(&vtysh_client
[i
], line
, fp
);
451 if (cmd_stat
== CMD_WARNING
)
458 vline
= cmd_make_strvec (line
);
462 if (pager
&& vtysh_pager_name
&& fp
&& closepager
)
464 if (pclose (fp
) == -1)
466 perror ("pclose failed for pager");
473 ret
= cmd_execute_command (vline
, vty
, &cmd
, 1);
474 cmd_free_strvec (vline
);
475 if (ret
!= CMD_SUCCESS_DAEMON
)
481 (*cmd
->func
) (cmd
, vty
, 0, NULL
);
486 cmd_stat
= CMD_SUCCESS
;
487 for (i
= 0; i
< array_size(vtysh_client
); i
++)
489 if (cmd
->daemon
& vtysh_client
[i
].flag
)
491 cmd_stat
= vtysh_client_execute(&vtysh_client
[i
], line
, fp
);
492 if (cmd_stat
!= CMD_SUCCESS
)
496 if (cmd_stat
!= CMD_SUCCESS
)
500 (*cmd
->func
) (cmd
, vty
, 0, NULL
);
503 if (pager
&& vtysh_pager_name
&& fp
&& closepager
)
505 if (pclose (fp
) == -1)
507 perror ("pclose failed for pager");
515 vtysh_execute_no_pager (const char *line
)
517 return vtysh_execute_func (line
, 0);
521 vtysh_execute (const char *line
)
523 return vtysh_execute_func (line
, 1);
527 vtysh_mark_file (const char *filename
)
534 struct cmd_element
*cmd
;
535 int saved_ret
, prev_node
;
538 if (strncmp("-", filename
, 1) == 0)
541 confp
= fopen (filename
, "r");
545 fprintf (stderr
, "%% Can't open config file %s due to '%s'.\n",
546 filename
, safe_strerror (errno
));
547 return (CMD_ERR_NO_FILE
);
551 vty
->fd
= 0; /* stdout */
552 vty
->type
= VTY_TERM
;
553 vty
->node
= CONFIG_NODE
;
555 vtysh_execute_no_pager ("enable");
556 vtysh_execute_no_pager ("configure terminal");
558 while (fgets (vty
->buf
, VTY_BUFSIZ
, confp
))
563 if (vty
->buf
[0] == '!' || vty
->buf
[1] == '#')
565 fprintf(stdout
, "%s", vty
->buf
);
569 /* Split readline string up into the vector. */
570 vline
= cmd_make_strvec (vty
->buf
);
574 fprintf(stdout
, "%s", vty
->buf
);
578 prev_node
= vty
->node
;
579 saved_ret
= ret
= cmd_execute_command_strict (vline
, vty
, &cmd
);
581 /* If command doesn't succeeded in current node, try to walk up in node tree.
582 * Changing vty->node is enough to try it just out without actual walkup in
584 while (ret
!= CMD_SUCCESS
&& ret
!= CMD_SUCCESS_DAEMON
&& ret
!= CMD_WARNING
585 && vty
->node
> CONFIG_NODE
)
587 vty
->node
= node_parent(vty
->node
);
588 ret
= cmd_execute_command_strict (vline
, vty
, &cmd
);
592 /* If command succeeded in any other node than current (tried > 0) we have
593 * to move into node in the vtysh where it succeeded. */
594 if (ret
== CMD_SUCCESS
|| ret
== CMD_SUCCESS_DAEMON
|| ret
== CMD_WARNING
)
596 if ((prev_node
== BGP_VPNV4_NODE
|| prev_node
== BGP_IPV4_NODE
597 || prev_node
== BGP_IPV6_NODE
|| prev_node
== BGP_IPV4M_NODE
598 || prev_node
== BGP_IPV6M_NODE
)
601 fprintf(stdout
, "exit-address-family\n");
603 else if ((prev_node
== KEYCHAIN_KEY_NODE
) && (tried
== 1))
605 fprintf(stdout
, "exit\n");
609 fprintf(stdout
, "end\n");
612 /* If command didn't succeed in any node, continue with return value from
617 vty
->node
= prev_node
;
620 cmd_free_strvec (vline
);
624 if (vty
->type
== VTY_FILE
)
625 fprintf (stderr
,"line %d: Warning...: %s\n", lineno
, vty
->buf
);
629 case CMD_ERR_AMBIGUOUS
:
630 fprintf (stderr
,"line %d: %% Ambiguous command: %s\n", lineno
, vty
->buf
);
633 return CMD_ERR_AMBIGUOUS
;
634 case CMD_ERR_NO_MATCH
:
635 fprintf (stderr
,"line %d: %% Unknown command: %s\n", lineno
, vty
->buf
);
638 return CMD_ERR_NO_MATCH
;
639 case CMD_ERR_INCOMPLETE
:
640 fprintf (stderr
,"line %d: %% Command incomplete: %s\n", lineno
, vty
->buf
);
643 return CMD_ERR_INCOMPLETE
;
645 fprintf(stdout
, "%s", vty
->buf
);
647 case CMD_SUCCESS_DAEMON
:
650 int cmd_stat
= CMD_SUCCESS
;
652 fprintf(stdout
, "%s", vty
->buf
);
653 for (i
= 0; i
< array_size(vtysh_client
); i
++)
655 if (cmd
->daemon
& vtysh_client
[i
].flag
)
657 cmd_stat
= vtysh_client_execute (&vtysh_client
[i
],
659 if (cmd_stat
!= CMD_SUCCESS
)
663 if (cmd_stat
!= CMD_SUCCESS
)
667 (*cmd
->func
) (cmd
, vty
, 0, NULL
);
671 /* This is the end */
672 fprintf(stdout
, "end\n");
681 /* Configration make from file. */
683 vtysh_config_from_file (struct vty
*vty
, FILE *fp
)
686 struct cmd_element
*cmd
;
688 int retcode
= CMD_SUCCESS
;
690 while (fgets (vty
->buf
, VTY_BUFSIZ
, fp
))
694 ret
= command_config_read_one_line (vty
, &cmd
, 1);
699 if (vty
->type
== VTY_FILE
)
700 fprintf (stderr
,"line %d: Warning[%d]...: %s\n", lineno
, vty
->node
, vty
->buf
);
701 retcode
= CMD_WARNING
; /* once we have an error, we remember & return that */
703 case CMD_ERR_AMBIGUOUS
:
704 fprintf (stderr
,"line %d: %% Ambiguous command[%d]: %s\n", lineno
, vty
->node
, vty
->buf
);
705 retcode
= CMD_ERR_AMBIGUOUS
; /* once we have an error, we remember & return that */
707 case CMD_ERR_NO_MATCH
:
708 fprintf (stderr
,"line %d: %% Unknown command[%d]: %s", lineno
, vty
->node
, vty
->buf
);
709 retcode
= CMD_ERR_NO_MATCH
; /* once we have an error, we remember & return that */
711 case CMD_ERR_INCOMPLETE
:
712 fprintf (stderr
,"line %d: %% Command incomplete[%d]: %s\n", lineno
, vty
->node
, vty
->buf
);
713 retcode
= CMD_ERR_INCOMPLETE
; /* once we have an error, we remember & return that */
715 case CMD_SUCCESS_DAEMON
:
718 int cmd_stat
= CMD_SUCCESS
;
720 for (i
= 0; i
< array_size(vtysh_client
); i
++)
722 if (cmd
->daemon
& vtysh_client
[i
].flag
)
724 cmd_stat
= vtysh_client_execute (&vtysh_client
[i
],
727 * CMD_WARNING - Can mean that the command was
728 * parsed successfully but it was already entered
729 * in a few spots. As such if we receive a
730 * CMD_WARNING from a daemon we shouldn't stop
731 * talking to the other daemons for the particular
734 if (cmd_stat
!= CMD_SUCCESS
&& cmd_stat
!= CMD_WARNING
)
736 fprintf (stderr
, "line %d: Failure to communicate[%d] to %s, line: %s\n",
737 lineno
, cmd_stat
, vtysh_client
[i
].name
, vty
->buf
);
742 if (cmd_stat
!= CMD_SUCCESS
)
746 (*cmd
->func
) (cmd
, vty
, 0, NULL
);
754 /* We don't care about the point of the cursor when '?' is typed. */
756 vtysh_rl_describe (void)
763 struct cmd_token
*token
;
765 vline
= cmd_make_strvec (rl_line_buffer
);
767 /* In case of '> ?'. */
770 vline
= vector_init (1);
771 vector_set (vline
, NULL
);
774 if (rl_end
&& isspace ((int) rl_line_buffer
[rl_end
- 1]))
775 vector_set (vline
, NULL
);
777 describe
= cmd_describe_command (vline
, vty
, &ret
);
779 fprintf (stdout
,"\n");
781 /* Ambiguous and no match error. */
784 case CMD_ERR_AMBIGUOUS
:
785 cmd_free_strvec (vline
);
786 fprintf (stdout
,"%% Ambiguous command.\n");
790 case CMD_ERR_NO_MATCH
:
791 cmd_free_strvec (vline
);
792 fprintf (stdout
,"%% There is no matched command.\n");
798 /* Get width of command string. */
800 for (i
= 0; i
< vector_active (describe
); i
++)
801 if ((token
= vector_slot (describe
, i
)) != NULL
)
805 if (token
->cmd
[0] == '\0')
808 len
= strlen (token
->cmd
);
809 if (token
->cmd
[0] == '.')
816 for (i
= 0; i
< vector_active (describe
); i
++)
817 if ((token
= vector_slot (describe
, i
)) != NULL
)
819 if (token
->cmd
[0] == '\0')
823 fprintf (stdout
," %-s\n",
824 token
->cmd
[0] == '.' ? token
->cmd
+ 1 : token
->cmd
);
826 fprintf (stdout
," %-*s %s\n",
828 token
->cmd
[0] == '.' ? token
->cmd
+ 1 : token
->cmd
,
832 cmd_free_strvec (vline
);
833 vector_free (describe
);
840 /* Result of cmd_complete_command() call will be stored here
841 * and used in new_completion() in order to put the space in
842 * correct places only. */
846 command_generator (const char *text
, int state
)
849 static char **matched
= NULL
;
850 static int index
= 0;
857 if (vty
->node
== AUTH_NODE
|| vty
->node
== AUTH_ENABLE_NODE
)
860 vline
= cmd_make_strvec (rl_line_buffer
);
864 if (rl_end
&& isspace ((int) rl_line_buffer
[rl_end
- 1]))
865 vector_set (vline
, NULL
);
867 matched
= cmd_complete_command (vline
, vty
, &complete_status
);
870 if (matched
&& matched
[index
])
871 return matched
[index
++];
877 new_completion (char *text
, int start
, int end
)
881 matches
= rl_completion_matches (text
, command_generator
);
886 if (complete_status
!= CMD_COMPLETE_FULL_MATCH
)
887 /* only append a space on full match */
888 rl_completion_append_character
= '\0';
894 /* Vty node structures. */
895 static struct cmd_node bgp_node
=
898 "%s(config-router)# ",
901 static struct cmd_node rip_node
=
904 "%s(config-router)# ",
907 static struct cmd_node isis_node
=
910 "%s(config-router)# ",
913 static struct cmd_node interface_node
=
919 static struct cmd_node vrf_node
=
925 static struct cmd_node rmap_node
=
928 "%s(config-route-map)# "
931 static struct cmd_node zebra_node
=
934 "%s(config-router)# "
937 static struct cmd_node bgp_vpnv4_node
=
940 "%s(config-router-af)# "
943 static struct cmd_node bgp_ipv4_node
=
946 "%s(config-router-af)# "
949 static struct cmd_node bgp_ipv4m_node
=
952 "%s(config-router-af)# "
955 static struct cmd_node bgp_ipv6_node
=
958 "%s(config-router-af)# "
961 static struct cmd_node bgp_ipv6m_node
=
964 "%s(config-router-af)# "
967 static struct cmd_node ospf_node
=
970 "%s(config-router)# "
973 static struct cmd_node ripng_node
=
976 "%s(config-router)# "
979 static struct cmd_node ospf6_node
=
985 static struct cmd_node keychain_node
=
988 "%s(config-keychain)# "
991 static struct cmd_node keychain_key_node
=
994 "%s(config-keychain-key)# "
997 /* Defined in lib/vty.c */
998 extern struct cmd_node vty_node
;
1000 /* When '^Z' is received from vty, move down to the enable mode. */
1008 /* Nothing to do. */
1011 vty
->node
= ENABLE_NODE
;
1021 "End current mode and change to enable mode\n")
1023 return vtysh_end ();
1026 DEFUNSH (VTYSH_BGPD
,
1029 "router bgp " CMD_AS_RANGE
,
1034 vty
->node
= BGP_NODE
;
1038 ALIAS_SH (VTYSH_BGPD
,
1045 ALIAS_SH (VTYSH_BGPD
,
1047 router_bgp_view_cmd
,
1048 "router bgp " CMD_AS_RANGE
" (view|vrf) WORD",
1052 "BGP view\nBGP VRF\n"
1055 DEFUNSH (VTYSH_BGPD
,
1056 address_family_vpnv4
,
1057 address_family_vpnv4_cmd
,
1058 "address-family vpnv4",
1059 "Enter Address Family command mode\n"
1062 vty
->node
= BGP_VPNV4_NODE
;
1066 DEFUNSH (VTYSH_BGPD
,
1067 address_family_vpnv4_unicast
,
1068 address_family_vpnv4_unicast_cmd
,
1069 "address-family vpnv4 unicast",
1070 "Enter Address Family command mode\n"
1072 "Address Family Modifier\n")
1074 vty
->node
= BGP_VPNV4_NODE
;
1078 DEFUNSH (VTYSH_BGPD
,
1079 address_family_ipv4_unicast
,
1080 address_family_ipv4_unicast_cmd
,
1081 "address-family ipv4 unicast",
1082 "Enter Address Family command mode\n"
1084 "Address Family Modifier\n")
1086 vty
->node
= BGP_IPV4_NODE
;
1090 DEFUNSH (VTYSH_BGPD
,
1091 address_family_ipv4_multicast
,
1092 address_family_ipv4_multicast_cmd
,
1093 "address-family ipv4 multicast",
1094 "Enter Address Family command mode\n"
1096 "Address Family Modifier\n")
1098 vty
->node
= BGP_IPV4M_NODE
;
1102 DEFUNSH (VTYSH_BGPD
,
1103 address_family_ipv6
,
1104 address_family_ipv6_cmd
,
1105 "address-family ipv6",
1106 "Enter Address Family command mode\n"
1109 vty
->node
= BGP_IPV6_NODE
;
1113 DEFUNSH (VTYSH_BGPD
,
1114 address_family_ipv6_unicast
,
1115 address_family_ipv6_unicast_cmd
,
1116 "address-family ipv6 unicast",
1117 "Enter Address Family command mode\n"
1119 "Address Family Modifier\n")
1121 vty
->node
= BGP_IPV6_NODE
;
1125 DEFUNSH (VTYSH_BGPD
,
1126 address_family_ipv6_multicast
,
1127 address_family_ipv6_multicast_cmd
,
1128 "address-family ipv6 multicast",
1129 "Enter Address Family command mode\n"
1131 "Address Family Modifier\n")
1133 vty
->node
= BGP_IPV6M_NODE
;
1137 DEFUNSH (VTYSH_RIPD
,
1141 "Authentication key management\n"
1142 "Key-chain management\n"
1145 vty
->node
= KEYCHAIN_NODE
;
1149 DEFUNSH (VTYSH_RIPD
,
1152 "key <0-2147483647>",
1154 "Key identifier number\n")
1156 vty
->node
= KEYCHAIN_KEY_NODE
;
1160 DEFUNSH (VTYSH_RIPD
,
1167 vty
->node
= RIP_NODE
;
1171 DEFUNSH (VTYSH_RIPNGD
,
1178 vty
->node
= RIPNG_NODE
;
1182 DEFUNSH (VTYSH_OSPFD
,
1186 "Enable a routing process\n"
1187 "Start OSPF configuration\n")
1189 vty
->node
= OSPF_NODE
;
1193 ALIAS_SH (VTYSH_OSPFD
,
1195 router_ospf_instance_cmd
,
1196 "router ospf <1-65535>",
1197 "Enable a routing process\n"
1198 "Start OSPF configuration\n"
1201 DEFUNSH (VTYSH_OSPF6D
,
1208 vty
->node
= OSPF6_NODE
;
1212 DEFUNSH (VTYSH_ISISD
,
1218 "ISO Routing area tag")
1220 vty
->node
= ISIS_NODE
;
1224 DEFUNSH (VTYSH_RMAP
,
1227 "route-map WORD (deny|permit) <1-65535>",
1228 "Create route-map or enter route-map command mode\n"
1230 "Route map denies set operations\n"
1231 "Route map permits set operations\n"
1232 "Sequence to insert to/delete from existing route-map entry\n")
1234 vty
->node
= RMAP_NODE
;
1242 "Configure a terminal line\n"
1243 "Virtual terminal\n")
1245 vty
->node
= VTY_NODE
;
1253 "Turn on privileged mode command\n")
1255 vty
->node
= ENABLE_NODE
;
1263 "Turn off privileged mode command\n")
1265 if (vty
->node
== ENABLE_NODE
)
1266 vty
->node
= VIEW_NODE
;
1271 vtysh_config_terminal
,
1272 vtysh_config_terminal_cmd
,
1273 "configure terminal",
1274 "Configuration from vty interface\n"
1275 "Configuration terminal\n")
1277 vty
->node
= CONFIG_NODE
;
1282 vtysh_exit (struct vty
*vty
)
1291 vty
->node
= ENABLE_NODE
;
1293 case INTERFACE_NODE
:
1306 vtysh_execute("end");
1307 vtysh_execute("configure terminal");
1308 vty
->node
= CONFIG_NODE
;
1310 case BGP_VPNV4_NODE
:
1312 case BGP_IPV4M_NODE
:
1314 case BGP_IPV6M_NODE
:
1315 vty
->node
= BGP_NODE
;
1317 case KEYCHAIN_KEY_NODE
:
1318 vty
->node
= KEYCHAIN_NODE
;
1330 "Exit current mode and down to previous mode\n")
1332 return vtysh_exit (vty
);
1335 ALIAS (vtysh_exit_all
,
1338 "Exit current mode and down to previous mode\n")
1340 DEFUNSH (VTYSH_BGPD
,
1341 exit_address_family
,
1342 exit_address_family_cmd
,
1343 "exit-address-family",
1344 "Exit from Address Family configuration mode\n")
1346 if (vty
->node
== BGP_IPV4_NODE
1347 || vty
->node
== BGP_IPV4M_NODE
1348 || vty
->node
== BGP_VPNV4_NODE
1349 || vty
->node
== BGP_IPV6_NODE
1350 || vty
->node
== BGP_IPV6M_NODE
)
1351 vty
->node
= BGP_NODE
;
1355 DEFUNSH (VTYSH_ZEBRA
,
1357 vtysh_exit_zebra_cmd
,
1359 "Exit current mode and down to previous mode\n")
1361 return vtysh_exit (vty
);
1364 ALIAS (vtysh_exit_zebra
,
1365 vtysh_quit_zebra_cmd
,
1367 "Exit current mode and down to previous mode\n")
1369 DEFUNSH (VTYSH_RIPD
,
1371 vtysh_exit_ripd_cmd
,
1373 "Exit current mode and down to previous mode\n")
1375 return vtysh_exit (vty
);
1378 ALIAS (vtysh_exit_ripd
,
1379 vtysh_quit_ripd_cmd
,
1381 "Exit current mode and down to previous mode\n")
1383 DEFUNSH (VTYSH_RIPNGD
,
1385 vtysh_exit_ripngd_cmd
,
1387 "Exit current mode and down to previous mode\n")
1389 return vtysh_exit (vty
);
1392 ALIAS (vtysh_exit_ripngd
,
1393 vtysh_quit_ripngd_cmd
,
1395 "Exit current mode and down to previous mode\n")
1397 DEFUNSH (VTYSH_RMAP
,
1399 vtysh_exit_rmap_cmd
,
1401 "Exit current mode and down to previous mode\n")
1403 return vtysh_exit (vty
);
1406 ALIAS (vtysh_exit_rmap
,
1407 vtysh_quit_rmap_cmd
,
1409 "Exit current mode and down to previous mode\n")
1411 DEFUNSH (VTYSH_BGPD
,
1413 vtysh_exit_bgpd_cmd
,
1415 "Exit current mode and down to previous mode\n")
1417 return vtysh_exit (vty
);
1420 ALIAS (vtysh_exit_bgpd
,
1421 vtysh_quit_bgpd_cmd
,
1423 "Exit current mode and down to previous mode\n")
1425 DEFUNSH (VTYSH_OSPFD
,
1427 vtysh_exit_ospfd_cmd
,
1429 "Exit current mode and down to previous mode\n")
1431 return vtysh_exit (vty
);
1434 ALIAS (vtysh_exit_ospfd
,
1435 vtysh_quit_ospfd_cmd
,
1437 "Exit current mode and down to previous mode\n")
1439 DEFUNSH (VTYSH_OSPF6D
,
1441 vtysh_exit_ospf6d_cmd
,
1443 "Exit current mode and down to previous mode\n")
1445 return vtysh_exit (vty
);
1448 ALIAS (vtysh_exit_ospf6d
,
1449 vtysh_quit_ospf6d_cmd
,
1451 "Exit current mode and down to previous mode\n")
1453 DEFUNSH (VTYSH_ISISD
,
1455 vtysh_exit_isisd_cmd
,
1457 "Exit current mode and down to previous mode\n")
1459 return vtysh_exit (vty
);
1462 ALIAS (vtysh_exit_isisd
,
1463 vtysh_quit_isisd_cmd
,
1465 "Exit current mode and down to previous mode\n")
1468 vtysh_exit_line_vty
,
1469 vtysh_exit_line_vty_cmd
,
1471 "Exit current mode and down to previous mode\n")
1473 return vtysh_exit (vty
);
1476 ALIAS (vtysh_exit_line_vty
,
1477 vtysh_quit_line_vty_cmd
,
1479 "Exit current mode and down to previous mode\n")
1481 DEFUNSH (VTYSH_INTERFACE
,
1483 vtysh_interface_cmd
,
1485 "Select an interface to configure\n"
1486 "Interface's name\n")
1488 vty
->node
= INTERFACE_NODE
;
1492 ALIAS_SH (VTYSH_ZEBRA
,
1494 vtysh_interface_vrf_cmd
,
1495 "interface IFNAME " VRF_CMD_STR
,
1496 "Select an interface to configure\n"
1497 "Interface's name\n"
1500 /* TODO Implement "no interface command in isisd. */
1501 DEFSH (VTYSH_ZEBRA
|VTYSH_RIPD
|VTYSH_RIPNGD
|VTYSH_OSPFD
|VTYSH_OSPF6D
,
1502 vtysh_no_interface_cmd
,
1503 "no interface IFNAME",
1505 "Delete a pseudo interface's configuration\n"
1506 "Interface's name\n")
1509 vtysh_no_interface_vrf_cmd
,
1510 "no interface IFNAME " VRF_CMD_STR
,
1512 "Delete a pseudo interface's configuration\n"
1513 "Interface's name\n"
1520 "Select a VRF to configure\n"
1523 vty
->node
= VRF_NODE
;
1531 "Delete a pseudo vrf's configuration\n"
1538 "Exit current mode and down to previous mode\n")
1540 return vtysh_exit (vty
);
1543 ALIAS (vtysh_exit_vrf
,
1546 "Exit current mode and down to previous mode\n")
1548 /* TODO Implement interface description commands in ripngd, ospf6d
1550 DEFSH (VTYSH_ZEBRA
|VTYSH_RIPD
|VTYSH_OSPFD
,
1552 "description .LINE",
1553 "Interface specific description\n"
1554 "Characters describing this interface\n")
1556 DEFSH (VTYSH_ZEBRA
|VTYSH_RIPD
|VTYSH_OSPFD
,
1557 no_interface_desc_cmd
,
1560 "Interface specific description\n")
1562 DEFUNSH (VTYSH_INTERFACE
,
1563 vtysh_exit_interface
,
1564 vtysh_exit_interface_cmd
,
1566 "Exit current mode and down to previous mode\n")
1568 return vtysh_exit (vty
);
1571 ALIAS (vtysh_exit_interface
,
1572 vtysh_quit_interface_cmd
,
1574 "Exit current mode and down to previous mode\n")
1576 DEFUN (vtysh_show_thread
,
1577 vtysh_show_thread_cmd
,
1578 "show thread cpu [FILTER]",
1580 "Thread information\n"
1581 "Thread CPU usage\n"
1582 "Display filter (rwtexb)\n")
1585 int ret
= CMD_SUCCESS
;
1588 sprintf(line
, "show thread cpu %s\n", (argc
== 1) ? argv
[0] : "");
1589 for (i
= 0; i
< array_size(vtysh_client
); i
++)
1590 if ( vtysh_client
[i
].fd
>= 0 )
1592 fprintf (stdout
, "Thread statistics for %s:\n",
1593 vtysh_client
[i
].name
);
1594 ret
= vtysh_client_execute (&vtysh_client
[i
], line
, stdout
);
1595 fprintf (stdout
,"\n");
1600 DEFUN (vtysh_show_work_queues
,
1601 vtysh_show_work_queues_cmd
,
1604 "Work Queue information\n")
1607 int ret
= CMD_SUCCESS
;
1608 char line
[] = "show work-queues\n";
1610 for (i
= 0; i
< array_size(vtysh_client
); i
++)
1611 if ( vtysh_client
[i
].fd
>= 0 )
1613 fprintf (stdout
, "Work queue statistics for %s:\n",
1614 vtysh_client
[i
].name
);
1615 ret
= vtysh_client_execute (&vtysh_client
[i
], line
, stdout
);
1616 fprintf (stdout
,"\n");
1622 DEFUN (vtysh_show_work_queues_daemon
,
1623 vtysh_show_work_queues_daemon_cmd
,
1624 "show work-queues (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd)",
1626 "Work Queue information\n"
1627 "For the zebra daemon\n"
1628 "For the rip daemon\n"
1629 "For the ripng daemon\n"
1630 "For the ospf daemon\n"
1631 "For the ospfv6 daemon\n"
1632 "For the bgp daemon\n"
1633 "For the isis daemon\n")
1636 int ret
= CMD_SUCCESS
;
1638 for (i
= 0; i
< array_size(vtysh_client
); i
++)
1640 if (begins_with(vtysh_client
[i
].name
, argv
[0]))
1644 ret
= vtysh_client_execute(&vtysh_client
[i
], "show work-queues\n", stdout
);
1650 DEFUN (vtysh_show_memory
,
1651 vtysh_show_memory_cmd
,
1654 "Memory statistics\n")
1657 int ret
= CMD_SUCCESS
;
1658 char line
[] = "show memory\n";
1660 for (i
= 0; i
< array_size(vtysh_client
); i
++)
1661 if ( vtysh_client
[i
].fd
>= 0 )
1663 fprintf (stdout
, "Memory statistics for %s:\n",
1664 vtysh_client
[i
].name
);
1665 ret
= vtysh_client_execute (&vtysh_client
[i
], line
, stdout
);
1666 fprintf (stdout
,"\n");
1672 /* Logging commands. */
1673 DEFUN (vtysh_show_logging
,
1674 vtysh_show_logging_cmd
,
1677 "Show current logging configuration\n")
1680 int ret
= CMD_SUCCESS
;
1681 char line
[] = "show logging\n";
1683 for (i
= 0; i
< array_size(vtysh_client
); i
++)
1684 if ( vtysh_client
[i
].fd
>= 0 )
1686 fprintf (stdout
,"Logging configuration for %s:\n",
1687 vtysh_client
[i
].name
);
1688 ret
= vtysh_client_execute (&vtysh_client
[i
], line
, stdout
);
1689 fprintf (stdout
,"\n");
1697 vtysh_log_stdout_cmd
,
1700 "Set stdout logging level\n")
1706 vtysh_log_stdout_level
,
1707 vtysh_log_stdout_level_cmd
,
1708 "log stdout "LOG_LEVELS
,
1710 "Set stdout logging level\n"
1717 no_vtysh_log_stdout
,
1718 no_vtysh_log_stdout_cmd
,
1719 "no log stdout [LEVEL]",
1722 "Cancel logging to stdout\n"
1731 "log file FILENAME",
1734 "Logging filename\n")
1740 vtysh_log_file_level
,
1741 vtysh_log_file_level_cmd
,
1742 "log file FILENAME "LOG_LEVELS
,
1745 "Logging filename\n"
1753 no_vtysh_log_file_cmd
,
1754 "no log file [FILENAME]",
1757 "Cancel logging to file\n"
1758 "Logging file name\n")
1763 ALIAS_SH (VTYSH_ALL
,
1765 no_vtysh_log_file_level_cmd
,
1766 "no log file FILENAME LEVEL",
1769 "Cancel logging to file\n"
1770 "Logging file name\n"
1775 vtysh_log_monitor_cmd
,
1778 "Set terminal line (monitor) logging level\n")
1784 vtysh_log_monitor_level
,
1785 vtysh_log_monitor_level_cmd
,
1786 "log monitor "LOG_LEVELS
,
1788 "Set terminal line (monitor) logging level\n"
1795 no_vtysh_log_monitor
,
1796 no_vtysh_log_monitor_cmd
,
1797 "no log monitor [LEVEL]",
1800 "Disable terminal line (monitor) logging\n"
1808 vtysh_log_syslog_cmd
,
1811 "Set syslog logging level\n")
1817 vtysh_log_syslog_level
,
1818 vtysh_log_syslog_level_cmd
,
1819 "log syslog "LOG_LEVELS
,
1821 "Set syslog logging level\n"
1828 no_vtysh_log_syslog
,
1829 no_vtysh_log_syslog_cmd
,
1830 "no log syslog [LEVEL]",
1833 "Cancel logging to syslog\n"
1841 vtysh_log_facility_cmd
,
1842 "log facility "LOG_FACILITIES
,
1844 "Facility parameter for syslog messages\n"
1852 no_vtysh_log_facility
,
1853 no_vtysh_log_facility_cmd
,
1854 "no log facility [FACILITY]",
1857 "Reset syslog facility to default (daemon)\n"
1858 "Syslog facility\n")
1864 DEFUNSH_DEPRECATED (VTYSH_ALL
,
1867 "log trap "LOG_LEVELS
,
1869 "(Deprecated) Set logging level and default for all destinations\n"
1876 DEFUNSH_DEPRECATED (VTYSH_ALL
,
1878 no_vtysh_log_trap_cmd
,
1879 "no log trap [LEVEL]",
1882 "Permit all logging information\n"
1889 vtysh_log_record_priority
,
1890 vtysh_log_record_priority_cmd
,
1891 "log record-priority",
1893 "Log the priority of the message within the message\n")
1899 no_vtysh_log_record_priority
,
1900 no_vtysh_log_record_priority_cmd
,
1901 "no log record-priority",
1904 "Do not log the priority of the message within the message\n")
1910 vtysh_log_timestamp_precision
,
1911 vtysh_log_timestamp_precision_cmd
,
1912 "log timestamp precision <0-6>",
1914 "Timestamp configuration\n"
1915 "Set the timestamp precision\n"
1916 "Number of subsecond digits\n")
1922 no_vtysh_log_timestamp_precision
,
1923 no_vtysh_log_timestamp_precision_cmd
,
1924 "no log timestamp precision",
1927 "Timestamp configuration\n"
1928 "Reset the timestamp precision to the default value of 0\n")
1934 vtysh_service_password_encrypt
,
1935 vtysh_service_password_encrypt_cmd
,
1936 "service password-encryption",
1937 "Set up miscellaneous service\n"
1938 "Enable encrypted passwords\n")
1944 no_vtysh_service_password_encrypt
,
1945 no_vtysh_service_password_encrypt_cmd
,
1946 "no service password-encryption",
1948 "Set up miscellaneous service\n"
1949 "Enable encrypted passwords\n")
1955 vtysh_config_password
,
1957 "password (8|) WORD",
1958 "Assign the terminal connection password\n"
1959 "Specifies a HIDDEN password will follow\n"
1961 "The HIDDEN line password string\n")
1967 vtysh_password_text
,
1968 vtysh_password_text_cmd
,
1970 "Assign the terminal connection password\n"
1971 "The UNENCRYPTED (cleartext) line password\n")
1977 vtysh_config_enable_password
,
1978 vtysh_enable_password_cmd
,
1979 "enable password (8|) WORD",
1980 "Modify enable password parameters\n"
1981 "Assign the privileged level password\n"
1982 "Specifies a HIDDEN password will follow\n"
1984 "The HIDDEN 'enable' password string\n")
1990 vtysh_enable_password_text
,
1991 vtysh_enable_password_text_cmd
,
1992 "enable password LINE",
1993 "Modify enable password parameters\n"
1994 "Assign the privileged level password\n"
1995 "The UNENCRYPTED (cleartext) 'enable' password\n")
2001 no_vtysh_config_enable_password
,
2002 no_vtysh_enable_password_cmd
,
2003 "no enable password",
2005 "Modify enable password parameters\n"
2006 "Assign the privileged level password\n")
2011 DEFUN (vtysh_write_terminal
,
2012 vtysh_write_terminal_cmd
,
2014 "Write running configuration to memory, network, or terminal\n"
2015 "Write to terminal\n")
2018 char line
[] = "write terminal\n";
2021 if (vtysh_pager_name
)
2023 fp
= popen (vtysh_pager_name
, "w");
2033 vty_out (vty
, "Building configuration...%s", VTY_NEWLINE
);
2034 vty_out (vty
, "%sCurrent configuration:%s", VTY_NEWLINE
,
2036 vty_out (vty
, "!%s", VTY_NEWLINE
);
2038 for (i
= 0; i
< array_size(vtysh_client
); i
++)
2039 vtysh_client_config (&vtysh_client
[i
], line
);
2041 /* Integrate vtysh specific configuration. */
2042 vtysh_config_write ();
2044 vtysh_config_dump (fp
);
2046 if (vtysh_pager_name
&& fp
)
2049 if (pclose (fp
) == -1)
2057 vty_out (vty
, "end%s", VTY_NEWLINE
);
2062 DEFUN (vtysh_write_terminal_daemon
,
2063 vtysh_write_terminal_daemon_cmd
,
2064 "write terminal (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd)",
2065 "Write running configuration to memory, network, or terminal\n"
2066 "Write to terminal\n"
2067 "For the zebra daemon\n"
2068 "For the rip daemon\n"
2069 "For the ripng daemon\n"
2070 "For the ospf daemon\n"
2071 "For the ospfv6 daemon\n"
2072 "For the bgp daemon\n"
2073 "For the isis daemon\n")
2076 int ret
= CMD_SUCCESS
;
2078 for (i
= 0; i
< array_size(vtysh_client
); i
++)
2080 if (begins_with(vtysh_client
[i
].name
, argv
[0]))
2084 ret
= vtysh_client_execute(&vtysh_client
[i
], "show running-config\n", stdout
);
2089 DEFUN (vtysh_integrated_config
,
2090 vtysh_integrated_config_cmd
,
2091 "service integrated-vtysh-config",
2092 "Set up miscellaneous service\n"
2093 "Write configuration into integrated file\n")
2095 vtysh_writeconfig_integrated
= 1;
2099 DEFUN (no_vtysh_integrated_config
,
2100 no_vtysh_integrated_config_cmd
,
2101 "no service integrated-vtysh-config",
2103 "Set up miscellaneous service\n"
2104 "Write configuration into integrated file\n")
2106 vtysh_writeconfig_integrated
= 0;
2111 backup_config_file (const char *fbackup
)
2113 char *integrate_sav
= NULL
;
2115 integrate_sav
= malloc (strlen (fbackup
) +
2116 strlen (CONF_BACKUP_EXT
) + 1);
2117 strcpy (integrate_sav
, fbackup
);
2118 strcat (integrate_sav
, CONF_BACKUP_EXT
);
2120 /* Move current configuration file to backup config file. */
2121 unlink (integrate_sav
);
2122 rename (fbackup
, integrate_sav
);
2123 free (integrate_sav
);
2127 write_config_integrated(void)
2130 char line
[] = "write terminal\n";
2133 fprintf (stdout
,"Building Configuration...\n");
2135 backup_config_file(integrate_default
);
2136 backup_config_file(host
.config
);
2138 fp
= fopen (integrate_default
, "w");
2141 fprintf (stdout
,"%% Can't open configuration file %s due to '%s'\n",
2142 integrate_default
, safe_strerror(errno
));
2146 fp1
= fopen (host
.config
, "w");
2149 fprintf (stdout
,"%% Can't open configuration file %s due to '%s'\n",
2150 host
.config
, safe_strerror(errno
));
2154 vtysh_config_write ();
2155 vtysh_config_dump (fp1
);
2158 for (i
= 0; i
< array_size(vtysh_client
); i
++)
2159 vtysh_client_config (&vtysh_client
[i
], line
);
2161 vtysh_config_write ();
2162 vtysh_config_dump (fp
);
2166 if (chmod (integrate_default
, CONFIGFILE_MASK
) != 0)
2168 fprintf (stdout
,"%% Can't chmod configuration file %s: %s\n",
2169 integrate_default
, safe_strerror(errno
));
2173 if (chmod (host
.config
, CONFIGFILE_MASK
) != 0)
2175 fprintf (stdout
,"%% Can't chmod configuration file %s: %s (%d)\n",
2176 integrate_default
, safe_strerror(errno
), errno
);
2179 fprintf(stdout
,"Integrated configuration saved to %s\n",integrate_default
);
2181 fprintf (stdout
,"[OK]\n");
2186 DEFUN (vtysh_write_memory
,
2187 vtysh_write_memory_cmd
,
2189 "Write running configuration to memory, network, or terminal\n"
2190 "Write configuration to the file (same as write file)\n")
2192 int ret
= CMD_SUCCESS
;
2193 char line
[] = "write memory\n";
2197 /* If integrated Quagga.conf explicitely set. */
2198 if (vtysh_writeconfig_integrated
)
2199 return write_config_integrated();
2201 backup_config_file(integrate_default
);
2203 fprintf (stdout
,"Building Configuration...\n");
2205 for (i
= 0; i
< array_size(vtysh_client
); i
++)
2206 ret
= vtysh_client_execute (&vtysh_client
[i
], line
, stdout
);
2209 fp
= fopen(host
.config
, "w");
2212 fprintf (stdout
,"%% Can't open configuration file %s due to '%s'\n",
2213 host
.config
, safe_strerror(errno
));
2217 vtysh_config_write ();
2218 vtysh_config_dump (fp
);
2222 if (chmod (host
.config
, CONFIGFILE_MASK
) != 0)
2224 fprintf (stdout
,"%% Can't chmod configuration file %s: %s\n",
2225 integrate_default
, safe_strerror(errno
));
2229 fprintf (stdout
,"[OK]\n");
2234 ALIAS (vtysh_write_memory
,
2235 vtysh_copy_runningconfig_startupconfig_cmd
,
2236 "copy running-config startup-config",
2237 "Copy from one file to another\n"
2238 "Copy from current system configuration\n"
2239 "Copy to startup configuration\n")
2241 ALIAS (vtysh_write_memory
,
2242 vtysh_write_file_cmd
,
2244 "Write running configuration to memory, network, or terminal\n"
2245 "Write configuration to the file (same as write memory)\n")
2247 ALIAS (vtysh_write_memory
,
2250 "Write running configuration to memory, network, or terminal\n")
2252 ALIAS (vtysh_write_terminal
,
2253 vtysh_show_running_config_cmd
,
2254 "show running-config",
2256 "Current operating configuration\n")
2258 ALIAS (vtysh_write_terminal_daemon
,
2259 vtysh_show_running_config_daemon_cmd
,
2260 "show running-config (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd)",
2262 "Current operating configuration\n"
2263 "For the zebra daemon\n"
2264 "For the rip daemon\n"
2265 "For the ripng daemon\n"
2266 "For the ospf daemon\n"
2267 "For the ospfv6 daemon\n"
2268 "For the bgp daemon\n"
2269 "For the isis daemon\n")
2271 DEFUN (vtysh_terminal_length
,
2272 vtysh_terminal_length_cmd
,
2273 "terminal length <0-512>",
2274 "Set terminal line parameters\n"
2275 "Set number of lines on a screen\n"
2276 "Number of lines on screen (0 for no pausing)\n")
2279 char *endptr
= NULL
;
2280 char default_pager
[10];
2282 lines
= strtol (argv
[0], &endptr
, 10);
2283 if (lines
< 0 || lines
> 512 || *endptr
!= '\0')
2285 vty_out (vty
, "length is malformed%s", VTY_NEWLINE
);
2289 if (vtysh_pager_name
)
2291 free (vtysh_pager_name
);
2292 vtysh_pager_name
= NULL
;
2297 snprintf(default_pager
, 10, "more -%i", lines
);
2298 vtysh_pager_name
= strdup (default_pager
);
2304 DEFUN (vtysh_terminal_no_length
,
2305 vtysh_terminal_no_length_cmd
,
2306 "terminal no length",
2307 "Set terminal line parameters\n"
2309 "Set number of lines on a screen\n")
2311 if (vtysh_pager_name
)
2313 free (vtysh_pager_name
);
2314 vtysh_pager_name
= NULL
;
2321 DEFUN (vtysh_show_daemons
,
2322 vtysh_show_daemons_cmd
,
2325 "Show list of running daemons\n")
2329 for (i
= 0; i
< array_size(vtysh_client
); i
++)
2330 if ( vtysh_client
[i
].fd
>= 0 )
2331 vty_out(vty
, " %s", vtysh_client
[i
].name
);
2332 vty_out(vty
, "%s", VTY_NEWLINE
);
2337 /* Execute command in child process. */
2339 execute_command (const char *command
, int argc
, const char *arg1
,
2350 /* Failure of fork(). */
2351 fprintf (stderr
, "Can't fork: %s\n", safe_strerror (errno
));
2356 /* This is child process. */
2360 execlp (command
, command
, (const char *)NULL
);
2363 execlp (command
, command
, arg1
, (const char *)NULL
);
2366 execlp (command
, command
, arg1
, arg2
, (const char *)NULL
);
2370 /* When execlp suceed, this part is not executed. */
2371 fprintf (stderr
, "Can't execute %s: %s\n", command
, safe_strerror (errno
));
2376 /* This is parent. */
2378 wait4 (pid
, &status
, 0, NULL
);
2386 "Send echo messages\n"
2387 "Ping destination address or hostname\n")
2389 execute_command ("ping", 1, argv
[0], NULL
);
2396 "Send echo messages\n"
2398 "Ping destination address or hostname\n")
2400 DEFUN (vtysh_traceroute
,
2401 vtysh_traceroute_cmd
,
2403 "Trace route to destination\n"
2404 "Trace route to destination address or hostname\n")
2406 execute_command ("traceroute", 1, argv
[0], NULL
);
2410 ALIAS (vtysh_traceroute
,
2411 vtysh_traceroute_ip_cmd
,
2412 "traceroute ip WORD",
2413 "Trace route to destination\n"
2415 "Trace route to destination address or hostname\n")
2421 "Send echo messages\n"
2423 "Ping destination address or hostname\n")
2425 execute_command ("ping6", 1, argv
[0], NULL
);
2429 DEFUN (vtysh_traceroute6
,
2430 vtysh_traceroute6_cmd
,
2431 "traceroute ipv6 WORD",
2432 "Trace route to destination\n"
2434 "Trace route to destination address or hostname\n")
2436 execute_command ("traceroute6", 1, argv
[0], NULL
);
2441 #if defined(HAVE_SHELL_ACCESS)
2442 DEFUN (vtysh_telnet
,
2445 "Open a telnet connection\n"
2446 "IP address or hostname of a remote system\n")
2448 execute_command ("telnet", 1, argv
[0], NULL
);
2452 DEFUN (vtysh_telnet_port
,
2453 vtysh_telnet_port_cmd
,
2455 "Open a telnet connection\n"
2456 "IP address or hostname of a remote system\n"
2457 "TCP Port number\n")
2459 execute_command ("telnet", 2, argv
[0], argv
[1]);
2466 "Open an ssh connection\n"
2469 execute_command ("ssh", 1, argv
[0], NULL
);
2473 DEFUN (vtysh_start_shell
,
2474 vtysh_start_shell_cmd
,
2476 "Start UNIX shell\n")
2478 execute_command ("sh", 0, NULL
, NULL
);
2482 DEFUN (vtysh_start_bash
,
2483 vtysh_start_bash_cmd
,
2485 "Start UNIX shell\n"
2488 execute_command ("bash", 0, NULL
, NULL
);
2492 DEFUN (vtysh_start_zsh
,
2493 vtysh_start_zsh_cmd
,
2495 "Start UNIX shell\n"
2498 execute_command ("zsh", 0, NULL
, NULL
);
2504 vtysh_install_default (enum node_type node
)
2506 install_element (node
, &config_list_cmd
);
2509 /* Making connection to protocol daemon. */
2511 vtysh_connect (struct vtysh_client
*vclient
)
2515 struct sockaddr_un addr
;
2518 /* Stat socket to see if we have permission to access it. */
2519 ret
= stat (vclient
->path
, &s_stat
);
2520 if (ret
< 0 && errno
!= ENOENT
)
2522 fprintf (stderr
, "vtysh_connect(%s): stat = %s\n",
2523 vclient
->path
, safe_strerror(errno
));
2529 if (! S_ISSOCK(s_stat
.st_mode
))
2531 fprintf (stderr
, "vtysh_connect(%s): Not a socket\n",
2538 sock
= socket (AF_UNIX
, SOCK_STREAM
, 0);
2542 fprintf(stderr
, "vtysh_connect(%s): socket = %s\n", vclient
->path
,
2543 safe_strerror(errno
));
2548 memset (&addr
, 0, sizeof (struct sockaddr_un
));
2549 addr
.sun_family
= AF_UNIX
;
2550 strncpy (addr
.sun_path
, vclient
->path
, strlen (vclient
->path
));
2551 #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
2552 len
= addr
.sun_len
= SUN_LEN(&addr
);
2554 len
= sizeof (addr
.sun_family
) + strlen (addr
.sun_path
);
2555 #endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
2557 ret
= connect (sock
, (struct sockaddr
*) &addr
, len
);
2561 fprintf(stderr
, "vtysh_connect(%s): connect = %s\n", vclient
->path
,
2562 safe_strerror(errno
));
2572 /* Return true if str ends with suffix, else return false */
2574 ends_with(const char *str
, const char *suffix
)
2576 if (!str
|| !suffix
)
2578 size_t lenstr
= strlen(str
);
2579 size_t lensuffix
= strlen(suffix
);
2580 if (lensuffix
> lenstr
)
2582 return strncmp(str
+ lenstr
- lensuffix
, suffix
, lensuffix
) == 0;
2586 vtysh_client_sorted_insert (struct vtysh_client
*head_client
,
2587 struct vtysh_client
*client
)
2589 struct vtysh_client
*prev_node
, *current_node
;
2591 prev_node
= head_client
;
2592 current_node
= head_client
->next
;
2593 while (current_node
)
2595 if (strcmp(current_node
->path
, client
->path
) > 0)
2598 prev_node
= current_node
;
2599 current_node
= current_node
->next
;
2601 client
->next
= current_node
;
2602 prev_node
->next
= client
;
2605 #define MAXIMUM_INSTANCES 10
2608 vtysh_update_all_insances(struct vtysh_client
* head_client
)
2610 struct vtysh_client
*client
;
2613 struct dirent
*file
;
2616 if (head_client
->flag
!= VTYSH_OSPFD
) return;
2618 /* ls /var/run/quagga/ and look for all files ending in .vty */
2619 dir
= opendir("/var/run/quagga/");
2622 while ((file
= readdir(dir
)) != NULL
)
2624 if (begins_with(file
->d_name
, "ospfd-") && ends_with(file
->d_name
, ".vty"))
2626 if (n
== MAXIMUM_INSTANCES
)
2629 "Parsing /var/run/quagga/, client limit(%d) reached!\n", n
);
2632 client
= (struct vtysh_client
*) malloc(sizeof(struct vtysh_client
));
2634 client
->name
= "ospfd";
2635 client
->flag
= VTYSH_OSPFD
;
2636 ptr
= (char *) malloc(100);
2637 sprintf(ptr
, "/var/run/quagga/%s", file
->d_name
);
2638 client
->path
= (const char *)ptr
;
2639 client
->next
= NULL
;
2640 vtysh_client_sorted_insert(head_client
, client
);
2649 vtysh_connect_all_instances (struct vtysh_client
*head_client
)
2651 struct vtysh_client
*client
;
2654 vtysh_update_all_insances(head_client
);
2656 client
= head_client
->next
;
2659 if (vtysh_connect(client
) == 0)
2661 client
= client
->next
;
2668 vtysh_connect_all(const char *daemon_name
)
2674 for (i
= 0; i
< array_size(vtysh_client
); i
++)
2676 if (!daemon_name
|| !strcmp(daemon_name
, vtysh_client
[i
].name
))
2679 if (vtysh_connect(&vtysh_client
[i
]) == 0)
2681 /* We need direct access to ripd in vtysh_exit_ripd_only. */
2682 if (vtysh_client
[i
].flag
== VTYSH_RIPD
)
2683 ripd_client
= &vtysh_client
[i
];
2685 rc
+= vtysh_connect_all_instances(&vtysh_client
[i
]);
2689 fprintf(stderr
, "Error: no daemons match name %s!\n", daemon_name
);
2693 /* To disable readline's filename completion. */
2695 vtysh_completion_entry_function (const char *ignore
, int invoking_key
)
2701 vtysh_readline_init (void)
2703 /* readline related settings. */
2704 rl_bind_key ('?', (rl_command_func_t
*) vtysh_rl_describe
);
2705 rl_completion_entry_function
= vtysh_completion_entry_function
;
2706 rl_attempted_completion_function
= (rl_completion_func_t
*)new_completion
;
2712 static struct utsname names
;
2713 static char buf
[100];
2714 const char*hostname
;
2715 extern struct host host
;
2717 hostname
= host
.name
;
2721 if (!names
.nodename
[0])
2723 hostname
= names
.nodename
;
2726 snprintf (buf
, sizeof buf
, cmd_prompt (vty
->node
), hostname
);
2732 vtysh_init_vty (void)
2734 /* Make vty structure. */
2736 vty
->type
= VTY_SHELL
;
2737 vty
->node
= VIEW_NODE
;
2739 /* Initialize commands. */
2742 /* Install nodes. */
2743 install_node (&bgp_node
, NULL
);
2744 install_node (&rip_node
, NULL
);
2745 install_node (&interface_node
, NULL
);
2746 install_node (&vrf_node
, NULL
);
2747 install_node (&rmap_node
, NULL
);
2748 install_node (&zebra_node
, NULL
);
2749 install_node (&bgp_vpnv4_node
, NULL
);
2750 install_node (&bgp_ipv4_node
, NULL
);
2751 install_node (&bgp_ipv4m_node
, NULL
);
2752 /* #ifdef HAVE_IPV6 */
2753 install_node (&bgp_ipv6_node
, NULL
);
2754 install_node (&bgp_ipv6m_node
, NULL
);
2756 install_node (&ospf_node
, NULL
);
2757 /* #ifdef HAVE_IPV6 */
2758 install_node (&ripng_node
, NULL
);
2759 install_node (&ospf6_node
, NULL
);
2761 install_node (&keychain_node
, NULL
);
2762 install_node (&keychain_key_node
, NULL
);
2763 install_node (&isis_node
, NULL
);
2764 install_node (&vty_node
, NULL
);
2766 vtysh_install_default (VIEW_NODE
);
2767 vtysh_install_default (ENABLE_NODE
);
2768 vtysh_install_default (CONFIG_NODE
);
2769 vtysh_install_default (BGP_NODE
);
2770 vtysh_install_default (RIP_NODE
);
2771 vtysh_install_default (INTERFACE_NODE
);
2772 vtysh_install_default (VRF_NODE
);
2773 vtysh_install_default (RMAP_NODE
);
2774 vtysh_install_default (ZEBRA_NODE
);
2775 vtysh_install_default (BGP_VPNV4_NODE
);
2776 vtysh_install_default (BGP_IPV4_NODE
);
2777 vtysh_install_default (BGP_IPV4M_NODE
);
2778 vtysh_install_default (BGP_IPV6_NODE
);
2779 vtysh_install_default (BGP_IPV6M_NODE
);
2780 vtysh_install_default (OSPF_NODE
);
2781 vtysh_install_default (RIPNG_NODE
);
2782 vtysh_install_default (OSPF6_NODE
);
2783 vtysh_install_default (ISIS_NODE
);
2784 vtysh_install_default (KEYCHAIN_NODE
);
2785 vtysh_install_default (KEYCHAIN_KEY_NODE
);
2786 vtysh_install_default (VTY_NODE
);
2788 install_element (VIEW_NODE
, &vtysh_enable_cmd
);
2789 install_element (ENABLE_NODE
, &vtysh_config_terminal_cmd
);
2790 install_element (ENABLE_NODE
, &vtysh_disable_cmd
);
2792 /* "exit" command. */
2793 install_element (VIEW_NODE
, &vtysh_exit_all_cmd
);
2794 install_element (VIEW_NODE
, &vtysh_quit_all_cmd
);
2795 install_element (CONFIG_NODE
, &vtysh_exit_all_cmd
);
2796 /* install_element (CONFIG_NODE, &vtysh_quit_all_cmd); */
2797 install_element (ENABLE_NODE
, &vtysh_exit_all_cmd
);
2798 install_element (ENABLE_NODE
, &vtysh_quit_all_cmd
);
2799 install_element (RIP_NODE
, &vtysh_exit_ripd_cmd
);
2800 install_element (RIP_NODE
, &vtysh_quit_ripd_cmd
);
2801 install_element (RIPNG_NODE
, &vtysh_exit_ripngd_cmd
);
2802 install_element (RIPNG_NODE
, &vtysh_quit_ripngd_cmd
);
2803 install_element (OSPF_NODE
, &vtysh_exit_ospfd_cmd
);
2804 install_element (OSPF_NODE
, &vtysh_quit_ospfd_cmd
);
2805 install_element (OSPF6_NODE
, &vtysh_exit_ospf6d_cmd
);
2806 install_element (OSPF6_NODE
, &vtysh_quit_ospf6d_cmd
);
2807 install_element (BGP_NODE
, &vtysh_exit_bgpd_cmd
);
2808 install_element (BGP_NODE
, &vtysh_quit_bgpd_cmd
);
2809 install_element (BGP_VPNV4_NODE
, &vtysh_exit_bgpd_cmd
);
2810 install_element (BGP_VPNV4_NODE
, &vtysh_quit_bgpd_cmd
);
2811 install_element (BGP_IPV4_NODE
, &vtysh_exit_bgpd_cmd
);
2812 install_element (BGP_IPV4_NODE
, &vtysh_quit_bgpd_cmd
);
2813 install_element (BGP_IPV4M_NODE
, &vtysh_exit_bgpd_cmd
);
2814 install_element (BGP_IPV4M_NODE
, &vtysh_quit_bgpd_cmd
);
2815 install_element (BGP_IPV6_NODE
, &vtysh_exit_bgpd_cmd
);
2816 install_element (BGP_IPV6_NODE
, &vtysh_quit_bgpd_cmd
);
2817 install_element (BGP_IPV6M_NODE
, &vtysh_exit_bgpd_cmd
);
2818 install_element (BGP_IPV6M_NODE
, &vtysh_quit_bgpd_cmd
);
2819 install_element (ISIS_NODE
, &vtysh_exit_isisd_cmd
);
2820 install_element (ISIS_NODE
, &vtysh_quit_isisd_cmd
);
2821 install_element (KEYCHAIN_NODE
, &vtysh_exit_ripd_cmd
);
2822 install_element (KEYCHAIN_NODE
, &vtysh_quit_ripd_cmd
);
2823 install_element (KEYCHAIN_KEY_NODE
, &vtysh_exit_ripd_cmd
);
2824 install_element (KEYCHAIN_KEY_NODE
, &vtysh_quit_ripd_cmd
);
2825 install_element (RMAP_NODE
, &vtysh_exit_rmap_cmd
);
2826 install_element (RMAP_NODE
, &vtysh_quit_rmap_cmd
);
2827 install_element (VTY_NODE
, &vtysh_exit_line_vty_cmd
);
2828 install_element (VTY_NODE
, &vtysh_quit_line_vty_cmd
);
2830 /* "end" command. */
2831 install_element (CONFIG_NODE
, &vtysh_end_all_cmd
);
2832 install_element (ENABLE_NODE
, &vtysh_end_all_cmd
);
2833 install_element (RIP_NODE
, &vtysh_end_all_cmd
);
2834 install_element (RIPNG_NODE
, &vtysh_end_all_cmd
);
2835 install_element (OSPF_NODE
, &vtysh_end_all_cmd
);
2836 install_element (OSPF6_NODE
, &vtysh_end_all_cmd
);
2837 install_element (BGP_NODE
, &vtysh_end_all_cmd
);
2838 install_element (BGP_IPV4_NODE
, &vtysh_end_all_cmd
);
2839 install_element (BGP_IPV4M_NODE
, &vtysh_end_all_cmd
);
2840 install_element (BGP_VPNV4_NODE
, &vtysh_end_all_cmd
);
2841 install_element (BGP_IPV6_NODE
, &vtysh_end_all_cmd
);
2842 install_element (BGP_IPV6M_NODE
, &vtysh_end_all_cmd
);
2843 install_element (ISIS_NODE
, &vtysh_end_all_cmd
);
2844 install_element (KEYCHAIN_NODE
, &vtysh_end_all_cmd
);
2845 install_element (KEYCHAIN_KEY_NODE
, &vtysh_end_all_cmd
);
2846 install_element (RMAP_NODE
, &vtysh_end_all_cmd
);
2847 install_element (VTY_NODE
, &vtysh_end_all_cmd
);
2849 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
2850 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
2851 install_element (INTERFACE_NODE
, &vtysh_end_all_cmd
);
2852 install_element (INTERFACE_NODE
, &vtysh_exit_interface_cmd
);
2853 install_element (INTERFACE_NODE
, &vtysh_quit_interface_cmd
);
2855 install_element (VRF_NODE
, &vtysh_end_all_cmd
);
2856 install_element (VRF_NODE
, &vtysh_exit_vrf_cmd
);
2857 install_element (VRF_NODE
, &vtysh_quit_vrf_cmd
);
2859 install_element (CONFIG_NODE
, &router_rip_cmd
);
2861 install_element (CONFIG_NODE
, &router_ripng_cmd
);
2863 install_element (CONFIG_NODE
, &router_ospf_cmd
);
2864 install_element (CONFIG_NODE
, &router_ospf_instance_cmd
);
2866 install_element (CONFIG_NODE
, &router_ospf6_cmd
);
2868 install_element (CONFIG_NODE
, &router_isis_cmd
);
2869 install_element (CONFIG_NODE
, &router_bgp_cmd
);
2870 install_element (CONFIG_NODE
, &router_bgp_asn_cmd
);
2871 install_element (CONFIG_NODE
, &router_bgp_view_cmd
);
2872 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
2873 install_element (BGP_NODE
, &address_family_vpnv4_unicast_cmd
);
2874 install_element (BGP_NODE
, &address_family_ipv4_unicast_cmd
);
2875 install_element (BGP_NODE
, &address_family_ipv4_multicast_cmd
);
2877 install_element (BGP_NODE
, &address_family_ipv6_cmd
);
2878 install_element (BGP_NODE
, &address_family_ipv6_unicast_cmd
);
2879 install_element (BGP_NODE
, &address_family_ipv6_multicast_cmd
);
2881 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
2882 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
2883 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
2884 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
2885 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
2886 install_element (CONFIG_NODE
, &key_chain_cmd
);
2887 install_element (CONFIG_NODE
, &route_map_cmd
);
2888 install_element (CONFIG_NODE
, &vtysh_line_vty_cmd
);
2889 install_element (KEYCHAIN_NODE
, &key_cmd
);
2890 install_element (KEYCHAIN_NODE
, &key_chain_cmd
);
2891 install_element (KEYCHAIN_KEY_NODE
, &key_chain_cmd
);
2892 install_element (CONFIG_NODE
, &vtysh_interface_cmd
);
2893 install_element (CONFIG_NODE
, &vtysh_no_interface_cmd
);
2894 install_element (CONFIG_NODE
, &vtysh_interface_vrf_cmd
);
2895 install_element (CONFIG_NODE
, &vtysh_no_interface_vrf_cmd
);
2896 install_element (ENABLE_NODE
, &vtysh_show_running_config_cmd
);
2897 install_element (ENABLE_NODE
, &vtysh_show_running_config_daemon_cmd
);
2898 install_element (ENABLE_NODE
, &vtysh_copy_runningconfig_startupconfig_cmd
);
2899 install_element (ENABLE_NODE
, &vtysh_write_file_cmd
);
2900 install_element (ENABLE_NODE
, &vtysh_write_cmd
);
2902 install_element (CONFIG_NODE
, &vtysh_vrf_cmd
);
2903 install_element (CONFIG_NODE
, &vtysh_no_vrf_cmd
);
2905 /* "write terminal" command. */
2906 install_element (ENABLE_NODE
, &vtysh_write_terminal_cmd
);
2907 install_element (ENABLE_NODE
, &vtysh_write_terminal_daemon_cmd
);
2909 install_element (CONFIG_NODE
, &vtysh_integrated_config_cmd
);
2910 install_element (CONFIG_NODE
, &no_vtysh_integrated_config_cmd
);
2912 /* "write memory" command. */
2913 install_element (ENABLE_NODE
, &vtysh_write_memory_cmd
);
2915 install_element (VIEW_NODE
, &vtysh_terminal_length_cmd
);
2916 install_element (ENABLE_NODE
, &vtysh_terminal_length_cmd
);
2917 install_element (VIEW_NODE
, &vtysh_terminal_no_length_cmd
);
2918 install_element (ENABLE_NODE
, &vtysh_terminal_no_length_cmd
);
2919 install_element (VIEW_NODE
, &vtysh_show_daemons_cmd
);
2920 install_element (ENABLE_NODE
, &vtysh_show_daemons_cmd
);
2922 install_element (VIEW_NODE
, &vtysh_ping_cmd
);
2923 install_element (VIEW_NODE
, &vtysh_ping_ip_cmd
);
2924 install_element (VIEW_NODE
, &vtysh_traceroute_cmd
);
2925 install_element (VIEW_NODE
, &vtysh_traceroute_ip_cmd
);
2927 install_element (VIEW_NODE
, &vtysh_ping6_cmd
);
2928 install_element (VIEW_NODE
, &vtysh_traceroute6_cmd
);
2930 #if defined(HAVE_SHELL_ACCESS)
2931 install_element (VIEW_NODE
, &vtysh_telnet_cmd
);
2932 install_element (VIEW_NODE
, &vtysh_telnet_port_cmd
);
2933 install_element (VIEW_NODE
, &vtysh_ssh_cmd
);
2935 install_element (ENABLE_NODE
, &vtysh_ping_cmd
);
2936 install_element (ENABLE_NODE
, &vtysh_ping_ip_cmd
);
2937 install_element (ENABLE_NODE
, &vtysh_traceroute_cmd
);
2938 install_element (ENABLE_NODE
, &vtysh_traceroute_ip_cmd
);
2940 install_element (ENABLE_NODE
, &vtysh_ping6_cmd
);
2941 install_element (ENABLE_NODE
, &vtysh_traceroute6_cmd
);
2943 #if defined(HAVE_SHELL_ACCESS)
2944 install_element (ENABLE_NODE
, &vtysh_telnet_cmd
);
2945 install_element (ENABLE_NODE
, &vtysh_telnet_port_cmd
);
2946 install_element (ENABLE_NODE
, &vtysh_ssh_cmd
);
2947 install_element (ENABLE_NODE
, &vtysh_start_shell_cmd
);
2948 install_element (ENABLE_NODE
, &vtysh_start_bash_cmd
);
2949 install_element (ENABLE_NODE
, &vtysh_start_zsh_cmd
);
2952 install_element (VIEW_NODE
, &vtysh_show_memory_cmd
);
2953 install_element (ENABLE_NODE
, &vtysh_show_memory_cmd
);
2955 install_element (VIEW_NODE
, &vtysh_show_work_queues_cmd
);
2956 install_element (ENABLE_NODE
, &vtysh_show_work_queues_cmd
);
2957 install_element (ENABLE_NODE
, &vtysh_show_work_queues_daemon_cmd
);
2958 install_element (VIEW_NODE
, &vtysh_show_work_queues_daemon_cmd
);
2960 install_element (VIEW_NODE
, &vtysh_show_thread_cmd
);
2961 install_element (ENABLE_NODE
, &vtysh_show_thread_cmd
);
2964 install_element (ENABLE_NODE
, &vtysh_show_logging_cmd
);
2965 install_element (VIEW_NODE
, &vtysh_show_logging_cmd
);
2966 install_element (CONFIG_NODE
, &vtysh_log_stdout_cmd
);
2967 install_element (CONFIG_NODE
, &vtysh_log_stdout_level_cmd
);
2968 install_element (CONFIG_NODE
, &no_vtysh_log_stdout_cmd
);
2969 install_element (CONFIG_NODE
, &vtysh_log_file_cmd
);
2970 install_element (CONFIG_NODE
, &vtysh_log_file_level_cmd
);
2971 install_element (CONFIG_NODE
, &no_vtysh_log_file_cmd
);
2972 install_element (CONFIG_NODE
, &no_vtysh_log_file_level_cmd
);
2973 install_element (CONFIG_NODE
, &vtysh_log_monitor_cmd
);
2974 install_element (CONFIG_NODE
, &vtysh_log_monitor_level_cmd
);
2975 install_element (CONFIG_NODE
, &no_vtysh_log_monitor_cmd
);
2976 install_element (CONFIG_NODE
, &vtysh_log_syslog_cmd
);
2977 install_element (CONFIG_NODE
, &vtysh_log_syslog_level_cmd
);
2978 install_element (CONFIG_NODE
, &no_vtysh_log_syslog_cmd
);
2979 install_element (CONFIG_NODE
, &vtysh_log_trap_cmd
);
2980 install_element (CONFIG_NODE
, &no_vtysh_log_trap_cmd
);
2981 install_element (CONFIG_NODE
, &vtysh_log_facility_cmd
);
2982 install_element (CONFIG_NODE
, &no_vtysh_log_facility_cmd
);
2983 install_element (CONFIG_NODE
, &vtysh_log_record_priority_cmd
);
2984 install_element (CONFIG_NODE
, &no_vtysh_log_record_priority_cmd
);
2985 install_element (CONFIG_NODE
, &vtysh_log_timestamp_precision_cmd
);
2986 install_element (CONFIG_NODE
, &no_vtysh_log_timestamp_precision_cmd
);
2988 install_element (CONFIG_NODE
, &vtysh_service_password_encrypt_cmd
);
2989 install_element (CONFIG_NODE
, &no_vtysh_service_password_encrypt_cmd
);
2991 install_element (CONFIG_NODE
, &vtysh_password_cmd
);
2992 install_element (CONFIG_NODE
, &vtysh_password_text_cmd
);
2993 install_element (CONFIG_NODE
, &vtysh_enable_password_cmd
);
2994 install_element (CONFIG_NODE
, &vtysh_enable_password_text_cmd
);
2995 install_element (CONFIG_NODE
, &no_vtysh_enable_password_cmd
);