2002-12-13 21:15:29 +01:00
|
|
|
/* Virtual terminal interface shell.
|
|
|
|
* Copyright (C) 2000 Kunihiro Ishiguro
|
|
|
|
*
|
|
|
|
* This file is part of GNU Zebra.
|
|
|
|
*
|
|
|
|
* GNU Zebra is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* GNU Zebra is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
2017-05-13 10:25:29 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <readline/readline.h>
|
|
|
|
#include <readline/history.h>
|
|
|
|
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2015-03-04 07:07:01 +01:00
|
|
|
#include "linklist.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "command.h"
|
|
|
|
#include "memory.h"
|
2016-01-07 16:03:01 +01:00
|
|
|
#include "filter.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
#include "vtysh/vtysh.h"
|
2004-11-20 03:06:59 +01:00
|
|
|
#include "log.h"
|
2008-07-02 15:40:33 +02:00
|
|
|
#include "bgpd/bgp_vty.h"
|
2014-07-03 12:24:34 +02:00
|
|
|
#include "ns.h"
|
2015-05-22 11:40:00 +02:00
|
|
|
#include "vrf.h"
|
2016-11-13 09:48:56 +01:00
|
|
|
#include "libfrr.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-29 05:48:31 +02:00
|
|
|
DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy")
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Struct VTY. */
|
|
|
|
struct vty *vty;
|
|
|
|
|
|
|
|
/* VTY shell pager name. */
|
|
|
|
char *vtysh_pager_name = NULL;
|
|
|
|
|
|
|
|
/* VTY shell client structure. */
|
2017-07-17 14:03:14 +02:00
|
|
|
struct vtysh_client {
|
|
|
|
int fd;
|
|
|
|
const char *name;
|
|
|
|
int flag;
|
|
|
|
char path[MAXPATHLEN];
|
|
|
|
struct vtysh_client *next;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
struct vtysh_client vtysh_client[] = {
|
|
|
|
{.fd = -1, .name = "zebra", .flag = VTYSH_ZEBRA, .next = NULL},
|
|
|
|
{.fd = -1, .name = "ripd", .flag = VTYSH_RIPD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "ripngd", .flag = VTYSH_RIPNGD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "ospfd", .flag = VTYSH_OSPFD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "ospf6d", .flag = VTYSH_OSPF6D, .next = NULL},
|
|
|
|
{.fd = -1, .name = "ldpd", .flag = VTYSH_LDPD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "bgpd", .flag = VTYSH_BGPD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "isisd", .flag = VTYSH_ISISD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "pimd", .flag = VTYSH_PIMD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "nhrpd", .flag = VTYSH_NHRPD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "eigrpd", .flag = VTYSH_EIGRPD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .next = NULL},
|
|
|
|
{.fd = -1, .name = "watchfrr", .flag = VTYSH_WATCHFRR, .next = NULL},
|
2005-01-28 22:11:46 +01:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
enum vtysh_write_integrated vtysh_write_integrated =
|
|
|
|
WRITE_INTEGRATED_UNSPECIFIED;
|
2004-10-03 22:11:32 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static void vclient_close(struct vtysh_client *vclient)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vclient->fd >= 0) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"Warning: closing connection to %s because of an I/O error!\n",
|
|
|
|
vclient->name);
|
|
|
|
close(vclient->fd);
|
|
|
|
vclient->fd = -1;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2015-10-16 22:53:03 +02:00
|
|
|
/* Return true if str begins with prefix, else return false */
|
2017-07-17 14:03:14 +02:00
|
|
|
static int begins_with(const char *str, const char *prefix)
|
|
|
|
{
|
|
|
|
if (!str || !prefix)
|
|
|
|
return 0;
|
|
|
|
size_t lenstr = strlen(str);
|
|
|
|
size_t lenprefix = strlen(prefix);
|
|
|
|
if (lenprefix > lenstr)
|
|
|
|
return 0;
|
|
|
|
return strncmp(str, prefix, lenprefix) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vtysh_client_run(struct vtysh_client *vclient, const char *line,
|
|
|
|
FILE *fp, void (*callback)(void *, const char *),
|
|
|
|
void *cbarg)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
char stackbuf[4096];
|
|
|
|
char *buf = stackbuf;
|
|
|
|
size_t bufsz = sizeof(stackbuf);
|
|
|
|
char *bufvalid, *end = NULL;
|
|
|
|
char terminator[3] = {0, 0, 0};
|
|
|
|
|
|
|
|
if (vclient->fd < 0)
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
ret = write(vclient->fd, line, strlen(line) + 1);
|
|
|
|
if (ret <= 0)
|
|
|
|
goto out_err;
|
|
|
|
|
|
|
|
bufvalid = buf;
|
|
|
|
do {
|
|
|
|
ssize_t nread =
|
|
|
|
read(vclient->fd, bufvalid, buf + bufsz - bufvalid);
|
|
|
|
|
|
|
|
if (nread < 0 && (errno == EINTR || errno == EAGAIN))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (nread <= 0) {
|
|
|
|
fprintf(stderr, "vtysh: error reading from %s: %s (%d)",
|
|
|
|
vclient->name, safe_strerror(errno), errno);
|
|
|
|
goto out_err;
|
|
|
|
}
|
|
|
|
|
|
|
|
bufvalid += nread;
|
|
|
|
|
|
|
|
end = memmem(buf, bufvalid - buf, terminator,
|
|
|
|
sizeof(terminator));
|
|
|
|
if (end + sizeof(terminator) + 1 > bufvalid)
|
|
|
|
/* found \0\0\0 but return code hasn't been read yet */
|
|
|
|
end = NULL;
|
|
|
|
if (end)
|
|
|
|
ret = end[sizeof(terminator)];
|
|
|
|
|
|
|
|
while (bufvalid > buf && (end > buf || !end)) {
|
|
|
|
size_t textlen = (end ? end : bufvalid) - buf;
|
|
|
|
char *eol = memchr(buf, '\n', textlen);
|
|
|
|
if (eol)
|
|
|
|
/* line break */
|
|
|
|
*eol++ = '\0';
|
|
|
|
else if (end == buf)
|
|
|
|
/* no line break, end of input, no text left
|
|
|
|
* before end
|
|
|
|
* => don't insert an empty line at the end */
|
|
|
|
break;
|
|
|
|
else if (end)
|
|
|
|
/* no line break, end of input, but some text
|
|
|
|
* left */
|
|
|
|
eol = end;
|
|
|
|
else
|
|
|
|
/* continue reading */
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* eol is at a line end now, either \n => \0 or \0\0\0
|
|
|
|
*/
|
|
|
|
assert(eol && eol <= bufvalid);
|
|
|
|
|
|
|
|
if (fp) {
|
|
|
|
fputs(buf, fp);
|
|
|
|
fputc('\n', fp);
|
|
|
|
}
|
|
|
|
if (callback)
|
|
|
|
callback(cbarg, buf);
|
|
|
|
|
|
|
|
if (eol == end)
|
|
|
|
/* \n\0\0\0 */
|
|
|
|
break;
|
|
|
|
|
|
|
|
memmove(buf, eol, bufvalid - eol);
|
|
|
|
bufvalid -= eol - buf;
|
|
|
|
if (end)
|
|
|
|
end -= eol - buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bufvalid == buf + bufsz) {
|
|
|
|
char *new;
|
|
|
|
bufsz *= 2;
|
|
|
|
if (buf == stackbuf) {
|
|
|
|
new = XMALLOC(MTYPE_TMP, bufsz);
|
|
|
|
memcpy(new, stackbuf, sizeof(stackbuf));
|
|
|
|
} else
|
|
|
|
new = XREALLOC(MTYPE_TMP, buf, bufsz);
|
|
|
|
|
|
|
|
bufvalid = bufvalid - buf + new;
|
|
|
|
buf = new;
|
|
|
|
/* if end != NULL, we won't be reading more data... */
|
|
|
|
assert(end == NULL);
|
|
|
|
}
|
|
|
|
} while (!end);
|
|
|
|
goto out;
|
2016-10-12 17:05:51 +02:00
|
|
|
|
|
|
|
out_err:
|
2017-07-17 14:03:14 +02:00
|
|
|
vclient_close(vclient);
|
|
|
|
ret = CMD_SUCCESS;
|
2016-10-12 17:05:51 +02:00
|
|
|
out:
|
2017-07-17 14:03:14 +02:00
|
|
|
if (buf != stackbuf)
|
|
|
|
XFREE(MTYPE_TMP, buf);
|
|
|
|
return ret;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static int vtysh_client_run_all(struct vtysh_client *head_client,
|
|
|
|
const char *line, int continue_on_err, FILE *fp,
|
|
|
|
void (*callback)(void *, const char *),
|
|
|
|
void *cbarg)
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
struct vtysh_client *client;
|
|
|
|
int rc, rc_all = CMD_SUCCESS;
|
2017-08-04 01:34:17 +02:00
|
|
|
int correct_instance = 0, wrong_instance = 0;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (client = head_client; client; client = client->next) {
|
|
|
|
rc = vtysh_client_run(client, line, fp, callback, cbarg);
|
2017-08-04 01:34:17 +02:00
|
|
|
if (rc == CMD_NOT_MY_INSTANCE) {
|
|
|
|
wrong_instance++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
correct_instance++;
|
2017-07-17 14:03:14 +02:00
|
|
|
if (rc != CMD_SUCCESS) {
|
|
|
|
if (!continue_on_err)
|
|
|
|
return rc;
|
|
|
|
rc_all = rc;
|
|
|
|
}
|
|
|
|
}
|
2017-08-04 01:34:17 +02:00
|
|
|
if (wrong_instance && !correct_instance && fp) {
|
|
|
|
fprintf(fp,
|
2017-08-06 04:17:13 +02:00
|
|
|
"%% [%s]: command ignored as it targets an instance that is not running\n",
|
2017-08-04 01:34:17 +02:00
|
|
|
head_client->name);
|
2017-08-04 01:34:17 +02:00
|
|
|
rc_all = CMD_WARNING_CONFIG_FAILED;
|
2017-08-04 01:34:17 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
return rc_all;
|
2016-10-12 17:05:51 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static int vtysh_client_execute(struct vtysh_client *head_client,
|
|
|
|
const char *line, FILE *fp)
|
2016-10-12 17:05:51 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_client_run_all(head_client, line, 0, fp, NULL, NULL);
|
2016-10-12 17:05:51 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static void vtysh_client_config(struct vtysh_client *head_client, char *line)
|
2016-10-12 17:05:51 +02:00
|
|
|
{
|
2017-08-15 13:43:50 +02:00
|
|
|
/* watchfrr currently doesn't load any config, and has some hardcoded
|
|
|
|
* settings that show up in "show run". skip it here (for now at
|
|
|
|
* least) so we don't get that mangled up in config-write.
|
|
|
|
*/
|
|
|
|
if (head_client->flag == VTYSH_WATCHFRR)
|
|
|
|
return;
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vtysh_client_run_all(head_client, line, 1, NULL,
|
|
|
|
vtysh_config_parse_line, NULL);
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
void vtysh_pager_init(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
char *pager_defined;
|
2004-08-27 16:23:28 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
pager_defined = getenv("VTYSH_PAGER");
|
2004-08-27 16:23:28 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (pager_defined)
|
|
|
|
vtysh_pager_name = strdup(pager_defined);
|
|
|
|
else
|
|
|
|
vtysh_pager_name = strdup(VTYSH_PAGER);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Command execution over the vty interface. */
|
2017-07-17 14:03:14 +02:00
|
|
|
static int vtysh_execute_func(const char *line, int pager)
|
|
|
|
{
|
|
|
|
int ret, cmd_stat;
|
|
|
|
u_int i;
|
|
|
|
vector vline;
|
|
|
|
const struct cmd_element *cmd;
|
|
|
|
FILE *fp = NULL;
|
|
|
|
int closepager = 0;
|
|
|
|
int tried = 0;
|
|
|
|
int saved_ret, saved_node;
|
|
|
|
|
|
|
|
/* Split readline string up into the vector. */
|
|
|
|
vline = cmd_make_strvec(line);
|
|
|
|
|
|
|
|
if (vline == NULL)
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
saved_ret = ret = cmd_execute_command(vline, vty, &cmd, 1);
|
|
|
|
saved_node = vty->node;
|
|
|
|
|
|
|
|
/* If command doesn't succeeded in current node, try to walk up in node
|
|
|
|
* tree.
|
|
|
|
* Changing vty->node is enough to try it just out without actual walkup
|
|
|
|
* in
|
|
|
|
* the vtysh. */
|
|
|
|
while (ret != CMD_SUCCESS && ret != CMD_SUCCESS_DAEMON
|
|
|
|
&& ret != CMD_WARNING && ret != CMD_WARNING_CONFIG_FAILED
|
|
|
|
&& vty->node > CONFIG_NODE) {
|
|
|
|
vty->node = node_parent(vty->node);
|
|
|
|
ret = cmd_execute_command(vline, vty, &cmd, 1);
|
|
|
|
tried++;
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
|
|
|
vty->node = saved_node;
|
|
|
|
|
|
|
|
/* If command succeeded in any other node than current (tried > 0) we
|
|
|
|
* have
|
|
|
|
* to move into node in the vtysh where it succeeded. */
|
|
|
|
if (ret == CMD_SUCCESS || ret == CMD_SUCCESS_DAEMON
|
|
|
|
|| ret == CMD_WARNING) {
|
|
|
|
if ((saved_node == BGP_VPNV4_NODE
|
|
|
|
|| saved_node == BGP_VPNV6_NODE
|
|
|
|
|| saved_node == BGP_IPV4_NODE
|
|
|
|
|| saved_node == BGP_IPV6_NODE
|
|
|
|
|| saved_node == BGP_IPV4M_NODE
|
|
|
|
|| saved_node == BGP_IPV4L_NODE
|
|
|
|
|| saved_node == BGP_IPV6L_NODE
|
|
|
|
|| saved_node == BGP_IPV6M_NODE
|
2017-07-27 00:32:55 +02:00
|
|
|
|| saved_node == BGP_EVPN_NODE
|
|
|
|
|| saved_node == LDP_IPV4_NODE
|
|
|
|
|| saved_node == LDP_IPV6_NODE)
|
2017-07-17 14:03:14 +02:00
|
|
|
&& (tried == 1)) {
|
|
|
|
vtysh_execute("exit-address-family");
|
|
|
|
} else if ((saved_node == BGP_EVPN_VNI_NODE) && (tried == 1)) {
|
|
|
|
vtysh_execute("exit-vni");
|
|
|
|
} else if (saved_node == BGP_VRF_POLICY_NODE && (tried == 1)) {
|
|
|
|
vtysh_execute("exit-vrf-policy");
|
|
|
|
} else if ((saved_node == BGP_VNC_DEFAULTS_NODE
|
|
|
|
|| saved_node == BGP_VNC_NVE_GROUP_NODE
|
|
|
|
|| saved_node == BGP_VNC_L2_GROUP_NODE)
|
|
|
|
&& (tried == 1)) {
|
|
|
|
vtysh_execute("exit-vnc");
|
|
|
|
} else if ((saved_node == KEYCHAIN_KEY_NODE
|
|
|
|
|| saved_node == LDP_PSEUDOWIRE_NODE
|
|
|
|
|| saved_node == LDP_IPV4_IFACE_NODE
|
|
|
|
|| saved_node == LDP_IPV6_IFACE_NODE)
|
|
|
|
&& (tried == 1)) {
|
|
|
|
vtysh_execute("exit");
|
|
|
|
} else if (tried) {
|
|
|
|
vtysh_execute("end");
|
|
|
|
vtysh_execute("configure terminal");
|
|
|
|
}
|
2005-01-23 22:42:25 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
/* If command didn't succeed in any node, continue with return value
|
|
|
|
* from
|
|
|
|
* first try. */
|
|
|
|
else if (tried) {
|
|
|
|
ret = saved_ret;
|
2005-01-23 22:42:25 +01:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
cmd_free_strvec(vline);
|
|
|
|
|
|
|
|
cmd_stat = ret;
|
|
|
|
switch (ret) {
|
|
|
|
case CMD_WARNING:
|
|
|
|
case CMD_WARNING_CONFIG_FAILED:
|
|
|
|
if (vty->type == VTY_FILE)
|
|
|
|
fprintf(stdout, "Warning...\n");
|
|
|
|
break;
|
|
|
|
case CMD_ERR_AMBIGUOUS:
|
|
|
|
fprintf(stdout, "%% Ambiguous command.\n");
|
|
|
|
break;
|
|
|
|
case CMD_ERR_NO_MATCH:
|
|
|
|
fprintf(stdout, "%% Unknown command.\n");
|
|
|
|
break;
|
|
|
|
case CMD_ERR_INCOMPLETE:
|
|
|
|
fprintf(stdout, "%% Command incomplete.\n");
|
|
|
|
break;
|
|
|
|
case CMD_SUCCESS_DAEMON: {
|
|
|
|
/* FIXME: Don't open pager for exit commands. popen() causes
|
|
|
|
* problems
|
|
|
|
* if exited from vtysh at all. This hack shouldn't cause any
|
|
|
|
* problem
|
|
|
|
* but is really ugly. */
|
|
|
|
if (pager && vtysh_pager_name
|
|
|
|
&& (strncmp(line, "exit", 4) != 0)) {
|
|
|
|
fp = popen(vtysh_pager_name, "w");
|
|
|
|
if (fp == NULL) {
|
|
|
|
perror("popen failed for pager");
|
|
|
|
fp = stdout;
|
|
|
|
} else
|
|
|
|
closepager = 1;
|
|
|
|
} else
|
|
|
|
fp = stdout;
|
|
|
|
|
|
|
|
if (!strcmp(cmd->string, "configure terminal")) {
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++) {
|
|
|
|
cmd_stat = vtysh_client_execute(
|
|
|
|
&vtysh_client[i], line, fp);
|
|
|
|
if (cmd_stat == CMD_WARNING)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd_stat) {
|
|
|
|
line = "end";
|
|
|
|
vline = cmd_make_strvec(line);
|
|
|
|
|
|
|
|
if (vline == NULL) {
|
|
|
|
if (pager && vtysh_pager_name && fp
|
|
|
|
&& closepager) {
|
|
|
|
if (pclose(fp) == -1) {
|
|
|
|
perror("pclose failed for pager");
|
|
|
|
}
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = cmd_execute_command(vline, vty, &cmd, 1);
|
|
|
|
cmd_free_strvec(vline);
|
|
|
|
if (ret != CMD_SUCCESS_DAEMON)
|
|
|
|
break;
|
|
|
|
} else if (cmd->func) {
|
|
|
|
(*cmd->func)(cmd, vty, 0, NULL);
|
|
|
|
break;
|
|
|
|
}
|
2004-08-25 14:22:00 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
cmd_stat = CMD_SUCCESS;
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++) {
|
|
|
|
if (cmd->daemon & vtysh_client[i].flag) {
|
|
|
|
cmd_stat = vtysh_client_execute(
|
|
|
|
&vtysh_client[i], line, fp);
|
|
|
|
if (cmd_stat != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-01-28 22:11:46 +01:00
|
|
|
if (cmd_stat != CMD_SUCCESS)
|
2017-07-17 14:03:14 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (cmd->func)
|
|
|
|
(*cmd->func)(cmd, vty, 0, NULL);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
if (pager && vtysh_pager_name && fp && closepager) {
|
|
|
|
if (pclose(fp) == -1) {
|
|
|
|
perror("pclose failed for pager");
|
|
|
|
}
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
return cmd_stat;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
int vtysh_execute_no_pager(const char *line)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_execute_func(line, 0);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
int vtysh_execute(const char *line)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_execute_func(line, 1);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static char *trim(char *s)
|
2016-08-18 19:47:01 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
size_t size;
|
|
|
|
char *end;
|
2016-08-18 19:47:01 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
size = strlen(s);
|
2016-08-18 19:47:01 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (!size)
|
|
|
|
return s;
|
2016-08-18 19:47:01 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
end = s + size - 1;
|
|
|
|
while (end >= s && isspace(*end))
|
|
|
|
end--;
|
|
|
|
*(end + 1) = '\0';
|
2016-08-18 19:47:01 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
while (*s && isspace(*s))
|
|
|
|
s++;
|
2016-08-18 19:47:01 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return s;
|
2016-08-18 19:47:01 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
int vtysh_mark_file(const char *filename)
|
2015-05-20 03:04:11 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
struct vty *vty;
|
|
|
|
FILE *confp = NULL;
|
|
|
|
int ret;
|
|
|
|
vector vline;
|
|
|
|
int tried = 0;
|
|
|
|
const struct cmd_element *cmd;
|
|
|
|
int saved_ret, prev_node;
|
|
|
|
int lineno = 0;
|
|
|
|
char *vty_buf_copy = NULL;
|
|
|
|
char *vty_buf_trimmed = NULL;
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (strncmp("-", filename, 1) == 0)
|
|
|
|
confp = stdin;
|
|
|
|
else
|
|
|
|
confp = fopen(filename, "r");
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (confp == NULL) {
|
|
|
|
fprintf(stderr, "%% Can't open config file %s due to '%s'.\n",
|
|
|
|
filename, safe_strerror(errno));
|
|
|
|
return (CMD_ERR_NO_FILE);
|
|
|
|
}
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vty = vty_new();
|
|
|
|
vty->fd = 0; /* stdout */
|
|
|
|
vty->type = VTY_TERM;
|
|
|
|
vty->node = CONFIG_NODE;
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vtysh_execute_no_pager("enable");
|
|
|
|
vtysh_execute_no_pager("configure terminal");
|
|
|
|
vty_buf_copy = XCALLOC(MTYPE_VTYSH_CMD, VTY_BUFSIZ);
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
while (fgets(vty->buf, VTY_BUFSIZ, confp)) {
|
|
|
|
lineno++;
|
|
|
|
tried = 0;
|
|
|
|
strcpy(vty_buf_copy, vty->buf);
|
|
|
|
vty_buf_trimmed = trim(vty_buf_copy);
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-27 00:37:49 +02:00
|
|
|
switch (vty->node) {
|
|
|
|
case LDP_IPV4_IFACE_NODE:
|
|
|
|
if (strncmp(vty_buf_copy, " ", 3)) {
|
|
|
|
fprintf(stdout, " end\n");
|
|
|
|
vty->node = LDP_IPV4_NODE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LDP_IPV6_IFACE_NODE:
|
|
|
|
if (strncmp(vty_buf_copy, " ", 3)) {
|
|
|
|
fprintf(stdout, " end\n");
|
|
|
|
vty->node = LDP_IPV6_NODE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LDP_PSEUDOWIRE_NODE:
|
|
|
|
if (strncmp(vty_buf_copy, " ", 2)) {
|
|
|
|
fprintf(stdout, " end\n");
|
|
|
|
vty->node = LDP_L2VPN_NODE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty_buf_trimmed[0] == '!' || vty_buf_trimmed[0] == '#') {
|
|
|
|
fprintf(stdout, "%s", vty->buf);
|
|
|
|
continue;
|
|
|
|
}
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* Split readline string up into the vector. */
|
|
|
|
vline = cmd_make_strvec(vty->buf);
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vline == NULL) {
|
|
|
|
fprintf(stdout, "%s", vty->buf);
|
|
|
|
continue;
|
|
|
|
}
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* Ignore the "end" lines, we will generate these where
|
|
|
|
* appropriate */
|
|
|
|
if (strlen(vty_buf_trimmed) == 3
|
|
|
|
&& strncmp("end", vty_buf_trimmed, 3) == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
prev_node = vty->node;
|
|
|
|
saved_ret = ret = cmd_execute_command_strict(vline, vty, &cmd);
|
|
|
|
|
|
|
|
/* If command doesn't succeeded in current node, try to walk up
|
|
|
|
* in node tree.
|
|
|
|
* Changing vty->node is enough to try it just out without
|
|
|
|
* actual walkup in
|
|
|
|
* the vtysh. */
|
|
|
|
while (ret != CMD_SUCCESS && ret != CMD_SUCCESS_DAEMON
|
|
|
|
&& ret != CMD_WARNING && ret != CMD_WARNING_CONFIG_FAILED
|
|
|
|
&& vty->node > CONFIG_NODE) {
|
|
|
|
vty->node = node_parent(vty->node);
|
|
|
|
ret = cmd_execute_command_strict(vline, vty, &cmd);
|
|
|
|
tried++;
|
|
|
|
}
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* If command succeeded in any other node than current (tried >
|
|
|
|
* 0) we have
|
|
|
|
* to move into node in the vtysh where it succeeded. */
|
|
|
|
if (ret == CMD_SUCCESS || ret == CMD_SUCCESS_DAEMON
|
|
|
|
|| ret == CMD_WARNING) {
|
|
|
|
if ((prev_node == BGP_VPNV4_NODE
|
|
|
|
|| prev_node == BGP_VPNV6_NODE
|
|
|
|
|| prev_node == BGP_IPV4_NODE
|
|
|
|
|| prev_node == BGP_IPV6_NODE
|
|
|
|
|| prev_node == BGP_IPV4L_NODE
|
|
|
|
|| prev_node == BGP_IPV6L_NODE
|
|
|
|
|| prev_node == BGP_IPV4M_NODE
|
|
|
|
|| prev_node == BGP_IPV6M_NODE
|
|
|
|
|| prev_node == BGP_EVPN_NODE)
|
|
|
|
&& (tried == 1)) {
|
|
|
|
fprintf(stdout, "exit-address-family\n");
|
|
|
|
} else if ((prev_node == BGP_EVPN_VNI_NODE)
|
|
|
|
&& (tried == 1)) {
|
|
|
|
fprintf(stdout, "exit-vni\n");
|
|
|
|
} else if ((prev_node == KEYCHAIN_KEY_NODE)
|
|
|
|
&& (tried == 1)) {
|
|
|
|
fprintf(stdout, "exit\n");
|
|
|
|
} else if (tried) {
|
|
|
|
fprintf(stdout, "end\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* If command didn't succeed in any node, continue with return
|
|
|
|
* value from
|
|
|
|
* first try. */
|
|
|
|
else if (tried) {
|
|
|
|
ret = saved_ret;
|
|
|
|
vty->node = prev_node;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_free_strvec(vline);
|
|
|
|
switch (ret) {
|
|
|
|
case CMD_WARNING:
|
|
|
|
case CMD_WARNING_CONFIG_FAILED:
|
|
|
|
if (vty->type == VTY_FILE)
|
|
|
|
fprintf(stderr, "line %d: Warning...: %s\n",
|
|
|
|
lineno, vty->buf);
|
|
|
|
fclose(confp);
|
|
|
|
vty_close(vty);
|
|
|
|
XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
|
|
|
|
return ret;
|
|
|
|
case CMD_ERR_AMBIGUOUS:
|
|
|
|
fprintf(stderr, "line %d: %% Ambiguous command: %s\n",
|
|
|
|
lineno, vty->buf);
|
|
|
|
fclose(confp);
|
|
|
|
vty_close(vty);
|
|
|
|
XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
|
|
|
|
return CMD_ERR_AMBIGUOUS;
|
|
|
|
case CMD_ERR_NO_MATCH:
|
|
|
|
fprintf(stderr, "line %d: %% Unknown command: %s\n",
|
|
|
|
lineno, vty->buf);
|
|
|
|
fclose(confp);
|
|
|
|
vty_close(vty);
|
|
|
|
XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
|
|
|
|
return CMD_ERR_NO_MATCH;
|
|
|
|
case CMD_ERR_INCOMPLETE:
|
|
|
|
fprintf(stderr, "line %d: %% Command incomplete: %s\n",
|
|
|
|
lineno, vty->buf);
|
|
|
|
fclose(confp);
|
|
|
|
vty_close(vty);
|
|
|
|
XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
|
|
|
|
return CMD_ERR_INCOMPLETE;
|
|
|
|
case CMD_SUCCESS:
|
|
|
|
fprintf(stdout, "%s", vty->buf);
|
|
|
|
break;
|
|
|
|
case CMD_SUCCESS_DAEMON: {
|
|
|
|
u_int i;
|
|
|
|
int cmd_stat = CMD_SUCCESS;
|
|
|
|
|
|
|
|
fprintf(stdout, "%s", vty->buf);
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++) {
|
|
|
|
if (cmd->daemon & vtysh_client[i].flag) {
|
|
|
|
cmd_stat = vtysh_client_execute(
|
|
|
|
&vtysh_client[i], vty->buf,
|
|
|
|
stdout);
|
|
|
|
if (cmd_stat != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cmd_stat != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (cmd->func)
|
|
|
|
(*cmd->func)(cmd, vty, 0, NULL);
|
|
|
|
}
|
|
|
|
}
|
2015-05-20 03:04:11 +02:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
/* This is the end */
|
|
|
|
fprintf(stdout, "\nend\n");
|
|
|
|
vty_close(vty);
|
|
|
|
XFREE(MTYPE_VTYSH_CMD, vty_buf_copy);
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (confp != stdin)
|
|
|
|
fclose(confp);
|
2015-05-20 03:04:11 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return (0);
|
2015-05-20 03:04:11 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Configration make from file. */
|
2017-07-17 14:03:14 +02:00
|
|
|
int vtysh_config_from_file(struct vty *vty, FILE *fp)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
const struct cmd_element *cmd;
|
|
|
|
int lineno = 0;
|
|
|
|
int retcode = CMD_SUCCESS;
|
|
|
|
|
|
|
|
while (fgets(vty->buf, VTY_BUFSIZ, fp)) {
|
|
|
|
lineno++;
|
|
|
|
|
|
|
|
ret = command_config_read_one_line(vty, &cmd, 1);
|
|
|
|
|
|
|
|
switch (ret) {
|
|
|
|
case CMD_WARNING:
|
|
|
|
case CMD_WARNING_CONFIG_FAILED:
|
|
|
|
if (vty->type == VTY_FILE)
|
|
|
|
fprintf(stderr, "line %d: Warning[%d]...: %s\n",
|
|
|
|
lineno, vty->node, vty->buf);
|
|
|
|
retcode = ret; /* once we have an error, we remember &
|
|
|
|
return that */
|
|
|
|
break;
|
|
|
|
case CMD_ERR_AMBIGUOUS:
|
|
|
|
fprintf(stderr,
|
|
|
|
"line %d: %% Ambiguous command[%d]: %s\n",
|
|
|
|
lineno, vty->node, vty->buf);
|
|
|
|
retcode = CMD_ERR_AMBIGUOUS; /* once we have an error,
|
|
|
|
we remember & return
|
|
|
|
that */
|
|
|
|
break;
|
|
|
|
case CMD_ERR_NO_MATCH:
|
|
|
|
fprintf(stderr, "line %d: %% Unknown command[%d]: %s",
|
|
|
|
lineno, vty->node, vty->buf);
|
2017-07-22 14:52:33 +02:00
|
|
|
retcode =
|
|
|
|
CMD_ERR_NO_MATCH; /* once we have an error, we
|
|
|
|
remember & return that */
|
2017-07-17 14:03:14 +02:00
|
|
|
break;
|
|
|
|
case CMD_ERR_INCOMPLETE:
|
|
|
|
fprintf(stderr,
|
|
|
|
"line %d: %% Command incomplete[%d]: %s\n",
|
|
|
|
lineno, vty->node, vty->buf);
|
|
|
|
retcode = CMD_ERR_INCOMPLETE; /* once we have an error,
|
|
|
|
we remember & return
|
|
|
|
that */
|
|
|
|
break;
|
|
|
|
case CMD_SUCCESS_DAEMON: {
|
|
|
|
u_int i;
|
|
|
|
int cmd_stat = CMD_SUCCESS;
|
|
|
|
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++) {
|
|
|
|
if (cmd->daemon & vtysh_client[i].flag) {
|
|
|
|
cmd_stat = vtysh_client_execute(
|
|
|
|
&vtysh_client[i], vty->buf,
|
|
|
|
stdout);
|
|
|
|
/*
|
|
|
|
* CMD_WARNING - Can mean that the
|
|
|
|
* command was
|
|
|
|
* parsed successfully but it was
|
|
|
|
* already entered
|
|
|
|
* in a few spots. As such if we
|
|
|
|
* receive a
|
|
|
|
* CMD_WARNING from a daemon we
|
|
|
|
* shouldn't stop
|
|
|
|
* talking to the other daemons for the
|
|
|
|
* particular
|
|
|
|
* command.
|
|
|
|
*/
|
|
|
|
if (cmd_stat != CMD_SUCCESS
|
|
|
|
&& cmd_stat != CMD_WARNING) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"line %d: Failure to communicate[%d] to %s, line: %s\n",
|
|
|
|
lineno, cmd_stat,
|
|
|
|
vtysh_client[i].name,
|
|
|
|
vty->buf);
|
2017-08-16 22:22:59 +02:00
|
|
|
retcode = cmd_stat;
|
2017-07-17 14:03:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cmd_stat != CMD_SUCCESS)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (cmd->func)
|
|
|
|
(*cmd->func)(cmd, vty, 0, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (retcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We don't care about the point of the cursor when '?' is typed. */
|
|
|
|
static int vtysh_rl_describe(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
int ret;
|
|
|
|
unsigned int i;
|
|
|
|
vector vline;
|
|
|
|
vector describe;
|
|
|
|
int width;
|
|
|
|
struct cmd_token *token;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vline = cmd_make_strvec(rl_line_buffer);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* In case of '> ?'. */
|
|
|
|
if (vline == NULL) {
|
|
|
|
vline = vector_init(1);
|
|
|
|
vector_set(vline, NULL);
|
|
|
|
} else if (rl_end && isspace((int)rl_line_buffer[rl_end - 1]))
|
|
|
|
vector_set(vline, NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
describe = cmd_describe_command(vline, vty, &ret);
|
|
|
|
|
|
|
|
fprintf(stdout, "\n");
|
|
|
|
|
|
|
|
/* Ambiguous and no match error. */
|
|
|
|
switch (ret) {
|
2002-12-13 21:15:29 +01:00
|
|
|
case CMD_ERR_AMBIGUOUS:
|
2017-07-17 14:03:14 +02:00
|
|
|
cmd_free_strvec(vline);
|
|
|
|
fprintf(stdout, "%% Ambiguous command.\n");
|
|
|
|
rl_on_new_line();
|
|
|
|
return 0;
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
case CMD_ERR_NO_MATCH:
|
2017-07-17 14:03:14 +02:00
|
|
|
cmd_free_strvec(vline);
|
|
|
|
fprintf(stdout, "%% There is no matched command.\n");
|
|
|
|
rl_on_new_line();
|
|
|
|
return 0;
|
|
|
|
break;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-05-10 16:38:48 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* Get width of command string. */
|
|
|
|
width = 0;
|
|
|
|
for (i = 0; i < vector_active(describe); i++)
|
|
|
|
if ((token = vector_slot(describe, i)) != NULL) {
|
|
|
|
if (token->text[0] == '\0')
|
|
|
|
continue;
|
2017-05-10 16:38:48 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
int len = strlen(token->text);
|
2017-07-12 20:40:18 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
2017-07-12 20:40:18 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < vector_active(describe); i++)
|
|
|
|
if ((token = vector_slot(describe, i)) != NULL) {
|
|
|
|
if (!token->desc)
|
|
|
|
fprintf(stdout, " %-s\n", token->text);
|
|
|
|
else
|
|
|
|
fprintf(stdout, " %-*s %s\n", width,
|
|
|
|
token->text, token->desc);
|
|
|
|
|
|
|
|
if (IS_VARYING_TOKEN(token->type)) {
|
|
|
|
const char *ref = vector_slot(
|
|
|
|
vline, vector_active(vline) - 1);
|
|
|
|
|
|
|
|
vector varcomps = vector_init(VECTOR_MIN_SIZE);
|
|
|
|
cmd_variable_complete(token, ref, varcomps);
|
|
|
|
|
|
|
|
if (vector_active(varcomps) > 0) {
|
|
|
|
int rows, cols;
|
|
|
|
rl_get_screen_size(&rows, &cols);
|
|
|
|
|
|
|
|
char *ac = cmd_variable_comp2str(
|
|
|
|
varcomps, cols);
|
|
|
|
fprintf(stdout, "%s\n", ac);
|
|
|
|
XFREE(MTYPE_TMP, ac);
|
|
|
|
}
|
|
|
|
|
|
|
|
vector_free(varcomps);
|
|
|
|
}
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
cmd_free_strvec(vline);
|
|
|
|
vector_free(describe);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
rl_on_new_line();
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Result of cmd_complete_command() call will be stored here
|
|
|
|
* and used in new_completion() in order to put the space in
|
|
|
|
* correct places only. */
|
2002-12-13 21:15:29 +01:00
|
|
|
int complete_status;
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static char *command_generator(const char *text, int state)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vector vline;
|
|
|
|
static char **matched = NULL;
|
|
|
|
static int index = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* First call. */
|
|
|
|
if (!state) {
|
|
|
|
index = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty->node == AUTH_NODE || vty->node == AUTH_ENABLE_NODE)
|
|
|
|
return NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vline = cmd_make_strvec(rl_line_buffer);
|
|
|
|
if (vline == NULL)
|
|
|
|
return NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (rl_end && isspace((int)rl_line_buffer[rl_end - 1]))
|
|
|
|
vector_set(vline, NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
matched = cmd_complete_command(vline, vty, &complete_status);
|
|
|
|
cmd_free_strvec(vline);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (matched && matched[index])
|
|
|
|
/* this is free()'d by readline, but we leak 1 count of
|
|
|
|
* MTYPE_COMPLETION */
|
|
|
|
return matched[index++];
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
XFREE(MTYPE_TMP, matched);
|
|
|
|
matched = NULL;
|
2017-01-26 21:57:24 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static char **new_completion(char *text, int start, int end)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
char **matches;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
matches = rl_completion_matches(text, command_generator);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (matches) {
|
|
|
|
rl_point = rl_end;
|
|
|
|
if (complete_status != CMD_COMPLETE_FULL_MATCH)
|
|
|
|
/* only append a space on full match */
|
|
|
|
rl_completion_append_character = '\0';
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return matches;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Vty node structures. */
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
BGP_NODE, "%s(config-router)# ",
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node rip_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
RIP_NODE, "%s(config-router)# ",
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node isis_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
ISIS_NODE, "%s(config-router)# ",
|
2003-12-23 11:39:08 +01:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node interface_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
INTERFACE_NODE, "%s(config-if)# ",
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
2017-08-02 01:16:28 +02:00
|
|
|
static struct cmd_node pw_node = {
|
|
|
|
PW_NODE, "%s(config-pw)# ",
|
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node ns_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
NS_NODE, "%s(config-logical-router)# ",
|
2014-07-03 12:24:34 +02:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node vrf_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
VRF_NODE, "%s(config-vrf)# ",
|
2016-02-02 13:34:29 +01:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "};
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node zebra_node = {ZEBRA_NODE, "%s(config-router)# "};
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_vpnv6_node = {BGP_VPNV6_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2016-06-07 04:29:05 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_ipv4_node = {BGP_IPV4_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_ipv4m_node = {BGP_IPV4M_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_ipv4l_node = {BGP_IPV4L_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2017-02-08 20:19:54 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_ipv6_node = {BGP_IPV6_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_ipv6m_node = {BGP_IPV6M_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2005-08-23 00:44:29 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2017-01-04 15:47:00 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE,
|
|
|
|
"%s(config-router-af-vni)# "};
|
2017-05-16 00:01:57 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_ipv6l_node = {BGP_IPV6L_NODE,
|
|
|
|
"%s(config-router-af)# "};
|
2017-02-08 20:19:54 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_vnc_defaults_node = {
|
|
|
|
BGP_VNC_DEFAULTS_NODE, "%s(config-router-vnc-defaults)# "};
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_vnc_nve_group_node = {
|
|
|
|
BGP_VNC_NVE_GROUP_NODE, "%s(config-router-vnc-nve-group)# "};
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_vrf_policy_node = {BGP_VRF_POLICY_NODE,
|
|
|
|
"%s(config-router-vrf-policy)# "};
|
2017-01-12 14:30:17 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node bgp_vnc_l2_group_node = {
|
|
|
|
BGP_VNC_L2_GROUP_NODE, "%s(config-router-vnc-l2-group)# "};
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# "};
|
|
|
|
|
|
|
|
static struct cmd_node eigrp_node = {EIGRP_NODE, "%s(config-router)# "};
|
|
|
|
|
|
|
|
static struct cmd_node babel_node = {BABEL_NODE, "%s(config-router)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ripng_node = {RIPNG_NODE, "%s(config-router)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ospf6_node = {OSPF6_NODE, "%s(config-ospf6)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_node = {LDP_NODE, "%s(config-ldp)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_ipv4_node = {LDP_IPV4_NODE, "%s(config-ldp-af)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_ipv6_node = {LDP_IPV6_NODE, "%s(config-ldp-af)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_ipv4_iface_node = {LDP_IPV4_IFACE_NODE,
|
|
|
|
"%s(config-ldp-af-if)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_ipv6_iface_node = {LDP_IPV6_IFACE_NODE,
|
|
|
|
"%s(config-ldp-af-if)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_l2vpn_node = {LDP_L2VPN_NODE, "%s(config-l2vpn)# "};
|
|
|
|
|
|
|
|
static struct cmd_node ldp_pseudowire_node = {LDP_PSEUDOWIRE_NODE,
|
|
|
|
"%s(config-l2vpn-pw)# "};
|
|
|
|
|
|
|
|
static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# "};
|
|
|
|
|
|
|
|
static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE,
|
|
|
|
"%s(config-keychain-key)# "};
|
|
|
|
|
|
|
|
struct cmd_node link_params_node = {
|
2017-07-22 14:52:33 +02:00
|
|
|
LINK_PARAMS_NODE, "%s(config-link-params)# ",
|
2004-08-26 15:08:30 +02:00
|
|
|
};
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* Defined in lib/vty.c */
|
|
|
|
extern struct cmd_node vty_node;
|
|
|
|
|
|
|
|
/* When '^Z' is received from vty, move down to the enable mode. */
|
|
|
|
static int vtysh_end(void)
|
|
|
|
{
|
|
|
|
switch (vty->node) {
|
|
|
|
case VIEW_NODE:
|
|
|
|
case ENABLE_NODE:
|
|
|
|
/* Nothing to do. */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_REALLYALL, vtysh_end_all, vtysh_end_all_cmd, "end",
|
|
|
|
"End current mode and change to enable mode\n")
|
2017-03-09 05:07:46 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_end();
|
|
|
|
}
|
2017-03-09 05:07:46 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, router_bgp, router_bgp_cmd,
|
|
|
|
"router bgp [(1-4294967295) [<view|vrf> WORD]]",
|
|
|
|
ROUTER_STR BGP_STR AS_STR
|
|
|
|
"BGP view\nBGP VRF\n"
|
|
|
|
"View/VRF name\n")
|
2017-05-14 05:38:14 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2017-05-14 05:38:14 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_vpnv4, address_family_vpnv4_cmd,
|
|
|
|
"address-family vpnv4 [unicast]",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VPNV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_vpnv6, address_family_vpnv6_cmd,
|
|
|
|
"address-family vpnv6 [unicast]",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VPNV6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv4, address_family_ipv4_cmd,
|
|
|
|
"address-family ipv4 [unicast]",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family Modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_IPV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv4_multicast,
|
|
|
|
address_family_ipv4_multicast_cmd, "address-family ipv4 multicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_IPV4M_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv4_vpn, address_family_ipv4_vpn_cmd,
|
|
|
|
"address-family ipv4 vpn",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VPNV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv4_labeled_unicast,
|
|
|
|
address_family_ipv4_labeled_unicast_cmd,
|
|
|
|
"address-family ipv4 labeled-unicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_IPV4L_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv6, address_family_ipv6_cmd,
|
|
|
|
"address-family ipv6 [unicast]",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_IPV6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv6_multicast,
|
|
|
|
address_family_ipv6_multicast_cmd, "address-family ipv6 multicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_IPV6M_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv6_vpn, address_family_ipv6_vpn_cmd,
|
|
|
|
"address-family ipv6 vpn",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VPNV6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_ipv6_labeled_unicast,
|
|
|
|
address_family_ipv6_labeled_unicast_cmd,
|
|
|
|
"address-family ipv6 labeled-unicast",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_IPV6L_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, address_family_evpn, address_family_evpn_cmd,
|
|
|
|
"address-family <l2vpn evpn>",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"Address Family\n"
|
|
|
|
"Address Family modifier\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_EVPN_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2004-08-26 15:08:30 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
#if defined(HAVE_CUMULUS)
|
2017-06-28 20:30:36 +02:00
|
|
|
DEFUNSH_HIDDEN(VTYSH_BGPD, address_family_evpn2, address_family_evpn2_cmd,
|
|
|
|
"address-family evpn",
|
|
|
|
"Enter Address Family command mode\n"
|
|
|
|
"EVPN Address family\n")
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_EVPN_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
#endif
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, bgp_evpn_vni, bgp_evpn_vni_cmd, "vni (1-16777215)",
|
|
|
|
"VXLAN Network Identifier\n"
|
|
|
|
"VNI number\n")
|
|
|
|
{
|
|
|
|
vty->node = BGP_EVPN_VNI_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2004-10-03 22:11:32 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
#if defined(ENABLE_BGP_VNC)
|
|
|
|
DEFUNSH(VTYSH_BGPD, vnc_defaults, vnc_defaults_cmd, "vnc defaults",
|
|
|
|
"VNC/RFP related configuration\n"
|
|
|
|
"Configure default NVE group\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VNC_DEFAULTS_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_BGPD, vnc_nve_group, vnc_nve_group_cmd, "vnc nve-group NAME",
|
|
|
|
"VNC/RFP related configuration\n"
|
|
|
|
"Configure a NVE group\n"
|
|
|
|
"Group name\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VNC_NVE_GROUP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_BGPD, vnc_vrf_policy, vnc_vrf_policy_cmd, "vrf-policy NAME",
|
|
|
|
"Configure a VRF policy group\n"
|
|
|
|
"Group name\n")
|
2016-06-07 04:29:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VRF_POLICY_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_BGPD, vnc_l2_group, vnc_l2_group_cmd, "vnc l2-group NAME",
|
|
|
|
"VNC/RFP related configuration\n"
|
|
|
|
"Configure a L2 group\n"
|
|
|
|
"Group name\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BGP_VNC_L2_GROUP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPD, key_chain, key_chain_cmd, "key chain WORD",
|
|
|
|
"Authentication key management\n"
|
|
|
|
"Key-chain management\n"
|
|
|
|
"Key-chain name\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = KEYCHAIN_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-04-27 00:39:10 +02:00
|
|
|
}
|
2017-01-26 03:51:28 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPD, key, key_cmd, "key (0-2147483647)",
|
|
|
|
"Configure a key\n"
|
|
|
|
"Key identifier number\n")
|
2017-04-27 00:39:10 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = KEYCHAIN_KEY_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-04-27 00:39:10 +02:00
|
|
|
}
|
2017-02-08 20:19:54 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPD, router_rip, router_rip_cmd, "router rip",
|
|
|
|
ROUTER_STR "RIP\n")
|
2017-04-27 00:39:10 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = RIP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2005-08-23 00:44:29 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPNGD, router_ripng, router_ripng_cmd, "router ripng",
|
|
|
|
ROUTER_STR "RIPng\n")
|
2017-05-02 21:52:09 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = RIPNG_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2005-08-23 00:44:29 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_OSPFD, router_ospf, router_ospf_cmd, "router ospf [(1-65535)]",
|
|
|
|
"Enable a routing process\n"
|
|
|
|
"Start OSPF configuration\n"
|
|
|
|
"Instance ID\n")
|
2017-05-16 00:01:57 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = OSPF_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-05-16 00:01:57 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_EIGRPD, router_eigrp, router_eigrp_cmd, "router eigrp (1-65535)",
|
|
|
|
"Enable a routing process\n"
|
|
|
|
"Start EIGRP configuration\n"
|
|
|
|
"AS number to use\n")
|
2017-01-04 15:47:00 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = EIGRP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-01-04 15:47:00 +01:00
|
|
|
}
|
2017-05-16 00:01:57 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BABELD, router_babel, router_babel_cmd, "router babel",
|
|
|
|
"Enable a routing process\n"
|
|
|
|
"Make Babel instance command\n")
|
2017-05-16 00:01:57 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = BABEL_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-05-16 00:01:57 +02:00
|
|
|
}
|
2017-01-04 15:47:00 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_OSPF6D, router_ospf6, router_ospf6_cmd, "router ospf6",
|
|
|
|
ROUTER_STR OSPF6_STR)
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = OSPF6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
#if defined(HAVE_LDPD)
|
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_mpls_ldp, ldp_mpls_ldp_cmd, "mpls ldp",
|
|
|
|
"Global MPLS configuration subcommands\n"
|
|
|
|
"Label Distribution Protocol\n")
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = LDP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_address_family_ipv4, ldp_address_family_ipv4_cmd,
|
|
|
|
"address-family ipv4",
|
|
|
|
"Configure Address Family and its parameters\n"
|
|
|
|
"IPv4\n")
|
2017-01-12 14:30:17 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = LDP_IPV4_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-01-12 14:30:17 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_address_family_ipv6, ldp_address_family_ipv6_cmd,
|
|
|
|
"address-family ipv6",
|
|
|
|
"Configure Address Family and its parameters\n"
|
|
|
|
"IPv6\n")
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = LDP_IPV6_NODE;
|
|
|
|
return CMD_SUCCESS;
|
bgpd: add L3/L2VPN Virtual Network Control feature
This feature adds an L3 & L2 VPN application that makes use of the VPN
and Encap SAFIs. This code is currently used to support IETF NVO3 style
operation. In NVO3 terminology it provides the Network Virtualization
Authority (NVA) and the ability to import/export IP prefixes and MAC
addresses from Network Virtualization Edges (NVEs). The code supports
per-NVE tables.
The NVE-NVA protocol used to communicate routing and Ethernet / Layer 2
(L2) forwarding information between NVAs and NVEs is referred to as the
Remote Forwarder Protocol (RFP). OpenFlow is an example RFP. For
general background on NVO3 and RFP concepts see [1]. For information on
Openflow see [2].
RFPs are integrated with BGP via the RF API contained in the new "rfapi"
BGP sub-directory. Currently, only a simple example RFP is included in
Quagga. Developers may use this example as a starting point to integrate
Quagga with an RFP of their choosing, e.g., OpenFlow. The RFAPI code
also supports the ability import/export of routing information between
VNC and customer edge routers (CEs) operating within a virtual
network. Import/export may take place between BGP views or to the
default zebera VRF.
BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VPN
information between NVAs. BGP based IP VPN support is defined in
RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs), and RFC4659,
BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN . Use
of both the Encapsulation Subsequent Address Family Identifier (SAFI)
and the Tunnel Encapsulation Attribute, RFC5512, The BGP Encapsulation
Subsequent Address Family Identifier (SAFI) and the BGP Tunnel
Encapsulation Attribute, are supported. MAC address distribution does
not follow any standard BGB encoding, although it was inspired by the
early IETF EVPN concepts.
The feature is conditionally compiled and disabled by default.
Use the --enable-bgp-vnc configure option to enable.
The majority of this code was authored by G. Paul Ziemba
<paulz@labn.net>.
[1] http://tools.ietf.org/html/draft-ietf-nvo3-nve-nva-cp-req
[2] https://www.opennetworking.org/sdn-resources/technical-library
Now includes changes needed to merge with cmaster-next.
2016-05-07 20:18:56 +02:00
|
|
|
}
|
|
|
|
|
2017-07-27 00:32:55 +02:00
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_exit_address_family, ldp_exit_address_family_cmd,
|
|
|
|
"exit-address-family", "Exit from Address Family configuration mode\n")
|
|
|
|
{
|
|
|
|
if (vty->node == LDP_IPV4_NODE || vty->node == LDP_IPV6_NODE)
|
|
|
|
vty->node = LDP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_interface_ifname, ldp_interface_ifname_cmd,
|
|
|
|
"interface IFNAME",
|
|
|
|
"Enable LDP on an interface and enter interface submode\n"
|
|
|
|
"Interface's name\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
switch (vty->node) {
|
|
|
|
case LDP_IPV4_NODE:
|
|
|
|
vty->node = LDP_IPV4_IFACE_NODE;
|
|
|
|
break;
|
|
|
|
case LDP_IPV6_NODE:
|
|
|
|
vty->node = LDP_IPV6_IFACE_NODE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_l2vpn_word_type_vpls, ldp_l2vpn_word_type_vpls_cmd,
|
|
|
|
"l2vpn WORD type vpls",
|
|
|
|
"Configure l2vpn commands\n"
|
|
|
|
"L2VPN name\n"
|
|
|
|
"L2VPN type\n"
|
|
|
|
"Virtual Private LAN Service\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = LDP_L2VPN_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_LDPD, ldp_member_pseudowire_ifname,
|
|
|
|
ldp_member_pseudowire_ifname_cmd, "member pseudowire IFNAME",
|
|
|
|
"L2VPN member configuration\n"
|
|
|
|
"Pseudowire interface\n"
|
|
|
|
"Interface's name\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = LDP_PSEUDOWIRE_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ISISD, router_isis, router_isis_cmd, "router isis WORD",
|
|
|
|
ROUTER_STR
|
|
|
|
"ISO IS-IS\n"
|
|
|
|
"ISO Routing area tag")
|
|
|
|
{
|
|
|
|
vty->node = ISIS_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_RMAP, vtysh_route_map, vtysh_route_map_cmd,
|
|
|
|
"route-map WORD <deny|permit> (1-65535)",
|
|
|
|
"Create route-map or enter route-map command mode\n"
|
|
|
|
"Route map tag\n"
|
|
|
|
"Route map denies set operations\n"
|
|
|
|
"Route map permits set operations\n"
|
|
|
|
"Sequence to insert to/delete from existing route-map entry\n")
|
|
|
|
{
|
|
|
|
vty->node = RMAP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_line_vty, vtysh_line_vty_cmd, "line vty",
|
|
|
|
"Configure a terminal line\n"
|
|
|
|
"Virtual terminal\n")
|
|
|
|
{
|
|
|
|
vty->node = VTY_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_REALLYALL, vtysh_enable, vtysh_enable_cmd, "enable",
|
|
|
|
"Turn on privileged mode command\n")
|
|
|
|
{
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_REALLYALL, vtysh_disable, vtysh_disable_cmd, "disable",
|
|
|
|
"Turn off privileged mode command\n")
|
|
|
|
{
|
|
|
|
if (vty->node == ENABLE_NODE)
|
|
|
|
vty->node = VIEW_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_REALLYALL, vtysh_config_terminal, vtysh_config_terminal_cmd,
|
|
|
|
"configure terminal",
|
|
|
|
"Configuration from vty interface\n"
|
|
|
|
"Configuration terminal\n")
|
|
|
|
{
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vtysh_exit(struct vty *vty)
|
|
|
|
{
|
|
|
|
switch (vty->node) {
|
|
|
|
case VIEW_NODE:
|
|
|
|
case ENABLE_NODE:
|
|
|
|
exit(0);
|
|
|
|
break;
|
|
|
|
case CONFIG_NODE:
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
break;
|
|
|
|
case INTERFACE_NODE:
|
2017-08-02 01:16:28 +02:00
|
|
|
case PW_NODE:
|
2017-07-17 14:03:14 +02:00
|
|
|
case NS_NODE:
|
|
|
|
case VRF_NODE:
|
|
|
|
case ZEBRA_NODE:
|
|
|
|
case BGP_NODE:
|
|
|
|
case RIP_NODE:
|
|
|
|
case RIPNG_NODE:
|
|
|
|
case OSPF_NODE:
|
|
|
|
case OSPF6_NODE:
|
|
|
|
case EIGRP_NODE:
|
|
|
|
case BABEL_NODE:
|
|
|
|
case LDP_NODE:
|
|
|
|
case LDP_L2VPN_NODE:
|
|
|
|
case ISIS_NODE:
|
|
|
|
case MASC_NODE:
|
|
|
|
case RMAP_NODE:
|
|
|
|
case VTY_NODE:
|
|
|
|
case KEYCHAIN_NODE:
|
|
|
|
vtysh_execute("end");
|
|
|
|
vtysh_execute("configure terminal");
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
break;
|
|
|
|
case BGP_VPNV4_NODE:
|
|
|
|
case BGP_VPNV6_NODE:
|
|
|
|
case BGP_IPV4_NODE:
|
|
|
|
case BGP_IPV4M_NODE:
|
|
|
|
case BGP_IPV4L_NODE:
|
|
|
|
case BGP_IPV6_NODE:
|
|
|
|
case BGP_IPV6M_NODE:
|
|
|
|
case BGP_IPV6L_NODE:
|
|
|
|
case BGP_VRF_POLICY_NODE:
|
|
|
|
case BGP_EVPN_NODE:
|
|
|
|
case BGP_VNC_DEFAULTS_NODE:
|
|
|
|
case BGP_VNC_NVE_GROUP_NODE:
|
|
|
|
case BGP_VNC_L2_GROUP_NODE:
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
break;
|
|
|
|
case BGP_EVPN_VNI_NODE:
|
|
|
|
vty->node = BGP_EVPN_NODE;
|
|
|
|
break;
|
|
|
|
case LDP_IPV4_NODE:
|
|
|
|
case LDP_IPV6_NODE:
|
|
|
|
vty->node = LDP_NODE;
|
|
|
|
break;
|
|
|
|
case LDP_IPV4_IFACE_NODE:
|
|
|
|
vty->node = LDP_IPV4_NODE;
|
|
|
|
break;
|
|
|
|
case LDP_IPV6_IFACE_NODE:
|
|
|
|
vty->node = LDP_IPV6_NODE;
|
|
|
|
break;
|
|
|
|
case LDP_PSEUDOWIRE_NODE:
|
|
|
|
vty->node = LDP_L2VPN_NODE;
|
|
|
|
break;
|
|
|
|
case KEYCHAIN_KEY_NODE:
|
|
|
|
vty->node = KEYCHAIN_NODE;
|
|
|
|
break;
|
|
|
|
case LINK_PARAMS_NODE:
|
|
|
|
vty->node = INTERFACE_NODE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_REALLYALL, vtysh_exit_all, vtysh_exit_all_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2016-08-02 00:47:15 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_quit_all, vtysh_quit_all_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_all(self, vty, argc, argv);
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, exit_address_family, exit_address_family_cmd,
|
|
|
|
"exit-address-family", "Exit from Address Family configuration mode\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty->node == BGP_IPV4_NODE || vty->node == BGP_IPV4M_NODE
|
|
|
|
|| vty->node == BGP_IPV4L_NODE || vty->node == BGP_VPNV4_NODE
|
|
|
|
|| vty->node == BGP_VPNV6_NODE || vty->node == BGP_IPV6_NODE
|
|
|
|
|| vty->node == BGP_IPV6L_NODE || vty->node == BGP_IPV6M_NODE
|
|
|
|
|| vty->node == BGP_EVPN_NODE)
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, exit_vni, exit_vni_cmd, "exit-vni", "Exit from VNI mode\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty->node == BGP_EVPN_VNI_NODE)
|
|
|
|
vty->node = BGP_EVPN_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_BGPD, exit_vnc_config, exit_vnc_config_cmd, "exit-vnc",
|
|
|
|
"Exit from VNC configuration mode\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty->node == BGP_VNC_DEFAULTS_NODE
|
|
|
|
|| vty->node == BGP_VNC_NVE_GROUP_NODE
|
|
|
|
|| vty->node == BGP_VNC_L2_GROUP_NODE)
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2016-08-02 00:47:15 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, exit_vrf_policy, exit_vrf_policy_cmd, "exit-vrf-policy",
|
|
|
|
"Exit from VRF configuration mode\n")
|
2017-01-12 14:30:17 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty->node == BGP_VRF_POLICY_NODE)
|
|
|
|
vty->node = BGP_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2017-01-12 14:30:17 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPD, vtysh_exit_ripd, vtysh_exit_ripd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPD, vtysh_quit_ripd, vtysh_quit_ripd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_ripd(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPNGD, vtysh_exit_ripngd, vtysh_exit_ripngd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2003-03-25 06:07:42 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2003-03-25 06:07:42 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RIPNGD, vtysh_quit_ripngd, vtysh_quit_ripngd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_ripngd(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2003-03-25 06:07:42 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RMAP, vtysh_exit_rmap, vtysh_exit_rmap_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_RMAP, vtysh_quit_rmap, vtysh_quit_rmap_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_rmap(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, vtysh_exit_bgpd, vtysh_exit_bgpd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BGPD, vtysh_quit_bgpd, vtysh_quit_bgpd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_bgpd(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_OSPFD, vtysh_exit_ospfd, vtysh_exit_ospfd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_OSPFD, vtysh_quit_ospfd, vtysh_quit_ospfd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_ospfd(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_EIGRPD, vtysh_exit_eigrpd, vtysh_exit_eigrpd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2017-03-09 05:07:46 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2017-03-09 05:07:46 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_EIGRPD, vtysh_quit_eigrpd, vtysh_quit_eigrpd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2017-03-09 05:07:46 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2017-03-09 05:07:46 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_EIGRPD, vtysh_exit_babeld, vtysh_exit_babeld_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2017-05-14 05:38:14 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2017-05-14 05:38:14 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_BABELD, vtysh_quit_babeld, vtysh_quit_babeld_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2017-05-14 05:38:14 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2017-05-14 05:38:14 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_OSPF6D, vtysh_exit_ospf6d, vtysh_exit_ospf6d_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2003-03-25 06:07:42 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2003-03-25 06:07:42 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_OSPF6D, vtysh_quit_ospf6d, vtysh_quit_ospf6d_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_ospf6d(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2003-03-25 06:07:42 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
#if defined(HAVE_LDPD)
|
|
|
|
DEFUNSH(VTYSH_LDPD, vtysh_exit_ldpd, vtysh_exit_ldpd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-08-02 00:47:15 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2016-08-02 00:47:15 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
ALIAS(vtysh_exit_ldpd, vtysh_quit_ldpd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-24 21:24:03 +02:00
|
|
|
#endif
|
2016-08-02 00:47:15 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ISISD, vtysh_exit_isisd, vtysh_exit_isisd_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2003-12-23 11:39:08 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2003-12-23 11:39:08 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ISISD, vtysh_quit_isisd, vtysh_quit_isisd_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_isisd(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2003-12-23 11:39:08 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_exit_line_vty, vtysh_exit_line_vty_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2004-10-03 22:11:32 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_quit_line_vty, vtysh_quit_line_vty_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_line_vty(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2004-10-03 22:11:32 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_INTERFACE, vtysh_interface, vtysh_interface_cmd,
|
|
|
|
"interface IFNAME [vrf NAME]",
|
|
|
|
"Select an interface to configure\n"
|
|
|
|
"Interface's name\n" VRF_CMD_HELP_STR)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = INTERFACE_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-08-02 01:16:28 +02:00
|
|
|
DEFUNSH(VTYSH_ZEBRA, vtysh_pseudowire, vtysh_pseudowire_cmd,
|
|
|
|
"pseudowire IFNAME",
|
|
|
|
"Static pseudowire configuration\n"
|
|
|
|
"Pseudowire name\n")
|
|
|
|
{
|
|
|
|
vty->node = PW_NODE;
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* TODO Implement "no interface command in isisd. */
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFSH(VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_RIPNGD | VTYSH_OSPFD | VTYSH_OSPF6D
|
|
|
|
| VTYSH_EIGRPD,
|
2017-07-22 14:52:33 +02:00
|
|
|
vtysh_no_interface_cmd, "no interface IFNAME", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Delete a pseudo interface's configuration\n"
|
|
|
|
"Interface's name\n")
|
2003-05-23 11:25:20 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFSH(VTYSH_ZEBRA, vtysh_no_interface_vrf_cmd, "no interface IFNAME vrf NAME",
|
|
|
|
NO_STR
|
|
|
|
"Delete a pseudo interface's configuration\n"
|
|
|
|
"Interface's name\n" VRF_CMD_HELP_STR)
|
2015-05-22 11:40:00 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_NS, vtysh_ns, vtysh_ns_cmd, "logical-router (1-65535) ns NAME",
|
|
|
|
"Enable a logical-router\n"
|
|
|
|
"Specify the logical-router indentifier\n"
|
|
|
|
"The Name Space\n"
|
|
|
|
"The file name in " NS_RUN_DIR ", or a full pathname\n")
|
2014-07-03 12:24:34 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = NS_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2014-07-03 12:24:34 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_VRF, vtysh_vrf, vtysh_vrf_cmd, "vrf NAME",
|
|
|
|
"Select a VRF to configure\n"
|
|
|
|
"VRF's name\n")
|
2016-02-02 13:34:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = VRF_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2016-02-02 13:34:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-22 14:52:33 +02:00
|
|
|
DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_cmd, "no vrf NAME", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Delete a pseudo vrf's configuration\n"
|
|
|
|
"VRF's name\n")
|
2016-02-02 13:34:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_NS, vtysh_exit_ns, vtysh_exit_ns_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2014-07-03 12:24:34 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2014-07-03 12:24:34 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_NS, vtysh_quit_ns, vtysh_quit_ns_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_ns(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2014-07-03 12:24:34 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_VRF, vtysh_exit_vrf, vtysh_exit_vrf_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-02-02 13:34:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2016-02-02 13:34:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_VRF, vtysh_quit_vrf, vtysh_quit_vrf_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_vrf(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2016-02-02 13:34:29 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* TODO Implement interface description commands in ripngd, ospf6d
|
|
|
|
* and isisd. */
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFSH(VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_OSPFD | VTYSH_EIGRPD,
|
|
|
|
vtysh_interface_desc_cmd, "description LINE...",
|
|
|
|
"Interface specific description\n"
|
|
|
|
"Characters describing this interface\n")
|
2003-03-01 16:44:10 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFSH(VTYSH_ZEBRA | VTYSH_RIPD | VTYSH_OSPFD | VTYSH_EIGRPD,
|
|
|
|
vtysh_no_interface_desc_cmd, "no description",
|
|
|
|
NO_STR "Interface specific description\n")
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_INTERFACE, vtysh_exit_interface, vtysh_exit_interface_cmd, "exit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit(vty);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_INTERFACE, vtysh_quit_interface, vtysh_quit_interface_cmd, "quit",
|
|
|
|
"Exit current mode and down to previous mode\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_exit_interface(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-08-20 03:33:13 +02:00
|
|
|
DEFUN (vtysh_show_thread,
|
|
|
|
vtysh_show_thread_cmd,
|
|
|
|
"show thread cpu [FILTER]",
|
2017-06-19 22:34:22 +02:00
|
|
|
SHOW_STR
|
|
|
|
"Thread information\n"
|
|
|
|
"Thread CPU usage\n"
|
|
|
|
"Display filter (rwtexb)\n")
|
2015-08-20 03:33:13 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
unsigned int i;
|
|
|
|
int idx = 0;
|
|
|
|
int ret = CMD_SUCCESS;
|
|
|
|
char line[100];
|
2015-08-20 03:33:13 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
const char *filter =
|
|
|
|
argv_find(argv, argc, "FILTER", &idx) ? argv[idx]->arg : "";
|
2017-06-19 22:34:22 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
snprintf(line, sizeof(line), "do show thread cpu %s\n", filter);
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
if (vtysh_client[i].fd >= 0) {
|
|
|
|
fprintf(stdout, "Thread statistics for %s:\n",
|
|
|
|
vtysh_client[i].name);
|
|
|
|
ret = vtysh_client_execute(&vtysh_client[i], line,
|
|
|
|
stdout);
|
|
|
|
fprintf(stdout, "\n");
|
|
|
|
}
|
|
|
|
return ret;
|
2015-08-20 03:33:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_show_work_queues,
|
|
|
|
vtysh_show_work_queues_cmd,
|
|
|
|
"show work-queues",
|
|
|
|
SHOW_STR
|
|
|
|
"Work Queue information\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
unsigned int i;
|
|
|
|
int ret = CMD_SUCCESS;
|
|
|
|
char line[] = "do show work-queues\n";
|
2015-08-20 03:33:13 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
if (vtysh_client[i].fd >= 0) {
|
|
|
|
fprintf(stdout, "Work queue statistics for %s:\n",
|
|
|
|
vtysh_client[i].name);
|
|
|
|
ret = vtysh_client_execute(&vtysh_client[i], line,
|
|
|
|
stdout);
|
|
|
|
fprintf(stdout, "\n");
|
|
|
|
}
|
2015-08-20 03:33:13 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return ret;
|
2015-08-20 03:33:13 +02:00
|
|
|
}
|
|
|
|
|
2016-02-25 13:29:29 +01:00
|
|
|
DEFUN (vtysh_show_work_queues_daemon,
|
|
|
|
vtysh_show_work_queues_daemon_cmd,
|
2016-09-23 15:47:20 +02:00
|
|
|
"show work-queues <zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd>",
|
2016-02-25 13:29:29 +01:00
|
|
|
SHOW_STR
|
|
|
|
"Work Queue information\n"
|
|
|
|
"For the zebra daemon\n"
|
|
|
|
"For the rip daemon\n"
|
|
|
|
"For the ripng daemon\n"
|
|
|
|
"For the ospf daemon\n"
|
|
|
|
"For the ospfv6 daemon\n"
|
|
|
|
"For the bgp daemon\n"
|
|
|
|
"For the isis daemon\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
int idx_protocol = 2;
|
|
|
|
unsigned int i;
|
|
|
|
int ret = CMD_SUCCESS;
|
2016-02-25 13:29:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++) {
|
|
|
|
if (strmatch(vtysh_client[i].name, argv[idx_protocol]->text))
|
|
|
|
break;
|
|
|
|
}
|
2016-02-25 13:29:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
ret = vtysh_client_execute(&vtysh_client[i], "show work-queues\n",
|
|
|
|
stdout);
|
2016-02-25 13:29:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return ret;
|
2016-02-25 13:29:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ZEBRA, vtysh_link_params, vtysh_link_params_cmd, "link-params",
|
|
|
|
LINK_PARAMS_STR)
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vty->node = LINK_PARAMS_NODE;
|
|
|
|
return CMD_SUCCESS;
|
Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches. Since this
series builds together I am doing this. -DBS
This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering
* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support for IEEE 754 format
* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
safely convert between big-endian IEEE-754 single and double binary
format, as used in IETF RFCs, and C99. Implementation depends on host
using __STDC_IEC_559__, which should be everything we care about. Should
correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add link parameters support to Zebra
* zebra/interface.c:
- Add new link-params CLI commands
- Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Add support of new link-params CLI to vtysh
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Update Traffic Engineering support for OSPFD
These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).
* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
tmp
2016-04-19 16:21:46 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ZEBRA, exit_link_params, exit_link_params_cmd, "exit-link-params",
|
|
|
|
"Exit from Link Params configuration node\n")
|
2016-11-18 21:42:41 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vty->node == LINK_PARAMS_NODE)
|
|
|
|
vty->node = INTERFACE_NODE;
|
|
|
|
return CMD_SUCCESS;
|
2016-11-18 21:42:41 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static int show_per_daemon(const char *line, const char *headline)
|
2006-05-28 09:54:45 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
unsigned int i;
|
|
|
|
int ret = CMD_SUCCESS;
|
2017-04-04 16:12:59 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
if (vtysh_client[i].fd >= 0) {
|
|
|
|
fprintf(stdout, headline, vtysh_client[i].name);
|
|
|
|
ret = vtysh_client_execute(&vtysh_client[i], line,
|
|
|
|
stdout);
|
|
|
|
fprintf(stdout, "\n");
|
|
|
|
}
|
2017-04-04 16:12:59 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return ret;
|
2006-05-28 09:54:45 +02:00
|
|
|
}
|
|
|
|
|
2017-08-18 18:50:13 +02:00
|
|
|
DEFUN (vtysh_show_debugging,
|
|
|
|
vtysh_show_debugging_cmd,
|
|
|
|
"show debugging",
|
|
|
|
SHOW_STR
|
|
|
|
DEBUG_STR)
|
|
|
|
{
|
|
|
|
return show_per_daemon("do show debugging\n",
|
|
|
|
"Debugging Information for %s:\n");
|
|
|
|
}
|
|
|
|
|
2017-08-21 14:34:31 +02:00
|
|
|
DEFUN (vtysh_show_debugging_hashtable,
|
|
|
|
vtysh_show_debugging_hashtable_cmd,
|
|
|
|
"show debugging hashtable [statistics]",
|
|
|
|
SHOW_STR
|
|
|
|
DEBUG_STR
|
|
|
|
"Statistics about hash tables\n"
|
|
|
|
"Statistics about hash tables\n")
|
|
|
|
{
|
2017-09-05 17:50:26 +02:00
|
|
|
fprintf(stdout, "\n");
|
|
|
|
fprintf(stdout,
|
|
|
|
"Load factor (LF) - average number of elements across all buckets\n");
|
|
|
|
fprintf(stdout,
|
|
|
|
"Full load factor (FLF) - average number of elements across full buckets\n\n");
|
|
|
|
fprintf(stdout,
|
|
|
|
"Standard deviation (SD) is calculated for both the LF and FLF\n");
|
|
|
|
fprintf(stdout,
|
|
|
|
"and indicates the typical deviation of bucket chain length\n");
|
|
|
|
fprintf(stdout, "from the value in the corresponding load factor.\n\n");
|
|
|
|
|
2017-08-21 14:34:31 +02:00
|
|
|
return show_per_daemon("do show debugging hashtable\n",
|
|
|
|
"Hashtable statistics for %s:\n");
|
|
|
|
}
|
|
|
|
|
2017-04-04 16:12:59 +02:00
|
|
|
/* Memory */
|
|
|
|
DEFUN (vtysh_show_memory,
|
|
|
|
vtysh_show_memory_cmd,
|
|
|
|
"show memory",
|
|
|
|
SHOW_STR
|
|
|
|
"Memory statistics\n")
|
|
|
|
{
|
2017-08-18 18:50:13 +02:00
|
|
|
return show_per_daemon("show memory\n",
|
|
|
|
"Memory statistics for %s:\n");
|
2017-04-04 16:12:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_show_modules,
|
|
|
|
vtysh_show_modules_cmd,
|
|
|
|
"show modules",
|
|
|
|
SHOW_STR
|
|
|
|
"Loaded modules\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return show_per_daemon("show modules\n",
|
|
|
|
"Module information for %s:\n");
|
2017-04-04 16:12:59 +02:00
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* Logging commands. */
|
2006-05-24 00:10:01 +02:00
|
|
|
DEFUN (vtysh_show_logging,
|
|
|
|
vtysh_show_logging_cmd,
|
|
|
|
"show logging",
|
|
|
|
SHOW_STR
|
|
|
|
"Show current logging configuration\n")
|
|
|
|
{
|
2017-08-18 17:12:31 +02:00
|
|
|
return show_per_daemon("do show logging\n",
|
|
|
|
"Logging configuration for %s:\n");
|
2017-07-17 14:03:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_stdout, vtysh_log_stdout_cmd, "log stdout",
|
|
|
|
"Logging control\n"
|
|
|
|
"Set stdout logging level\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_stdout_level, vtysh_log_stdout_level_cmd,
|
|
|
|
"log stdout <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
|
|
|
|
"Logging control\n"
|
|
|
|
"Set stdout logging level\n" LOG_LEVEL_DESC)
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_stdout, no_vtysh_log_stdout_cmd,
|
2017-07-22 14:52:33 +02:00
|
|
|
"no log stdout [LEVEL]", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Cancel logging to stdout\n"
|
|
|
|
"Logging level\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_file, vtysh_log_file_cmd, "log file FILENAME",
|
|
|
|
"Logging control\n"
|
|
|
|
"Logging to file\n"
|
|
|
|
"Logging filename\n")
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_file_level, vtysh_log_file_level_cmd,
|
|
|
|
"log file FILENAME <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
|
|
|
|
"Logging control\n"
|
|
|
|
"Logging to file\n"
|
|
|
|
"Logging filename\n" LOG_LEVEL_DESC)
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_file, no_vtysh_log_file_cmd,
|
2017-07-22 14:52:33 +02:00
|
|
|
"no log file [FILENAME [LEVEL]]", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Cancel logging to file\n"
|
|
|
|
"Logging file name\n"
|
|
|
|
"Logging level\n")
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_monitor, vtysh_log_monitor_cmd,
|
|
|
|
"log monitor [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
|
|
|
|
"Logging control\n"
|
|
|
|
"Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC)
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_monitor, no_vtysh_log_monitor_cmd,
|
2017-07-22 14:52:33 +02:00
|
|
|
"no log monitor [LEVEL]", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Disable terminal line (monitor) logging\n"
|
|
|
|
"Logging level\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_syslog, vtysh_log_syslog_cmd,
|
|
|
|
"log syslog [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
|
|
|
|
"Logging control\n"
|
|
|
|
"Set syslog logging level\n" LOG_LEVEL_DESC)
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_syslog, no_vtysh_log_syslog_cmd,
|
2017-07-22 14:52:33 +02:00
|
|
|
"no log syslog [LEVEL]", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Cancel logging to syslog\n"
|
|
|
|
"Logging level\n")
|
|
|
|
{
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_facility, vtysh_log_facility_cmd,
|
|
|
|
"log facility <kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>",
|
|
|
|
"Logging control\n"
|
|
|
|
"Facility parameter for syslog messages\n" LOG_FACILITY_DESC)
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_facility, no_vtysh_log_facility_cmd,
|
2017-07-22 14:52:33 +02:00
|
|
|
"no log facility [FACILITY]", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Reset syslog facility to default (daemon)\n"
|
|
|
|
"Syslog facility\n")
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH_DEPRECATED(
|
|
|
|
VTYSH_ALL, vtysh_log_trap, vtysh_log_trap_cmd,
|
|
|
|
"log trap <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
|
|
|
|
"Logging control\n"
|
|
|
|
"(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC)
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_main.c: (main) The 2nd argument to openzlog has been removed.
* isis_main.c: (main) The 2nd argument to openzlog has been removed.
* ospf6_main.c: (main) The 2nd argument to openzlog has been removed.
Note that stdout logging will no longer be enabled by default when
not running as a daemon.
* ospf_main.c: (main) The 2nd argument to openzlog has been removed.
* rip_main.c: (main) The 2nd argument to openzlog has been removed.
* ripng_main.c: (main) The 2nd argument to openzlog has been removed.
* main.c: (main) The 2nd argument to openzlog has been removed.
So stdout logging will no longer be enabled by default.
* irdp_main.c: (irdp_finish) Reduce severity of shutdown message
from LOG_WARNING to LOG_INFO.
* vtysh.c: Make several functions static instead of global.
Added several commands to support destination-specific logging levels.
(vtysh_completion) This function is unused, so comment it out.
* basic.texi: Document new logging features. Separate basic config
commands from basic VTY commands.
* log.h: Replace struct zlog flags and maskpri fields with maxlvl
array to support individual logging levels for each destination.
Remove the 2nd argument to openzlog since the default logging config
should be standardized inside the library. Replaced the
zlog_set_flag and zlog_reset_flag functions with zlog_set_level.
And zlog_set_file now requires an additional log_level argument.
Declare zlog_proto_names for use inside command.c in the
"show logging" command. Added defines useful for command
construction.
* log.c: (vzlog) Decide where to send the message based on the
individual logging levels configured for each destination.
Remove support for ZLOG_STDERR since it was never actually used.
Support record-priority for terminal monitors.
(zlog_signal,zlog_backtrace_sigsafe) Support destination-specific
logging levels. Remove stderr support (was never used). Added
support for terminal monitor logging.
(_zlog_assert_failed) Increase message severity to LOG_EMERG.
(openzlog) Remove 2nd argument since default config should be
standardized in library. By default, terminal monitoring
is set to debug, and all other logging is disabled.
(zlog_set_flag,zlog_reset_flag) Removed.
(zlog_set_level) New function to replace zlog_set_flag and
zlog_reset_flag. Supports destination-specific logging levels.
(zlog_set_file,zlog_reset_file) Support file-specific logging level.
(zlog_rotate) Log an error message if fopen fails, and support
new file-specific logging level.
* command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that
command functions will be static instead of global. Remove
declarations for config_exit and config_help. Define new macros
DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can
have deprecated commands in vtysh. Similarly, for completeness,
define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED.
Also, fix bug in ALIAS_ATTR macro (didn't matter because it
was never used).
* command.c: Make many functions static instead of global.
(facility_name,facility_match,level_match) New functions
to support enhanced destination-specific logging levels.
(config_write_host) Support new destination-specific logging levels.
(config_logmsg) Added new "logmsg" command to help test logging
system.
(show_logging) Added "show logging" command to show the current
configuration of the logging system.
(config_log_stdout_level) Support explicit stdout logging level.
(no_config_log_stdout) Now takes optional LEVEL arg.
(config_log_monitor,config_log_monitor_level,no_config_log_monitor)
New commands creating new "log monitor" commands to set terminal
monitoring log level.
(config_log_file_level) Support explicit file logging level.
(config_log_syslog_level) Support explicit syslog logging level.
(config_log_facility,no_config_log_facility) Implement new
"log facility" command.
(cmd_init) Add hooks for new commands: "show logging", "logmsg",
"log stdout <level>", "log monitor", "log monitor <level>",
"no log monitor", "log file <filename> <level>",
"no log file <filename> <level>", "log syslog <level>",
"log facility", and "no log facility".
* vty.h: Added a "level" argument to vty_log so it can support
"log record-priority". Declare new function vty_log_fixed for
use in signal handlers.
* vty.c: (vty_log,vty_log_out) Added a "level" argument to support
"log record-priority" for vty terminal monitors.
(vty_down_level) Use config_exit_cmd.func instead of calling
config_exit directly (since command functions will now be static
instead of global).
(vty_log_fixed) New function to send terminal monitor messages
from inside a signal handler.
2004-12-07 16:39:31 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH_DEPRECATED(VTYSH_ALL, no_vtysh_log_trap, no_vtysh_log_trap_cmd,
|
2017-07-22 14:52:33 +02:00
|
|
|
"no log trap [LEVEL]", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Permit all logging information\n"
|
|
|
|
"Logging level\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
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")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_record_priority,
|
2017-07-22 14:52:33 +02:00
|
|
|
no_vtysh_log_record_priority_cmd, "no log record-priority", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Logging control\n"
|
|
|
|
"Do not log the priority of the message within the message\n")
|
2004-08-26 15:08:30 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-26 15:08:30 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_log_timestamp_precision,
|
|
|
|
vtysh_log_timestamp_precision_cmd, "log timestamp precision (0-6)",
|
|
|
|
"Logging control\n"
|
|
|
|
"Timestamp configuration\n"
|
|
|
|
"Set the timestamp precision\n"
|
|
|
|
"Number of subsecond digits\n")
|
2007-04-29 05:53:31 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2007-04-29 05:53:31 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_log_timestamp_precision,
|
|
|
|
no_vtysh_log_timestamp_precision_cmd, "no log timestamp precision",
|
|
|
|
NO_STR
|
|
|
|
"Logging control\n"
|
|
|
|
"Timestamp configuration\n"
|
|
|
|
"Reset the timestamp precision to the default value of 0\n")
|
2007-04-29 05:53:31 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2007-04-29 05:53:31 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_service_password_encrypt,
|
|
|
|
vtysh_service_password_encrypt_cmd, "service password-encryption",
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Enable encrypted passwords\n")
|
2004-10-03 22:11:32 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_service_password_encrypt,
|
|
|
|
no_vtysh_service_password_encrypt_cmd, "no service password-encryption",
|
|
|
|
NO_STR
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Enable encrypted passwords\n")
|
2004-10-03 22:11:32 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_config_password, vtysh_password_cmd,
|
|
|
|
"password [(8-8)] LINE",
|
|
|
|
"Assign the terminal connection password\n"
|
|
|
|
"Specifies a HIDDEN password will follow\n"
|
|
|
|
"The password string\n")
|
2004-10-03 22:11:32 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, vtysh_config_enable_password, vtysh_enable_password_cmd,
|
|
|
|
"enable password [(8-8)] LINE",
|
|
|
|
"Modify enable password parameters\n"
|
|
|
|
"Assign the privileged level password\n"
|
|
|
|
"Specifies a HIDDEN password will follow\n"
|
|
|
|
"The 'enable' password string\n")
|
2004-10-03 22:11:32 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
DEFUNSH(VTYSH_ALL, no_vtysh_config_enable_password,
|
2017-07-22 14:52:33 +02:00
|
|
|
no_vtysh_enable_password_cmd, "no enable password", NO_STR
|
2017-07-17 14:03:14 +02:00
|
|
|
"Modify enable password parameters\n"
|
|
|
|
"Assign the privileged level password\n")
|
2004-10-03 22:11:32 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_write_terminal,
|
|
|
|
vtysh_write_terminal_cmd,
|
2016-10-18 01:36:21 +02:00
|
|
|
"write terminal [<zebra|ripd|ripngd|ospfd|ospf6d|ldpd|bgpd|isisd|pimd>]",
|
2002-12-13 21:15:29 +01:00
|
|
|
"Write running configuration to memory, network, or terminal\n"
|
2016-10-07 04:33:37 +02:00
|
|
|
"Write to terminal\n"
|
|
|
|
"For the zebra daemon\n"
|
|
|
|
"For the rip daemon\n"
|
|
|
|
"For the ripng daemon\n"
|
|
|
|
"For the ospf daemon\n"
|
|
|
|
"For the ospfv6 daemon\n"
|
2016-11-05 00:03:03 +01:00
|
|
|
"For the ldpd daemon\n"
|
2016-10-07 04:33:37 +02:00
|
|
|
"For the bgp daemon\n"
|
|
|
|
"For the isis daemon\n"
|
|
|
|
"For the pim daemon\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
u_int i;
|
|
|
|
char line[] = "do write terminal\n";
|
|
|
|
FILE *fp = NULL;
|
|
|
|
|
|
|
|
if (vtysh_pager_name) {
|
|
|
|
fp = popen(vtysh_pager_name, "w");
|
|
|
|
if (fp == NULL) {
|
|
|
|
perror("popen");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
fp = stdout;
|
|
|
|
|
|
|
|
vty_out(vty, "Building configuration...\n");
|
|
|
|
vty_out(vty, "\nCurrent configuration:\n");
|
|
|
|
vty_out(vty, "!\n");
|
|
|
|
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
if ((argc < 3)
|
|
|
|
|| (strmatch(vtysh_client[i].name, argv[2]->text)))
|
|
|
|
vtysh_client_config(&vtysh_client[i], line);
|
|
|
|
|
|
|
|
/* Integrate vtysh specific configuration. */
|
|
|
|
vtysh_config_write();
|
|
|
|
|
|
|
|
vtysh_config_dump(fp);
|
|
|
|
|
|
|
|
if (vtysh_pager_name && fp) {
|
|
|
|
fflush(fp);
|
|
|
|
if (pclose(fp) == -1) {
|
|
|
|
perror("pclose");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
fp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
vty_out(vty, "end\n");
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2016-10-01 01:03:05 +02:00
|
|
|
DEFUN (vtysh_show_running_config,
|
|
|
|
vtysh_show_running_config_cmd,
|
2016-10-18 01:36:21 +02:00
|
|
|
"show running-config [<zebra|ripd|ripngd|ospfd|ospf6d|ldpd|bgpd|isisd|pimd>]",
|
2016-10-01 01:03:05 +02:00
|
|
|
SHOW_STR
|
|
|
|
"Current operating configuration\n"
|
2015-09-22 21:00:57 +02:00
|
|
|
"For the zebra daemon\n"
|
|
|
|
"For the rip daemon\n"
|
|
|
|
"For the ripng daemon\n"
|
|
|
|
"For the ospf daemon\n"
|
|
|
|
"For the ospfv6 daemon\n"
|
2016-08-02 00:47:15 +02:00
|
|
|
"For the ldp daemon\n"
|
2015-09-22 21:00:57 +02:00
|
|
|
"For the bgp daemon\n"
|
2016-06-01 21:34:21 +02:00
|
|
|
"For the isis daemon\n"
|
|
|
|
"For the pim daemon\n")
|
2015-09-22 21:00:57 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_write_terminal(self, vty, argc, argv);
|
2015-09-22 21:00:57 +02:00
|
|
|
}
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUN (vtysh_integrated_config,
|
|
|
|
vtysh_integrated_config_cmd,
|
|
|
|
"service integrated-vtysh-config",
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Write configuration into integrated file\n")
|
2002-12-13 21:49:00 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vtysh_write_integrated = WRITE_INTEGRATED_YES;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:49:00 +01:00
|
|
|
}
|
|
|
|
|
2004-10-03 22:11:32 +02:00
|
|
|
DEFUN (no_vtysh_integrated_config,
|
|
|
|
no_vtysh_integrated_config_cmd,
|
|
|
|
"no service integrated-vtysh-config",
|
|
|
|
NO_STR
|
|
|
|
"Set up miscellaneous service\n"
|
|
|
|
"Write configuration into integrated file\n")
|
2002-12-13 21:49:00 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vtysh_write_integrated = WRITE_INTEGRATED_NO;
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:49:00 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static void backup_config_file(const char *fbackup)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
char *integrate_sav = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
integrate_sav = malloc(strlen(fbackup) + strlen(CONF_BACKUP_EXT) + 1);
|
|
|
|
strcpy(integrate_sav, fbackup);
|
|
|
|
strcat(integrate_sav, CONF_BACKUP_EXT);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* Move current configuration file to backup config file. */
|
|
|
|
unlink(integrate_sav);
|
|
|
|
rename(fbackup, integrate_sav);
|
|
|
|
free(integrate_sav);
|
2015-05-20 03:29:18 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
int vtysh_write_config_integrated(void)
|
2015-05-20 03:29:18 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
u_int i;
|
|
|
|
char line[] = "do write terminal\n";
|
|
|
|
FILE *fp;
|
|
|
|
int fd;
|
|
|
|
struct passwd *pwentry;
|
|
|
|
struct group *grentry;
|
|
|
|
uid_t uid = -1;
|
|
|
|
gid_t gid = -1;
|
|
|
|
struct stat st;
|
|
|
|
int err = 0;
|
2015-05-20 03:29:18 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
fprintf(stdout, "Building Configuration...\n");
|
2015-05-20 03:29:18 +02:00
|
|
|
|
2017-08-27 20:57:34 +02:00
|
|
|
backup_config_file(frr_config);
|
|
|
|
fp = fopen(frr_config, "w");
|
2017-07-17 14:03:14 +02:00
|
|
|
if (fp == NULL) {
|
|
|
|
fprintf(stdout,
|
|
|
|
"%% Error: failed to open configuration file %s: %s\n",
|
2017-08-27 20:57:34 +02:00
|
|
|
frr_config, safe_strerror(errno));
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_WARNING_CONFIG_FAILED;
|
|
|
|
}
|
|
|
|
fd = fileno(fp);
|
2015-05-20 03:29:18 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
vtysh_client_config(&vtysh_client[i], line);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vtysh_config_write();
|
|
|
|
vtysh_config_dump(fp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (fchmod(fd, CONFIGFILE_MASK) != 0) {
|
|
|
|
printf("%% Warning: can't chmod configuration file %s: %s\n",
|
2017-08-27 20:57:34 +02:00
|
|
|
frr_config, safe_strerror(errno));
|
2017-07-17 14:03:14 +02:00
|
|
|
err++;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-05-23 20:23:04 +02:00
|
|
|
#ifdef FRR_USER
|
2017-07-17 14:03:14 +02:00
|
|
|
pwentry = getpwnam(FRR_USER);
|
|
|
|
if (pwentry)
|
|
|
|
uid = pwentry->pw_uid;
|
|
|
|
else {
|
|
|
|
printf("%% Warning: could not look up user \"%s\"\n", FRR_USER);
|
|
|
|
err++;
|
|
|
|
}
|
2017-05-23 20:23:04 +02:00
|
|
|
#endif
|
|
|
|
#ifdef FRR_GROUP
|
2017-07-17 14:03:14 +02:00
|
|
|
grentry = getgrnam(FRR_GROUP);
|
|
|
|
if (grentry)
|
|
|
|
gid = grentry->gr_gid;
|
|
|
|
else {
|
|
|
|
printf("%% Warning: could not look up group \"%s\"\n",
|
|
|
|
FRR_GROUP);
|
|
|
|
err++;
|
|
|
|
}
|
2017-05-23 20:23:04 +02:00
|
|
|
#endif
|
2002-12-13 21:49:00 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (!fstat(fd, &st)) {
|
|
|
|
if (st.st_uid == uid)
|
|
|
|
uid = -1;
|
|
|
|
if (st.st_gid == gid)
|
|
|
|
gid = -1;
|
|
|
|
if ((uid != (uid_t)-1 || gid != (gid_t)-1)
|
|
|
|
&& fchown(fd, uid, gid)) {
|
|
|
|
printf("%% Warning: can't chown configuration file %s: %s\n",
|
2017-08-27 20:57:34 +02:00
|
|
|
frr_config, safe_strerror(errno));
|
2017-07-17 14:03:14 +02:00
|
|
|
err++;
|
|
|
|
}
|
|
|
|
} else {
|
2017-08-27 20:57:34 +02:00
|
|
|
printf("%% Warning: stat() failed on %s: %s\n", frr_config,
|
2017-07-17 14:03:14 +02:00
|
|
|
safe_strerror(errno));
|
|
|
|
err++;
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
2017-08-27 20:57:34 +02:00
|
|
|
printf("Integrated configuration saved to %s\n", frr_config);
|
2017-07-17 14:03:14 +02:00
|
|
|
if (err)
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
|
|
|
printf("[OK]\n");
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2016-11-08 19:01:06 +01:00
|
|
|
static bool want_config_integrated(void)
|
2016-09-26 22:01:37 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
struct stat s;
|
|
|
|
|
|
|
|
switch (vtysh_write_integrated) {
|
|
|
|
case WRITE_INTEGRATED_UNSPECIFIED:
|
2017-08-27 20:57:34 +02:00
|
|
|
if (stat(frr_config, &s) && errno == ENOENT)
|
2017-07-17 14:03:14 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
case WRITE_INTEGRATED_NO:
|
|
|
|
return false;
|
|
|
|
case WRITE_INTEGRATED_YES:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return true;
|
2016-09-26 22:01:37 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:49:00 +01:00
|
|
|
DEFUN (vtysh_write_memory,
|
|
|
|
vtysh_write_memory_cmd,
|
2016-10-01 01:03:05 +02:00
|
|
|
"write [<memory|file>]",
|
2002-12-13 21:49:00 +01:00
|
|
|
"Write running configuration to memory, network, or terminal\n"
|
2016-10-01 01:03:05 +02:00
|
|
|
"Write configuration to the file (same as write file)\n"
|
|
|
|
"Write configuration to the file (same as write memory)\n")
|
2002-12-13 21:49:00 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
int ret = CMD_SUCCESS;
|
|
|
|
char line[] = "do write memory\n";
|
|
|
|
u_int i;
|
|
|
|
|
|
|
|
fprintf(stdout,
|
|
|
|
"Note: this version of vtysh never writes vtysh.conf\n");
|
|
|
|
|
|
|
|
/* If integrated frr.conf explicitely set. */
|
|
|
|
if (want_config_integrated()) {
|
|
|
|
ret = CMD_WARNING_CONFIG_FAILED;
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
if (vtysh_client[i].flag == VTYSH_WATCHFRR)
|
|
|
|
break;
|
|
|
|
if (i < array_size(vtysh_client) && vtysh_client[i].fd != -1)
|
|
|
|
ret = vtysh_client_execute(&vtysh_client[i],
|
|
|
|
"do write integrated",
|
|
|
|
stdout);
|
|
|
|
|
|
|
|
if (ret != CMD_SUCCESS) {
|
|
|
|
printf("\nWarning: attempting direct configuration write without "
|
|
|
|
"watchfrr.\nFile permissions and ownership may be "
|
|
|
|
"incorrect, or write may fail.\n\n");
|
|
|
|
ret = vtysh_write_config_integrated();
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2015-05-20 03:29:18 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
fprintf(stdout, "Building Configuration...\n");
|
2015-05-20 03:29:18 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
ret = vtysh_client_execute(&vtysh_client[i], line, stdout);
|
2002-12-13 21:49:00 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return ret;
|
2002-12-13 21:49:00 +01:00
|
|
|
}
|
|
|
|
|
2016-10-01 01:03:05 +02:00
|
|
|
DEFUN (vtysh_copy_running_config,
|
|
|
|
vtysh_copy_running_config_cmd,
|
|
|
|
"copy running-config startup-config",
|
2002-12-13 21:15:29 +01:00
|
|
|
"Copy from one file to another\n"
|
|
|
|
"Copy from current system configuration\n"
|
|
|
|
"Copy to startup configuration\n")
|
2016-10-01 01:03:05 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return vtysh_write_memory(self, vty, argc, argv);
|
2016-10-01 01:03:05 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-08-27 15:56:39 +02:00
|
|
|
DEFUN (vtysh_terminal_length,
|
|
|
|
vtysh_terminal_length_cmd,
|
2016-09-23 15:47:20 +02:00
|
|
|
"terminal length (0-512)",
|
2004-08-27 15:56:39 +02:00
|
|
|
"Set terminal line parameters\n"
|
|
|
|
"Set number of lines on a screen\n"
|
|
|
|
"Number of lines on screen (0 for no pausing)\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
int idx_number = 2;
|
|
|
|
int lines;
|
|
|
|
char *endptr = NULL;
|
|
|
|
char default_pager[10];
|
2004-08-27 15:56:39 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
lines = strtol(argv[idx_number]->arg, &endptr, 10);
|
|
|
|
if (lines < 0 || lines > 512 || *endptr != '\0') {
|
|
|
|
vty_out(vty, "length is malformed\n");
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2004-08-27 15:56:39 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vtysh_pager_name) {
|
|
|
|
free(vtysh_pager_name);
|
|
|
|
vtysh_pager_name = NULL;
|
|
|
|
}
|
2004-08-27 15:56:39 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
if (lines != 0) {
|
|
|
|
snprintf(default_pager, 10, "more -%i", lines);
|
|
|
|
vtysh_pager_name = strdup(default_pager);
|
|
|
|
}
|
2004-08-27 15:56:39 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-08-27 15:56:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_terminal_no_length,
|
|
|
|
vtysh_terminal_no_length_cmd,
|
|
|
|
"terminal no length",
|
|
|
|
"Set terminal line parameters\n"
|
|
|
|
NO_STR
|
|
|
|
"Set number of lines on a screen\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (vtysh_pager_name) {
|
|
|
|
free(vtysh_pager_name);
|
|
|
|
vtysh_pager_name = NULL;
|
|
|
|
}
|
2004-08-27 15:56:39 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
vtysh_pager_init();
|
|
|
|
return CMD_SUCCESS;
|
2004-08-27 15:56:39 +02:00
|
|
|
}
|
|
|
|
|
2004-10-28 19:43:11 +02:00
|
|
|
DEFUN (vtysh_show_daemons,
|
|
|
|
vtysh_show_daemons_cmd,
|
|
|
|
"show daemons",
|
2004-10-03 22:11:32 +02:00
|
|
|
SHOW_STR
|
|
|
|
"Show list of running daemons\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
u_int i;
|
2005-01-28 22:11:46 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
if (vtysh_client[i].fd >= 0)
|
|
|
|
vty_out(vty, " %s", vtysh_client[i].name);
|
|
|
|
vty_out(vty, "\n");
|
2004-10-03 22:11:32 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2004-10-03 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Execute command in child process. */
|
2017-07-17 14:03:14 +02:00
|
|
|
static void execute_command(const char *command, int argc,
|
2017-07-31 14:52:10 +02:00
|
|
|
const char *arg1, const char *arg2)
|
2017-07-17 14:03:14 +02:00
|
|
|
{
|
|
|
|
pid_t pid;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
/* Call fork(). */
|
|
|
|
pid = fork();
|
|
|
|
|
|
|
|
if (pid < 0) {
|
|
|
|
/* Failure of fork(). */
|
|
|
|
fprintf(stderr, "Can't fork: %s\n", safe_strerror(errno));
|
|
|
|
exit(1);
|
|
|
|
} else if (pid == 0) {
|
|
|
|
/* This is child process. */
|
|
|
|
switch (argc) {
|
|
|
|
case 0:
|
|
|
|
execlp(command, command, (const char *)NULL);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
execlp(command, command, arg1, (const char *)NULL);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
execlp(command, command, arg1, arg2,
|
|
|
|
(const char *)NULL);
|
|
|
|
break;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
/* When execlp suceed, this part is not executed. */
|
|
|
|
fprintf(stderr, "Can't execute %s: %s\n", command,
|
|
|
|
safe_strerror(errno));
|
|
|
|
exit(1);
|
|
|
|
} else {
|
|
|
|
/* This is parent. */
|
|
|
|
execute_flag = 1;
|
|
|
|
wait4(pid, &status, 0, NULL);
|
|
|
|
execute_flag = 0;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_ping,
|
|
|
|
vtysh_ping_cmd,
|
|
|
|
"ping WORD",
|
2003-06-25 12:49:55 +02:00
|
|
|
"Send echo messages\n"
|
2002-12-13 21:15:29 +01:00
|
|
|
"Ping destination address or hostname\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
int idx = 1;
|
|
|
|
|
|
|
|
argv_find(argv, argc, "WORD", &idx);
|
|
|
|
execute_command("ping", 1, argv[idx]->arg, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
ALIAS(vtysh_ping, vtysh_ping_ip_cmd, "ping ip WORD",
|
|
|
|
"Send echo messages\n"
|
|
|
|
"IP echo\n"
|
|
|
|
"Ping destination address or hostname\n")
|
2003-06-25 12:49:55 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_traceroute,
|
|
|
|
vtysh_traceroute_cmd,
|
|
|
|
"traceroute WORD",
|
|
|
|
"Trace route to destination\n"
|
|
|
|
"Trace route to destination address or hostname\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
int idx = 1;
|
|
|
|
|
|
|
|
argv_find(argv, argc, "WORD", &idx);
|
|
|
|
execute_command("traceroute", 1, argv[idx]->arg, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
ALIAS(vtysh_traceroute, vtysh_traceroute_ip_cmd, "traceroute ip WORD",
|
|
|
|
"Trace route to destination\n"
|
|
|
|
"IP trace\n"
|
|
|
|
"Trace route to destination address or hostname\n")
|
2003-06-25 12:49:55 +02:00
|
|
|
|
|
|
|
DEFUN (vtysh_ping6,
|
|
|
|
vtysh_ping6_cmd,
|
|
|
|
"ping ipv6 WORD",
|
|
|
|
"Send echo messages\n"
|
|
|
|
"IPv6 echo\n"
|
|
|
|
"Ping destination address or hostname\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
execute_command("ping6", 1, argv[2]->arg, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2003-06-25 12:49:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_traceroute6,
|
|
|
|
vtysh_traceroute6_cmd,
|
|
|
|
"traceroute ipv6 WORD",
|
|
|
|
"Trace route to destination\n"
|
|
|
|
"IPv6 trace\n"
|
|
|
|
"Trace route to destination address or hostname\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
execute_command("traceroute6", 1, argv[2]->arg, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2003-06-25 12:49:55 +02:00
|
|
|
}
|
|
|
|
|
2015-08-13 01:11:07 +02:00
|
|
|
#if defined(HAVE_SHELL_ACCESS)
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_telnet,
|
|
|
|
vtysh_telnet_cmd,
|
|
|
|
"telnet WORD",
|
|
|
|
"Open a telnet connection\n"
|
|
|
|
"IP address or hostname of a remote system\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
execute_command("telnet", 1, argv[1]->arg, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_telnet_port,
|
|
|
|
vtysh_telnet_port_cmd,
|
|
|
|
"telnet WORD PORT",
|
|
|
|
"Open a telnet connection\n"
|
|
|
|
"IP address or hostname of a remote system\n"
|
|
|
|
"TCP Port number\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
execute_command("telnet", 2, argv[1]->arg, argv[2]->arg);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-01-25 07:56:09 +01:00
|
|
|
DEFUN (vtysh_ssh,
|
|
|
|
vtysh_ssh_cmd,
|
|
|
|
"ssh WORD",
|
|
|
|
"Open an ssh connection\n"
|
|
|
|
"[user@]host\n")
|
|
|
|
{
|
2017-07-31 14:52:10 +02:00
|
|
|
execute_command("ssh", 1, argv[1]->arg, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
return CMD_SUCCESS;
|
2003-01-25 07:56:09 +01:00
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (vtysh_start_shell,
|
|
|
|
vtysh_start_shell_cmd,
|
|
|
|
"start-shell",
|
|
|
|
"Start UNIX shell\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
execute_command("sh", 0, NULL, NULL);
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_start_bash,
|
|
|
|
vtysh_start_bash_cmd,
|
|
|
|
"start-shell bash",
|
|
|
|
"Start UNIX shell\n"
|
|
|
|
"Start bash\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
execute_command("bash", 0, NULL, NULL);
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (vtysh_start_zsh,
|
|
|
|
vtysh_start_zsh_cmd,
|
|
|
|
"start-shell zsh",
|
|
|
|
"Start UNIX shell\n"
|
|
|
|
"Start Z shell\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
execute_command("zsh", 0, NULL, NULL);
|
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
2015-08-13 01:11:07 +02:00
|
|
|
#endif
|
2004-08-25 14:22:00 +02:00
|
|
|
|
2016-11-16 07:00:52 +01:00
|
|
|
DEFUN (config_list,
|
|
|
|
config_list_cmd,
|
|
|
|
"list [permutations]",
|
|
|
|
"Print command list\n"
|
|
|
|
"Print all possible command permutations\n")
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return cmd_list_cmds(vty, argc == 2);
|
2016-11-16 07:00:52 +01:00
|
|
|
}
|
|
|
|
|
2017-07-25 20:20:55 +02:00
|
|
|
DEFUN(find,
|
|
|
|
find_cmd,
|
|
|
|
"find COMMAND...",
|
|
|
|
"Find CLI command containing text\n"
|
|
|
|
"Text to search for\n")
|
|
|
|
{
|
|
|
|
char *text = argv_concat(argv, argc, 1);
|
|
|
|
const struct cmd_node *node;
|
|
|
|
const struct cmd_element *cli;
|
|
|
|
vector clis;
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < vector_active(cmdvec); i++) {
|
|
|
|
node = vector_slot(cmdvec, i);
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
clis = node->cmd_vector;
|
|
|
|
for (unsigned int j = 0; j < vector_active(clis); j++) {
|
|
|
|
cli = vector_slot(clis, j);
|
|
|
|
if (strcasestr(cli->string, text))
|
|
|
|
fprintf(stdout, " (%s) %s\n",
|
|
|
|
node_names[node->node], cli->string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XFREE(MTYPE_TMP, text);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static void vtysh_install_default(enum node_type node)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(node, &config_list_cmd);
|
2017-07-25 20:20:55 +02:00
|
|
|
install_element(node, &find_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Making connection to protocol daemon. */
|
2017-07-17 14:03:14 +02:00
|
|
|
static int vtysh_connect(struct vtysh_client *vclient)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int sock, len;
|
|
|
|
struct sockaddr_un addr;
|
|
|
|
struct stat s_stat;
|
|
|
|
const char *path;
|
|
|
|
|
|
|
|
if (!vclient->path[0])
|
|
|
|
snprintf(vclient->path, sizeof(vclient->path), "%s/%s.vty",
|
2017-08-27 20:57:34 +02:00
|
|
|
vtydir, vclient->name);
|
2017-07-17 14:03:14 +02:00
|
|
|
path = vclient->path;
|
|
|
|
|
|
|
|
/* Stat socket to see if we have permission to access it. */
|
|
|
|
ret = stat(path, &s_stat);
|
|
|
|
if (ret < 0 && errno != ENOENT) {
|
|
|
|
fprintf(stderr, "vtysh_connect(%s): stat = %s\n", path,
|
|
|
|
safe_strerror(errno));
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret >= 0) {
|
|
|
|
if (!S_ISSOCK(s_stat.st_mode)) {
|
|
|
|
fprintf(stderr, "vtysh_connect(%s): Not a socket\n",
|
|
|
|
path);
|
|
|
|
exit(1);
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
|
|
|
if (sock < 0) {
|
2002-12-13 21:15:29 +01:00
|
|
|
#ifdef DEBUG
|
2017-07-17 14:03:14 +02:00
|
|
|
fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path,
|
|
|
|
safe_strerror(errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* DEBUG */
|
2017-07-17 14:03:14 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
memset(&addr, 0, sizeof(struct sockaddr_un));
|
|
|
|
addr.sun_family = AF_UNIX;
|
|
|
|
strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
|
[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>
* configure.ac: sys/conf.h depends on sys/param.h, at least on
FBSD 6.2.
(bug #363) Should check for in_pktinfo for IRDP
2006-05-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: General cleanup of header and type checks, introducing
an internal define, QUAGGA_INCLUDES, to build up a list of
stuff to include so as to avoid 'present but cant be compiled'
warnings.
Misc additional checks of things missing according to autoscan.
Add LIBM, for bgpd's use of libm, so as to avoid burdening
LIBS, and all the binaries, with libm linkage.
Remove the bad practice of using m4 changequote(), just
quote the []'s in the case statements properly.
This should fix bugs 162, 303 and 178.
* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 04:38:51 +02:00
|
|
|
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
|
2017-07-17 14:03:14 +02:00
|
|
|
len = addr.sun_len = SUN_LEN(&addr);
|
2002-12-13 21:15:29 +01:00
|
|
|
#else
|
2017-07-17 14:03:14 +02:00
|
|
|
len = sizeof(addr.sun_family) + strlen(addr.sun_path);
|
[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>
* configure.ac: sys/conf.h depends on sys/param.h, at least on
FBSD 6.2.
(bug #363) Should check for in_pktinfo for IRDP
2006-05-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: General cleanup of header and type checks, introducing
an internal define, QUAGGA_INCLUDES, to build up a list of
stuff to include so as to avoid 'present but cant be compiled'
warnings.
Misc additional checks of things missing according to autoscan.
Add LIBM, for bgpd's use of libm, so as to avoid burdening
LIBS, and all the binaries, with libm linkage.
Remove the bad practice of using m4 changequote(), just
quote the []'s in the case statements properly.
This should fix bugs 162, 303 and 178.
* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 04:38:51 +02:00
|
|
|
#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
ret = connect(sock, (struct sockaddr *)&addr, len);
|
|
|
|
if (ret < 0) {
|
2002-12-13 21:15:29 +01:00
|
|
|
#ifdef DEBUG
|
2017-07-17 14:03:14 +02:00
|
|
|
fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path,
|
|
|
|
safe_strerror(errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* DEBUG */
|
2017-07-17 14:03:14 +02:00
|
|
|
close(sock);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
vclient->fd = sock;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
return 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
/* Return true if str ends with suffix, else return false */
|
2017-07-17 14:03:14 +02:00
|
|
|
static int ends_with(const char *str, const char *suffix)
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
if (!str || !suffix)
|
|
|
|
return 0;
|
|
|
|
size_t lenstr = strlen(str);
|
|
|
|
size_t lensuffix = strlen(suffix);
|
|
|
|
if (lensuffix > lenstr)
|
|
|
|
return 0;
|
|
|
|
return strncmp(str + lenstr - lensuffix, suffix, lensuffix) == 0;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static void vtysh_client_sorted_insert(struct vtysh_client *head_client,
|
|
|
|
struct vtysh_client *client)
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
struct vtysh_client *prev_node, *current_node;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
prev_node = head_client;
|
|
|
|
current_node = head_client->next;
|
|
|
|
while (current_node) {
|
|
|
|
if (strcmp(current_node->path, client->path) > 0)
|
|
|
|
break;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
prev_node = current_node;
|
|
|
|
current_node = current_node->next;
|
|
|
|
}
|
|
|
|
client->next = current_node;
|
|
|
|
prev_node->next = client;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define MAXIMUM_INSTANCES 10
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
static void vtysh_update_all_insances(struct vtysh_client *head_client)
|
|
|
|
{
|
|
|
|
struct vtysh_client *client;
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *file;
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
if (head_client->flag != VTYSH_OSPFD)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ls vty_sock_dir and look for all files ending in .vty */
|
2017-08-27 20:57:34 +02:00
|
|
|
dir = opendir(vtydir);
|
2017-07-17 14:03:14 +02:00
|
|
|
if (dir) {
|
|
|
|
while ((file = readdir(dir)) != NULL) {
|
|
|
|
if (begins_with(file->d_name, "ospfd-")
|
|
|
|
&& ends_with(file->d_name, ".vty")) {
|
|
|
|
if (n == MAXIMUM_INSTANCES) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"Parsing %s, client limit(%d) reached!\n",
|
2017-08-27 20:57:34 +02:00
|
|
|
vtydir, n);
|
2017-07-17 14:03:14 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
client = (struct vtysh_client *)malloc(
|
|
|
|
sizeof(struct vtysh_client));
|
|
|
|
client->fd = -1;
|
|
|
|
client->name = "ospfd";
|
|
|
|
client->flag = VTYSH_OSPFD;
|
|
|
|
snprintf(client->path, sizeof(client->path),
|
2017-08-27 20:57:34 +02:00
|
|
|
"%s/%s", vtydir, file->d_name);
|
2017-07-17 14:03:14 +02:00
|
|
|
client->next = NULL;
|
|
|
|
vtysh_client_sorted_insert(head_client, client);
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vtysh_connect_all_instances(struct vtysh_client *head_client)
|
|
|
|
{
|
|
|
|
struct vtysh_client *client;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
vtysh_update_all_insances(head_client);
|
|
|
|
|
|
|
|
client = head_client->next;
|
|
|
|
while (client) {
|
|
|
|
if (vtysh_connect(client) == 0)
|
|
|
|
rc++;
|
|
|
|
client = client->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int vtysh_connect_all(const char *daemon_name)
|
|
|
|
{
|
|
|
|
u_int i;
|
|
|
|
int rc = 0;
|
|
|
|
int matches = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < array_size(vtysh_client); i++) {
|
|
|
|
if (!daemon_name
|
|
|
|
|| !strcmp(daemon_name, vtysh_client[i].name)) {
|
|
|
|
matches++;
|
|
|
|
if (vtysh_connect(&vtysh_client[i]) == 0)
|
|
|
|
rc++;
|
|
|
|
|
|
|
|
rc += vtysh_connect_all_instances(&vtysh_client[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!matches)
|
|
|
|
fprintf(stderr, "Error: no daemons match name %s!\n",
|
|
|
|
daemon_name);
|
|
|
|
return rc;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2004-08-26 15:08:30 +02:00
|
|
|
/* To disable readline's filename completion. */
|
2017-07-17 14:03:14 +02:00
|
|
|
static char *vtysh_completion_entry_function(const char *ignore,
|
|
|
|
int invoking_key)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
return NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
void vtysh_readline_init(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
/* readline related settings. */
|
|
|
|
rl_initialize();
|
|
|
|
rl_bind_key('?', (rl_command_func_t *)vtysh_rl_describe);
|
|
|
|
rl_completion_entry_function = vtysh_completion_entry_function;
|
|
|
|
rl_attempted_completion_function =
|
|
|
|
(rl_completion_func_t *)new_completion;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
char *vtysh_prompt(void)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
static char buf[100];
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2017-08-29 01:52:29 +02:00
|
|
|
snprintf(buf, sizeof buf, cmd_prompt(vty->node), cmd_hostname_get());
|
2017-07-17 14:03:14 +02:00
|
|
|
return buf;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2017-05-10 16:38:48 +02:00
|
|
|
static void vtysh_ac_line(void *arg, const char *line)
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
vector comps = arg;
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < vector_active(comps); i++)
|
|
|
|
if (!strcmp(line, (char *)vector_slot(comps, i)))
|
|
|
|
return;
|
|
|
|
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, line));
|
2017-05-10 16:38:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void vtysh_autocomplete(vector comps, struct cmd_token *token)
|
|
|
|
{
|
2017-07-17 14:03:14 +02:00
|
|
|
char accmd[256];
|
|
|
|
size_t i;
|
2017-05-10 16:38:48 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
snprintf(accmd, sizeof(accmd), "autocomplete %d %s %s", token->type,
|
|
|
|
token->text, token->varname ? token->varname : "-");
|
2017-05-10 16:38:48 +02:00
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
for (i = 0; i < array_size(vtysh_client); i++)
|
|
|
|
vtysh_client_run_all(&vtysh_client[i], accmd, 1, NULL,
|
|
|
|
vtysh_ac_line, comps);
|
2017-05-10 16:38:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-20 16:50:52 +02:00
|
|
|
static const struct cmd_variable_handler vtysh_var_handler[] = {
|
2017-07-17 14:03:14 +02:00
|
|
|
{/* match all */
|
|
|
|
.tokenname = NULL,
|
|
|
|
.varname = NULL,
|
|
|
|
.completions = vtysh_autocomplete},
|
|
|
|
{.completions = NULL}};
|
|
|
|
|
|
|
|
void vtysh_init_vty(void)
|
|
|
|
{
|
|
|
|
/* Make vty structure. */
|
|
|
|
vty = vty_new();
|
|
|
|
vty->type = VTY_SHELL;
|
|
|
|
vty->node = VIEW_NODE;
|
|
|
|
|
|
|
|
/* Initialize commands. */
|
|
|
|
cmd_init(0);
|
|
|
|
cmd_variable_handler_register(vtysh_var_handler);
|
|
|
|
|
|
|
|
/* Install nodes. */
|
|
|
|
install_node(&bgp_node, NULL);
|
|
|
|
install_node(&rip_node, NULL);
|
|
|
|
install_node(&interface_node, NULL);
|
2017-08-02 01:16:28 +02:00
|
|
|
install_node(&pw_node, NULL);
|
2017-07-17 14:03:14 +02:00
|
|
|
install_node(&link_params_node, NULL);
|
|
|
|
install_node(&ns_node, NULL);
|
|
|
|
install_node(&vrf_node, NULL);
|
|
|
|
install_node(&rmap_node, NULL);
|
|
|
|
install_node(&zebra_node, NULL);
|
|
|
|
install_node(&bgp_vpnv4_node, NULL);
|
|
|
|
install_node(&bgp_vpnv6_node, NULL);
|
|
|
|
install_node(&bgp_ipv4_node, NULL);
|
|
|
|
install_node(&bgp_ipv4m_node, NULL);
|
|
|
|
install_node(&bgp_ipv4l_node, NULL);
|
|
|
|
install_node(&bgp_ipv6_node, NULL);
|
|
|
|
install_node(&bgp_ipv6m_node, NULL);
|
|
|
|
install_node(&bgp_ipv6l_node, NULL);
|
|
|
|
install_node(&bgp_vrf_policy_node, NULL);
|
|
|
|
install_node(&bgp_evpn_node, NULL);
|
|
|
|
install_node(&bgp_evpn_vni_node, NULL);
|
|
|
|
install_node(&bgp_vnc_defaults_node, NULL);
|
|
|
|
install_node(&bgp_vnc_nve_group_node, NULL);
|
|
|
|
install_node(&bgp_vnc_l2_group_node, NULL);
|
|
|
|
install_node(&ospf_node, NULL);
|
|
|
|
install_node(&eigrp_node, NULL);
|
|
|
|
install_node(&babel_node, NULL);
|
|
|
|
install_node(&ripng_node, NULL);
|
|
|
|
install_node(&ospf6_node, NULL);
|
|
|
|
install_node(&ldp_node, NULL);
|
|
|
|
install_node(&ldp_ipv4_node, NULL);
|
|
|
|
install_node(&ldp_ipv6_node, NULL);
|
|
|
|
install_node(&ldp_ipv4_iface_node, NULL);
|
|
|
|
install_node(&ldp_ipv6_iface_node, NULL);
|
|
|
|
install_node(&ldp_l2vpn_node, NULL);
|
|
|
|
install_node(&ldp_pseudowire_node, NULL);
|
|
|
|
install_node(&keychain_node, NULL);
|
|
|
|
install_node(&keychain_key_node, NULL);
|
|
|
|
install_node(&isis_node, NULL);
|
|
|
|
install_node(&vty_node, NULL);
|
|
|
|
|
2017-07-25 20:20:55 +02:00
|
|
|
struct cmd_node *node;
|
|
|
|
for (unsigned int i = 0; i < vector_active(cmdvec); i++) {
|
|
|
|
node = vector_slot(cmdvec, i);
|
|
|
|
if (!node || node->node == VIEW_NODE)
|
|
|
|
continue;
|
|
|
|
vtysh_install_default(node->node);
|
|
|
|
}
|
2017-07-17 14:03:14 +02:00
|
|
|
|
|
|
|
install_element(VIEW_NODE, &vtysh_enable_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_config_terminal_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_disable_cmd);
|
|
|
|
|
|
|
|
/* "exit" command. */
|
|
|
|
install_element(VIEW_NODE, &vtysh_exit_all_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_exit_all_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_quit_all_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_quit_all_cmd);
|
|
|
|
install_element(RIP_NODE, &vtysh_exit_ripd_cmd);
|
|
|
|
install_element(RIP_NODE, &vtysh_quit_ripd_cmd);
|
|
|
|
install_element(RIPNG_NODE, &vtysh_exit_ripngd_cmd);
|
|
|
|
install_element(RIPNG_NODE, &vtysh_quit_ripngd_cmd);
|
|
|
|
install_element(OSPF_NODE, &vtysh_exit_ospfd_cmd);
|
|
|
|
install_element(OSPF_NODE, &vtysh_quit_ospfd_cmd);
|
|
|
|
install_element(EIGRP_NODE, &vtysh_exit_eigrpd_cmd);
|
|
|
|
install_element(EIGRP_NODE, &vtysh_quit_eigrpd_cmd);
|
|
|
|
install_element(BABEL_NODE, &vtysh_exit_babeld_cmd);
|
|
|
|
install_element(BABEL_NODE, &vtysh_quit_babeld_cmd);
|
|
|
|
install_element(OSPF6_NODE, &vtysh_exit_ospf6d_cmd);
|
|
|
|
install_element(OSPF6_NODE, &vtysh_quit_ospf6d_cmd);
|
|
|
|
#if defined(HAVE_LDPD)
|
|
|
|
install_element(LDP_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_NODE, &vtysh_quit_ldpd_cmd);
|
|
|
|
install_element(LDP_IPV4_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_IPV4_NODE, &vtysh_quit_ldpd_cmd);
|
2017-07-27 00:32:55 +02:00
|
|
|
install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd);
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(LDP_IPV6_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_IPV6_NODE, &vtysh_quit_ldpd_cmd);
|
2017-07-27 00:32:55 +02:00
|
|
|
install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd);
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(LDP_IPV4_IFACE_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_IPV4_IFACE_NODE, &vtysh_quit_ldpd_cmd);
|
|
|
|
install_element(LDP_IPV6_IFACE_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_IPV6_IFACE_NODE, &vtysh_quit_ldpd_cmd);
|
|
|
|
install_element(LDP_L2VPN_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_L2VPN_NODE, &vtysh_quit_ldpd_cmd);
|
|
|
|
install_element(LDP_PSEUDOWIRE_NODE, &vtysh_exit_ldpd_cmd);
|
|
|
|
install_element(LDP_PSEUDOWIRE_NODE, &vtysh_quit_ldpd_cmd);
|
2016-10-24 21:24:03 +02:00
|
|
|
#endif
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(BGP_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_VPNV4_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_VPNV6_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_VPNV6_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV4M_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV4L_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV4L_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV6_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV6_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV6M_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV6M_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_EVPN_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_EVPN_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_EVPN_VNI_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_EVPN_VNI_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV6L_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_IPV6L_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
#if defined(ENABLE_BGP_VNC)
|
|
|
|
install_element(BGP_VRF_POLICY_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_VRF_POLICY_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_quit_bgpd_cmd);
|
|
|
|
install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_exit_bgpd_cmd);
|
|
|
|
install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_quit_bgpd_cmd);
|
2016-10-24 21:24:03 +02:00
|
|
|
#endif
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(ISIS_NODE, &vtysh_exit_isisd_cmd);
|
|
|
|
install_element(ISIS_NODE, &vtysh_quit_isisd_cmd);
|
|
|
|
install_element(KEYCHAIN_NODE, &vtysh_exit_ripd_cmd);
|
|
|
|
install_element(KEYCHAIN_NODE, &vtysh_quit_ripd_cmd);
|
|
|
|
install_element(KEYCHAIN_KEY_NODE, &vtysh_exit_ripd_cmd);
|
|
|
|
install_element(KEYCHAIN_KEY_NODE, &vtysh_quit_ripd_cmd);
|
|
|
|
install_element(RMAP_NODE, &vtysh_exit_rmap_cmd);
|
|
|
|
install_element(RMAP_NODE, &vtysh_quit_rmap_cmd);
|
|
|
|
install_element(VTY_NODE, &vtysh_exit_line_vty_cmd);
|
|
|
|
install_element(VTY_NODE, &vtysh_quit_line_vty_cmd);
|
|
|
|
|
|
|
|
/* "end" command. */
|
|
|
|
install_element(CONFIG_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(RIP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(RIPNG_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(OSPF_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(EIGRP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BABEL_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(OSPF6_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_IPV4_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_IPV6_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_IPV4_IFACE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_IPV6_IFACE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_L2VPN_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LDP_PSEUDOWIRE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_IPV4_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_IPV4M_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_IPV4L_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_VPNV4_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_VPNV6_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_IPV6_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_IPV6M_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_IPV6L_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_VRF_POLICY_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_EVPN_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_EVPN_VNI_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(ISIS_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(KEYCHAIN_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(KEYCHAIN_KEY_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(RMAP_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(VTY_NODE, &vtysh_end_all_cmd);
|
|
|
|
|
|
|
|
install_element(INTERFACE_NODE, &vtysh_interface_desc_cmd);
|
|
|
|
install_element(INTERFACE_NODE, &vtysh_no_interface_desc_cmd);
|
|
|
|
install_element(INTERFACE_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(INTERFACE_NODE, &vtysh_exit_interface_cmd);
|
|
|
|
install_element(LINK_PARAMS_NODE, &exit_link_params_cmd);
|
|
|
|
install_element(LINK_PARAMS_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(LINK_PARAMS_NODE, &vtysh_exit_interface_cmd);
|
|
|
|
install_element(INTERFACE_NODE, &vtysh_quit_interface_cmd);
|
|
|
|
|
2017-08-02 01:16:28 +02:00
|
|
|
install_element(PW_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(PW_NODE, &vtysh_exit_interface_cmd);
|
|
|
|
install_element(PW_NODE, &vtysh_quit_interface_cmd);
|
|
|
|
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(NS_NODE, &vtysh_end_all_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &vtysh_ns_cmd);
|
|
|
|
install_element(NS_NODE, &vtysh_exit_ns_cmd);
|
|
|
|
install_element(NS_NODE, &vtysh_quit_ns_cmd);
|
|
|
|
|
|
|
|
install_element(VRF_NODE, &vtysh_end_all_cmd);
|
|
|
|
install_element(VRF_NODE, &vtysh_exit_vrf_cmd);
|
|
|
|
install_element(VRF_NODE, &vtysh_quit_vrf_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &router_eigrp_cmd);
|
|
|
|
install_element(CONFIG_NODE, &router_babel_cmd);
|
|
|
|
install_element(CONFIG_NODE, &router_rip_cmd);
|
|
|
|
install_element(CONFIG_NODE, &router_ripng_cmd);
|
|
|
|
install_element(CONFIG_NODE, &router_ospf_cmd);
|
|
|
|
install_element(CONFIG_NODE, &router_ospf6_cmd);
|
|
|
|
#if defined(HAVE_LDPD)
|
|
|
|
install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd);
|
|
|
|
install_element(LDP_NODE, &ldp_address_family_ipv4_cmd);
|
|
|
|
install_element(LDP_NODE, &ldp_address_family_ipv6_cmd);
|
|
|
|
install_element(LDP_IPV4_NODE, &ldp_interface_ifname_cmd);
|
|
|
|
install_element(LDP_IPV6_NODE, &ldp_interface_ifname_cmd);
|
|
|
|
install_element(CONFIG_NODE, &ldp_l2vpn_word_type_vpls_cmd);
|
|
|
|
install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_ifname_cmd);
|
2016-10-24 21:24:03 +02:00
|
|
|
#endif
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(CONFIG_NODE, &router_isis_cmd);
|
|
|
|
install_element(CONFIG_NODE, &router_bgp_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_vpnv4_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_vpnv6_cmd);
|
2016-10-24 21:24:03 +02:00
|
|
|
#if defined(ENABLE_BGP_VNC)
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(BGP_NODE, &vnc_vrf_policy_cmd);
|
|
|
|
install_element(BGP_NODE, &vnc_defaults_cmd);
|
|
|
|
install_element(BGP_NODE, &vnc_nve_group_cmd);
|
|
|
|
install_element(BGP_NODE, &vnc_l2_group_cmd);
|
2016-10-24 21:24:03 +02:00
|
|
|
#endif
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(BGP_NODE, &address_family_ipv4_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv4_multicast_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv4_vpn_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv4_labeled_unicast_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv6_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv6_multicast_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv6_vpn_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_ipv6_labeled_unicast_cmd);
|
|
|
|
install_element(BGP_NODE, &address_family_evpn_cmd);
|
|
|
|
#if defined(HAVE_CUMULUS)
|
|
|
|
install_element(BGP_NODE, &address_family_evpn2_cmd);
|
2017-05-16 00:01:57 +02:00
|
|
|
#endif
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(BGP_VPNV4_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_VPNV6_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_IPV4_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_IPV4M_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_IPV4L_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_IPV6_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_IPV6M_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_EVPN_NODE, &exit_address_family_cmd);
|
|
|
|
install_element(BGP_IPV6L_NODE, &exit_address_family_cmd);
|
|
|
|
|
|
|
|
/* EVPN commands */
|
|
|
|
install_element(BGP_EVPN_NODE, &bgp_evpn_vni_cmd);
|
|
|
|
install_element(BGP_EVPN_VNI_NODE, &exit_vni_cmd);
|
|
|
|
|
|
|
|
install_element(BGP_VRF_POLICY_NODE, &exit_vrf_policy_cmd);
|
|
|
|
install_element(BGP_VNC_DEFAULTS_NODE, &exit_vnc_config_cmd);
|
|
|
|
install_element(BGP_VNC_NVE_GROUP_NODE, &exit_vnc_config_cmd);
|
|
|
|
install_element(BGP_VNC_L2_GROUP_NODE, &exit_vnc_config_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &key_chain_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_route_map_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_line_vty_cmd);
|
|
|
|
install_element(KEYCHAIN_NODE, &key_cmd);
|
|
|
|
install_element(KEYCHAIN_NODE, &key_chain_cmd);
|
|
|
|
install_element(KEYCHAIN_KEY_NODE, &key_chain_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_interface_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_no_interface_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_no_interface_vrf_cmd);
|
2017-08-02 01:16:28 +02:00
|
|
|
install_element(CONFIG_NODE, &vtysh_pseudowire_cmd);
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(INTERFACE_NODE, &vtysh_link_params_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_show_running_config_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_copy_running_config_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &vtysh_vrf_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_no_vrf_cmd);
|
|
|
|
|
|
|
|
/* "write terminal" command. */
|
|
|
|
install_element(ENABLE_NODE, &vtysh_write_terminal_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &vtysh_integrated_config_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_integrated_config_cmd);
|
|
|
|
|
|
|
|
/* "write memory" command. */
|
|
|
|
install_element(ENABLE_NODE, &vtysh_write_memory_cmd);
|
|
|
|
|
|
|
|
install_element(VIEW_NODE, &vtysh_terminal_length_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_terminal_no_length_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_show_daemons_cmd);
|
|
|
|
|
|
|
|
install_element(VIEW_NODE, &vtysh_ping_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_ping_ip_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_traceroute_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_traceroute_ip_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_ping6_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_traceroute6_cmd);
|
2015-08-13 01:11:07 +02:00
|
|
|
#if defined(HAVE_SHELL_ACCESS)
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(VIEW_NODE, &vtysh_telnet_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_telnet_port_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_ssh_cmd);
|
2003-06-25 12:49:55 +02:00
|
|
|
#endif
|
2015-08-13 01:11:07 +02:00
|
|
|
#if defined(HAVE_SHELL_ACCESS)
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(ENABLE_NODE, &vtysh_start_shell_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_start_bash_cmd);
|
|
|
|
install_element(ENABLE_NODE, &vtysh_start_zsh_cmd);
|
2015-08-13 01:11:07 +02:00
|
|
|
#endif
|
|
|
|
|
2017-08-18 18:50:13 +02:00
|
|
|
install_element(VIEW_NODE, &vtysh_show_debugging_cmd);
|
2017-08-21 14:34:31 +02:00
|
|
|
install_element(VIEW_NODE, &vtysh_show_debugging_hashtable_cmd);
|
2017-07-17 14:03:14 +02:00
|
|
|
install_element(VIEW_NODE, &vtysh_show_memory_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_show_modules_cmd);
|
|
|
|
|
|
|
|
install_element(VIEW_NODE, &vtysh_show_work_queues_cmd);
|
|
|
|
install_element(VIEW_NODE, &vtysh_show_work_queues_daemon_cmd);
|
|
|
|
|
|
|
|
install_element(VIEW_NODE, &vtysh_show_thread_cmd);
|
|
|
|
|
|
|
|
/* Logging */
|
|
|
|
install_element(VIEW_NODE, &vtysh_show_logging_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_stdout_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_stdout_level_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_stdout_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_file_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_file_level_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_file_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_monitor_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_monitor_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_syslog_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_syslog_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_trap_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_trap_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_facility_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_facility_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_record_priority_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_record_priority_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_log_timestamp_precision_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_log_timestamp_precision_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &vtysh_service_password_encrypt_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_service_password_encrypt_cmd);
|
|
|
|
|
|
|
|
install_element(CONFIG_NODE, &vtysh_password_cmd);
|
|
|
|
install_element(CONFIG_NODE, &vtysh_enable_password_cmd);
|
|
|
|
install_element(CONFIG_NODE, &no_vtysh_enable_password_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|