Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3

Conflicts:
	bgpd/bgp_route.c
This commit is contained in:
Daniel Walton 2017-06-30 17:52:56 +00:00
commit 1161690b93
207 changed files with 8407 additions and 8348 deletions

1
.gitignore vendored
View File

@ -61,6 +61,7 @@ debian/quagga.prerm.debhelper
debian/quagga.substvars
debian/quagga/
debian/tmp/
*.pyc
*.swp
cscope.*
*.pb.h

View File

@ -9,7 +9,9 @@ SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \
solaris pimd nhrpd eigrpd @LIBRFP@ @RFPTEST@ tools snapcraft \
babeld
babeld \
python \
# end
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
update-autotools \

View File

@ -290,8 +290,8 @@ DEFUN (babel_network,
ret = babel_enable_if_add (argv[1]->arg);
if (ret < 0) {
vty_out (vty, "There is same network configuration %s%s", argv[1]->arg,
VTY_NEWLINE);
vty_outln (vty, "There is same network configuration %s",
argv[1]->arg);
return CMD_WARNING;
}
@ -318,8 +318,7 @@ DEFUN (no_babel_network,
ret = babel_enable_if_delete (argv[2]->arg);
if (ret < 0) {
vty_out (vty, "can't find network %s%s", argv[2]->arg,
VTY_NEWLINE);
vty_outln (vty, "can't find network %s",argv[2]->arg);
return CMD_WARNING;
}
@ -430,7 +429,7 @@ DEFUN (babel_set_hello_interval,
babel_interface_nfo *babel_ifp;
int interval;
VTY_GET_INTEGER_RANGE("milliseconds", interval, argv[2]->arg, 20, 10 * 0xFFFE);
interval = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -451,7 +450,7 @@ DEFUN (babel_set_update_interval,
babel_interface_nfo *babel_ifp;
int interval;
VTY_GET_INTEGER_RANGE("milliseconds", interval, argv[2]->arg, 20, 10 * 0xFFFE);
interval = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -471,7 +470,7 @@ DEFUN (babel_set_rxcost,
babel_interface_nfo *babel_ifp;
int rxcost;
VTY_GET_INTEGER_RANGE("units", rxcost, argv[2]->arg, 1, 0x10000 - 1);
rxcost = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -491,7 +490,7 @@ DEFUN (babel_set_rtt_decay,
babel_interface_nfo *babel_ifp;
int decay;
VTY_GET_INTEGER_RANGE("units", decay, argv[2]->arg, 1, 256);
decay = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -511,7 +510,7 @@ DEFUN (babel_set_rtt_min,
babel_interface_nfo *babel_ifp;
int rtt;
VTY_GET_INTEGER_RANGE("milliseconds", rtt, argv[2]->arg, 1, 65535);
rtt = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -531,7 +530,7 @@ DEFUN (babel_set_rtt_max,
babel_interface_nfo *babel_ifp;
int rtt;
VTY_GET_INTEGER_RANGE("milliseconds", rtt, argv[2]->arg, 1, 65535);
rtt = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -551,7 +550,7 @@ DEFUN (babel_set_max_rtt_penalty,
babel_interface_nfo *babel_ifp;
int penalty;
VTY_GET_INTEGER_RANGE("milliseconds", penalty, argv[2]->arg, 0, 65535);
penalty = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -604,7 +603,7 @@ DEFUN (babel_set_channel,
babel_interface_nfo *babel_ifp;
int channel;
VTY_GET_INTEGER_RANGE("channel", channel, argv[2]->arg, 1, 254);
channel = strtoul(argv[2]->arg, NULL, 10);
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
@ -862,30 +861,31 @@ show_babel_interface_sub (struct vty *vty, struct interface *ifp)
int is_up;
babel_interface_nfo *babel_ifp;
vty_out (vty, "%s is %s%s", ifp->name,
((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE);
vty_out (vty, " ifindex %u, MTU %u bytes %s%s",
ifp->ifindex, MIN(ifp->mtu, ifp->mtu6), if_flag_dump(ifp->flags), VTY_NEWLINE);
vty_outln (vty, "%s is %s", ifp->name,
((is_up = if_is_operative(ifp)) ? "up" : "down"));
vty_outln (vty, " ifindex %u, MTU %u bytes %s",
ifp->ifindex, MIN(ifp->mtu, ifp->mtu6), if_flag_dump(ifp->flags));
if (!IS_ENABLE(ifp))
{
vty_out (vty, " Babel protocol is not enabled on this interface%s", VTY_NEWLINE);
vty_outln (vty, " Babel protocol is not enabled on this interface");
return;
}
if (!is_up)
{
vty_out (vty, " Babel protocol is enabled, but not running on this interface%s", VTY_NEWLINE);
vty_outln (vty,
" Babel protocol is enabled, but not running on this interface");
return;
}
babel_ifp = babel_get_if_nfo (ifp);
vty_out (vty, " Babel protocol is running on this interface%s", VTY_NEWLINE);
vty_out (vty, " Operating mode is \"%s\"%s",
CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless", VTY_NEWLINE);
vty_out (vty, " Split horizon mode is %s%s",
CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON) ? "On" : "Off", VTY_NEWLINE);
vty_out (vty, " Hello interval is %u ms%s", babel_ifp->hello_interval, VTY_NEWLINE);
vty_out (vty, " Update interval is %u ms%s", babel_ifp->update_interval, VTY_NEWLINE);
vty_out (vty, " Rxcost multiplier is %u%s", babel_ifp->cost, VTY_NEWLINE);
vty_outln (vty, " Babel protocol is running on this interface");
vty_outln (vty, " Operating mode is \"%s\"",
CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless");
vty_outln (vty, " Split horizon mode is %s",
CHECK_FLAG(babel_ifp->flags, BABEL_IF_SPLIT_HORIZON) ? "On" : "Off");
vty_outln (vty, " Hello interval is %u ms", babel_ifp->hello_interval);
vty_outln (vty, " Update interval is %u ms", babel_ifp->update_interval);
vty_outln (vty, " Rxcost multiplier is %u", babel_ifp->cost);
}
DEFUN (show_babel_interface,
@ -907,7 +907,7 @@ DEFUN (show_babel_interface,
}
if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)
{
vty_out (vty, "No such interface name%s", VTY_NEWLINE);
vty_outln (vty, "No such interface name");
return CMD_WARNING;
}
show_babel_interface_sub (vty, ifp);
@ -917,9 +917,9 @@ DEFUN (show_babel_interface,
static void
show_babel_neighbour_sub (struct vty *vty, struct neighbour *neigh)
{
vty_out (vty,
vty_outln (vty,
"Neighbour %s dev %s reach %04x rxcost %d txcost %d "
"rtt %s rttcost %d%s.%s",
"rtt %s rttcost %d%s.",
format_address(neigh->address),
neigh->ifp->name,
neigh->reach,
@ -927,8 +927,7 @@ show_babel_neighbour_sub (struct vty *vty, struct neighbour *neigh)
neigh->txcost,
format_thousands(neigh->rtt),
neighbour_rttcost(neigh),
if_up(neigh->ifp) ? "" : " (down)",
VTY_NEWLINE);
if_up(neigh->ifp) ? "" : " (down)");
}
DEFUN (show_babel_neighbour,
@ -950,7 +949,7 @@ DEFUN (show_babel_neighbour,
}
if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)
{
vty_out (vty, "No such interface name%s", VTY_NEWLINE);
vty_outln (vty, "No such interface name");
return CMD_WARNING;
}
FOR_ALL_NEIGHBOURS(neigh) {
@ -1010,9 +1009,9 @@ show_babel_routes_sub(struct babel_route *route, struct vty *vty,
channels[0] = '\0';
}
vty_out(vty,
vty_outln (vty,
"%s metric %d refmetric %d id %s seqno %d%s age %d "
"via %s neigh %s%s%s%s%s",
"via %s neigh %s%s%s%s",
format_prefix(route->src->prefix, route->src->plen),
route_metric(route), route->refmetric,
format_eui64(route->src->id),
@ -1023,9 +1022,7 @@ show_babel_routes_sub(struct babel_route *route, struct vty *vty,
format_address(route->neigh->address),
nexthop ? " nexthop " : "",
nexthop ? format_address(nexthop) : "",
route->installed ? " (installed)" :
route_feasible(route) ? " (feasible)" : "",
VTY_NEWLINE);
route->installed ? " (installed)" : route_feasible(route) ? " (feasible)" : "");
}
static void
@ -1035,10 +1032,9 @@ show_babel_xroutes_sub (struct xroute *xroute, struct vty *vty,
if(prefix && !babel_prefix_eq(prefix, xroute->prefix, xroute->plen))
return;
vty_out(vty, "%s metric %d (exported)%s",
vty_outln (vty, "%s metric %d (exported)",
format_prefix(xroute->prefix, xroute->plen),
xroute->metric,
VTY_NEWLINE);
xroute->metric);
}
DEFUN (show_babel_route,
@ -1093,7 +1089,7 @@ DEFUN (show_babel_route_prefix,
ret = str2prefix(argv[3]->arg, &prefix);
if(ret == 0) {
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
@ -1142,7 +1138,7 @@ DEFUN (show_babel_route_addr,
ret = inet_aton (argv[3]->arg, &addr);
if (ret <= 0) {
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
@ -1151,7 +1147,7 @@ DEFUN (show_babel_route_addr,
ret = str2prefix(buf, &prefix);
if (ret == 0) {
vty_out (vty, "%% Parse error -- this shouldn't happen%s", VTY_NEWLINE);
vty_outln (vty, "%% Parse error -- this shouldn't happen");
return CMD_WARNING;
}
@ -1200,7 +1196,7 @@ DEFUN (show_babel_route_addr6,
ret = inet_pton (AF_INET6, argv[3]->arg, &addr);
if (ret <= 0) {
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
@ -1210,7 +1206,7 @@ DEFUN (show_babel_route_addr6,
ret = str2prefix(buf, &prefix);
if (ret == 0) {
vty_out (vty, "%% Parse error -- this shouldn't happen%s", VTY_NEWLINE);
vty_outln (vty, "%% Parse error -- this shouldn't happen");
return CMD_WARNING;
}
@ -1248,9 +1244,9 @@ DEFUN (show_babel_parameters,
"Babel information\n"
"Configuration information\n")
{
vty_out(vty, " -- Babel running configuration --%s", VTY_NEWLINE);
vty_outln (vty, " -- Babel running configuration --");
show_babel_main_configuration(vty);
vty_out(vty, " -- distribution lists --%s", VTY_NEWLINE);
vty_outln (vty, " -- distribution lists --");
config_show_distribute(vty);
return CMD_SUCCESS;
@ -1325,65 +1321,63 @@ interface_config_write (struct vty *vty)
int write = 0;
for (ALL_LIST_ELEMENTS_RO (vrf_iflist(VRF_DEFAULT), node, ifp)) {
vty_out (vty, "interface %s%s", ifp->name,
VTY_NEWLINE);
vty_outln (vty, "interface %s",ifp->name);
if (ifp->desc)
vty_out (vty, " description %s%s", ifp->desc,
VTY_NEWLINE);
vty_outln (vty, " description %s",ifp->desc);
babel_interface_nfo *babel_ifp = babel_get_if_nfo (ifp);
/* wireless is the default*/
if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED))
{
vty_out (vty, " babel wired%s", VTY_NEWLINE);
vty_outln (vty, " babel wired");
write++;
}
if (babel_ifp->hello_interval != BABEL_DEFAULT_HELLO_INTERVAL)
{
vty_out (vty, " babel hello-interval %u%s", babel_ifp->hello_interval, VTY_NEWLINE);
vty_outln (vty, " babel hello-interval %u",
babel_ifp->hello_interval);
write++;
}
if (babel_ifp->update_interval != BABEL_DEFAULT_UPDATE_INTERVAL)
{
vty_out (vty, " babel update-interval %u%s", babel_ifp->update_interval, VTY_NEWLINE);
vty_outln (vty, " babel update-interval %u",
babel_ifp->update_interval);
write++;
}
/* Some parameters have different defaults for wired/wireless. */
if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED)) {
if (!CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON)) {
vty_out (vty, " no babel split-horizon%s", VTY_NEWLINE);
vty_outln (vty, " no babel split-horizon");
write++;
}
if (babel_ifp->cost != BABEL_DEFAULT_RXCOST_WIRED) {
vty_out (vty, " babel rxcost %u%s", babel_ifp->cost, VTY_NEWLINE);
vty_outln (vty, " babel rxcost %u", babel_ifp->cost);
write++;
}
if (babel_ifp->channel == BABEL_IF_CHANNEL_INTERFERING) {
vty_out (vty, " babel channel interfering%s", VTY_NEWLINE);
vty_outln (vty, " babel channel interfering");
write++;
} else if(babel_ifp->channel != BABEL_IF_CHANNEL_NONINTERFERING) {
vty_out (vty, " babel channel %d%s", babel_ifp->channel,
VTY_NEWLINE);
vty_outln (vty, " babel channel %d",babel_ifp->channel);
write++;
}
} else {
if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON)) {
vty_out (vty, " babel split-horizon%s", VTY_NEWLINE);
vty_outln (vty, " babel split-horizon");
write++;
}
if (babel_ifp->cost != BABEL_DEFAULT_RXCOST_WIRELESS) {
vty_out (vty, " babel rxcost %u%s", babel_ifp->cost, VTY_NEWLINE);
vty_outln (vty, " babel rxcost %u", babel_ifp->cost);
write++;
}
if (babel_ifp->channel == BABEL_IF_CHANNEL_NONINTERFERING) {
vty_out (vty, " babel channel noninterfering%s", VTY_NEWLINE);
vty_outln (vty, " babel channel noninterfering");
write++;
} else if(babel_ifp->channel != BABEL_IF_CHANNEL_INTERFERING) {
vty_out (vty, " babel channel %d%s", babel_ifp->channel,
VTY_NEWLINE);
vty_outln (vty, " babel channel %d",babel_ifp->channel);
write++;
}
}
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
write++;
}
return write;
@ -1399,7 +1393,7 @@ babel_enable_if_config_write (struct vty * vty)
for (i = 0; i < vector_active (babel_enable_if); i++)
if ((str = vector_slot (babel_enable_if, i)) != NULL)
{
vty_out (vty, " network %s%s", str, VTY_NEWLINE);
vty_outln (vty, " network %s", str);
lines++;
}
return lines;

View File

@ -377,7 +377,7 @@ babel_save_state_file(void)
void
show_babel_main_configuration (struct vty *vty)
{
vty_out(vty,
vty_outln (vty,
"state file = %s%s"
"configuration file = %s%s"
"protocol informations:%s"
@ -386,16 +386,16 @@ show_babel_main_configuration (struct vty *vty)
"vty address = %s%s"
"vty port = %d%s"
"id = %s%s"
"kernel_metric = %d%s",
state_file, VTY_NEWLINE,
"kernel_metric = %d",
state_file, VTYNL,
babel_config_file ? babel_config_file : babel_config_default,
VTY_NEWLINE,
VTY_NEWLINE,
format_address(protocol_group), VTY_NEWLINE,
protocol_port, VTY_NEWLINE,
VTYNL,
VTYNL,
format_address(protocol_group), VTYNL,
protocol_port, VTYNL,
babel_vty_addr ? babel_vty_addr : "None",
VTY_NEWLINE,
babel_vty_port, VTY_NEWLINE,
format_eui64(myid), VTY_NEWLINE,
kernel_metric, VTY_NEWLINE);
VTYNL,
babel_vty_port, VTYNL,
format_eui64(myid), VTYNL,
kernel_metric);
}

View File

@ -222,7 +222,7 @@ DEFUN (babel_redistribute_type,
type = babel_proto_redistnum(argv[1]->arg);
if (type < 0) {
vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE);
vty_outln (vty, "Invalid type %s", argv[1]->arg);
return CMD_WARNING;
}
@ -243,7 +243,7 @@ DEFUN (no_babel_redistribute_type,
type = babel_proto_redistnum(argv[2]->arg);
if (type < 0) {
vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE);
vty_outln (vty, "Invalid type %s", argv[2]->arg);
return CMD_WARNING;
}
@ -277,7 +277,7 @@ DEFUN (debug_babel,
}
}
vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE);
vty_outln (vty, "Invalid type %s", argv[2]->arg);
return CMD_WARNING;
}
@ -307,7 +307,7 @@ DEFUN (no_debug_babel,
}
}
vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE);
vty_outln (vty, "Invalid type %s", argv[3]->arg);
return CMD_WARNING;
}
@ -324,7 +324,7 @@ debug_babel_config_write (struct vty * vty)
if (debug == BABEL_DEBUG_ALL)
{
vty_out (vty, "debug babel all%s", VTY_NEWLINE);
vty_outln (vty, "debug babel all");
lines++;
}
else
@ -335,12 +335,12 @@ debug_babel_config_write (struct vty * vty)
&& CHECK_FLAG (debug, debug_type[i].type)
)
{
vty_out (vty, "debug babel %s%s", debug_type[i].str, VTY_NEWLINE);
vty_outln (vty, "debug babel %s", debug_type[i].str);
lines++;
}
if (lines)
{
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
lines++;
}
return lines;
@ -384,13 +384,13 @@ zebra_config_write (struct vty *vty)
{
if (! zclient->enable)
{
vty_out (vty, "no router zebra%s", VTY_NEWLINE);
vty_outln (vty, "no router zebra");
return 1;
}
else if (! vrf_bitmap_check (zclient->redist[AFI_IP][ZEBRA_ROUTE_BABEL], VRF_DEFAULT))
{
vty_out (vty, "router zebra%s", VTY_NEWLINE);
vty_out (vty, " no redistribute babel%s", VTY_NEWLINE);
vty_outln (vty, "router zebra");
vty_outln (vty, " no redistribute babel");
return 1;
}
return 0;
@ -400,4 +400,5 @@ void
babel_zebra_close_connexion(void)
{
zclient_stop(zclient);
zclient_free(zclient);
}

View File

@ -83,27 +83,26 @@ babel_config_write (struct vty *vty)
if (!babel_routing_process)
return lines;
vty_out (vty, "router babel%s", VTY_NEWLINE);
vty_outln (vty, "router babel");
if (diversity_kind != DIVERSITY_NONE)
{
vty_out (vty, " babel diversity%s", VTY_NEWLINE);
vty_outln (vty, " babel diversity");
lines++;
}
if (diversity_factor != BABEL_DEFAULT_DIVERSITY_FACTOR)
{
vty_out (vty, " babel diversity-factor %d%s", diversity_factor,
VTY_NEWLINE);
vty_outln (vty, " babel diversity-factor %d",diversity_factor);
lines++;
}
if (resend_delay != BABEL_DEFAULT_RESEND_DELAY)
{
vty_out (vty, " babel resend-delay %u%s", resend_delay, VTY_NEWLINE);
vty_outln (vty, " babel resend-delay %u", resend_delay);
lines++;
}
if (smoothing_half_life != BABEL_DEFAULT_SMOOTHING_HALF_LIFE)
{
vty_out (vty, " babel smoothing-half-life %u%s",
smoothing_half_life, VTY_NEWLINE);
vty_outln (vty, " babel smoothing-half-life %u",
smoothing_half_life);
lines++;
}
/* list enabled interfaces */
@ -113,7 +112,7 @@ babel_config_write (struct vty *vty)
if (i != zclient->redist_default &&
vrf_bitmap_check (zclient->redist[AFI_IP][i], VRF_DEFAULT))
{
vty_out (vty, " redistribute %s%s", zebra_route_string (i), VTY_NEWLINE);
vty_outln (vty, " redistribute %s", zebra_route_string(i));
lines++;
}
@ -659,7 +658,7 @@ DEFUN (babel_diversity_factor,
{
int factor;
VTY_GET_INTEGER_RANGE("factor", factor, argv[2]->arg, 1, 256);
factor = strtoul(argv[2]->arg, NULL, 10);
diversity_factor = factor;
return CMD_SUCCESS;
@ -675,7 +674,7 @@ DEFUN (babel_set_resend_delay,
{
int interval;
VTY_GET_INTEGER_RANGE("milliseconds", interval, argv[2]->arg, 20, 10 * 0xFFFE);
interval = strtoul(argv[2]->arg, NULL, 10);
resend_delay = interval;
return CMD_SUCCESS;
@ -691,7 +690,7 @@ DEFUN (babel_set_smoothing_half_life,
{
int seconds;
VTY_GET_INTEGER_RANGE("seconds", seconds, argv[2]->arg, 0, 0xFFFE);
seconds = strtoul(argv[2]->arg, NULL, 10);
change_smoothing_half_life(seconds);
return CMD_SUCCESS;

1
bgpd/.gitignore vendored
View File

@ -16,3 +16,4 @@ TAGS
.arch-ids
*~
*.loT
*clippy.c

View File

@ -1,6 +1,8 @@
## Process this file with automake to produce Makefile.in.
AUTOMAKE_OPTIONS = subdir-objects
include ../common.am
if ENABLE_BGP_VNC
#o file to keep linker happy
BGP_VNC_RFP_LIB=rfapi/rfapi_descriptor_rfp_utils.o @top_builddir@/$(LIBRFP)/librfp.a
@ -116,5 +118,8 @@ examplesdir = $(exampledir)
dist_examples_DATA = bgpd.conf.sample bgpd.conf.sample2 \
bgpd.conf.vnc.sample
bgp_vty.o: bgp_vty_clippy.c
bgp_debug.o: bgp_debug_clippy.c
EXTRA_DIST = BGP4-MIB.txt

View File

@ -2176,7 +2176,7 @@ aspath_show_all_iterator (struct hash_backet *backet, struct vty *vty)
as = (struct aspath *) backet->data;
vty_out (vty, "[%p:%u] (%ld) ", (void *)backet, backet->key, as->refcnt);
vty_out (vty, "%s%s", as->str, VTY_NEWLINE);
vty_outln (vty, "%s", as->str);
}
/* Print all aspath and hash information. This function is used from

View File

@ -797,8 +797,8 @@ attr_show_all_iterator (struct hash_backet *backet, struct vty *vty)
{
struct attr *attr = backet->data;
vty_out (vty, "attr[%ld] nexthop %s%s", attr->refcnt,
inet_ntoa (attr->nexthop), VTY_NEWLINE);
vty_outln (vty, "attr[%ld] nexthop %s", attr->refcnt,
inet_ntoa(attr->nexthop));
}
void

View File

@ -526,18 +526,17 @@ bgp_bfd_peer_config_write(struct vty *vty, struct peer *peer, char *addr)
bfd_info = (struct bfd_info *)peer->bfd_info;
if (CHECK_FLAG (bfd_info->flags, BFD_FLAG_PARAM_CFG))
vty_out (vty, " neighbor %s bfd %d %d %d%s", addr,
vty_outln (vty, " neighbor %s bfd %d %d %d", addr,
bfd_info->detect_mult, bfd_info->required_min_rx,
bfd_info->desired_min_tx, VTY_NEWLINE);
bfd_info->desired_min_tx);
if (bfd_info->type != BFD_TYPE_NOT_CONFIGURED)
vty_out (vty, " neighbor %s bfd %s%s", addr,
(bfd_info->type == BFD_TYPE_MULTIHOP) ? "multihop" : "singlehop",
VTY_NEWLINE);
vty_outln (vty, " neighbor %s bfd %s", addr,
(bfd_info->type == BFD_TYPE_MULTIHOP) ? "multihop" : "singlehop");
if (!CHECK_FLAG (bfd_info->flags, BFD_FLAG_PARAM_CFG) &&
(bfd_info->type == BFD_TYPE_NOT_CONFIGURED))
vty_out (vty, " neighbor %s bfd%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s bfd", addr);
}
/*
@ -629,9 +628,9 @@ DEFUN_HIDDEN (neighbor_bfd_type,
if (!peer)
return CMD_WARNING;
if (!strcmp(argv[idx_hop]->arg, "singlehop"))
if (strmatch(argv[idx_hop]->text, "singlehop"))
type = BFD_TYPE_SINGLEHOP;
else if (!strcmp(argv[idx_hop]->arg, "multihop"))
else if (strmatch(argv[idx_hop]->text, "multihop"))
type = BFD_TYPE_MULTIHOP;
else
return CMD_WARNING;

View File

@ -525,21 +525,19 @@ bgp_config_write_damp (struct vty *vty)
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4)
vty_out (vty, " bgp dampening%s", VTY_NEWLINE);
vty_outln (vty, " bgp dampening");
else if (bgp_damp_cfg.half_life != DEFAULT_HALF_LIFE*60
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4)
vty_out (vty, " bgp dampening %lld%s",
bgp_damp_cfg.half_life/60LL,
VTY_NEWLINE);
vty_outln (vty, " bgp dampening %lld",
bgp_damp_cfg.half_life / 60LL);
else
vty_out (vty, " bgp dampening %lld %d %d %lld%s",
vty_outln (vty, " bgp dampening %lld %d %d %lld",
bgp_damp_cfg.half_life/60LL,
bgp_damp_cfg.reuse_limit,
bgp_damp_cfg.suppress_value,
bgp_damp_cfg.max_suppress_time/60LL,
VTY_NEWLINE);
bgp_damp_cfg.max_suppress_time / 60LL);
}
static const char *
@ -654,7 +652,7 @@ bgp_damp_info_vty (struct vty *vty, struct bgp_info *binfo,
vty_out (vty, ", reuse in %s",
bgp_get_reuse_time (penalty, timebuf, BGP_UPTIME_LEN, 0, json_path));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
@ -693,27 +691,27 @@ bgp_show_dampening_parameters (struct vty *vty, afi_t afi, safi_t safi)
if (bgp == NULL)
{
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
vty_outln (vty, "No BGP process is configured");
return CMD_WARNING;
}
if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
{
vty_out (vty, "Half-life time: %lld min%s",
(long long)damp->half_life / 60, VTY_NEWLINE);
vty_out (vty, "Reuse penalty: %d%s",
damp->reuse_limit, VTY_NEWLINE);
vty_out (vty, "Suppress penalty: %d%s",
damp->suppress_value, VTY_NEWLINE);
vty_out (vty, "Max suppress time: %lld min%s",
(long long)damp->max_suppress_time / 60, VTY_NEWLINE);
vty_out (vty, "Max supress penalty: %u%s",
damp->ceiling, VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE);
vty_outln (vty, "Half-life time: %lld min",
(long long)damp->half_life / 60);
vty_outln (vty, "Reuse penalty: %d",
damp->reuse_limit);
vty_outln (vty, "Suppress penalty: %d",
damp->suppress_value);
vty_outln (vty, "Max suppress time: %lld min",
(long long)damp->max_suppress_time / 60);
vty_outln (vty, "Max supress penalty: %u",
damp->ceiling);
vty_out (vty, VTYNL);
}
else
vty_out (vty, "dampening not enabled for %s%s",
afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
vty_outln (vty, "dampening not enabled for %s",
afi == AFI_IP ? "IPv4" : "IPv6");
return CMD_SUCCESS;
}

View File

@ -254,7 +254,7 @@ bgp_debug_list_print (struct vty *vty, const char *desc, struct list *list)
}
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* Print the command to enable the debug for each peer/prefix this debug is
@ -274,16 +274,16 @@ bgp_debug_list_conf_print (struct vty *vty, const char *desc, struct list *list)
{
if (filter->host)
{
vty_out (vty, "%s %s%s", desc, filter->host, VTY_NEWLINE);
vty_outln (vty, "%s %s", desc, filter->host);
write++;
}
if (filter->p)
{
vty_out (vty, "%s %s/%d%s", desc,
vty_outln (vty, "%s %s/%d", desc,
inet_ntop (filter->p->family, &filter->p->u.prefix, buf, INET6_ADDRSTRLEN),
filter->p->prefixlen, VTY_NEWLINE);
filter->p->prefixlen);
write++;
}
}
@ -291,7 +291,7 @@ bgp_debug_list_conf_print (struct vty *vty, const char *desc, struct list *list)
if (!write)
{
vty_out (vty, "%s%s", desc, VTY_NEWLINE);
vty_outln (vty, "%s", desc);
write++;
}
@ -299,7 +299,7 @@ bgp_debug_list_conf_print (struct vty *vty, const char *desc, struct list *list)
}
static void
bgp_debug_list_add_entry(struct list *list, const char *host, struct prefix *p)
bgp_debug_list_add_entry(struct list *list, const char *host, const struct prefix *p)
{
struct bgp_debug_filter *filter;
@ -313,7 +313,8 @@ bgp_debug_list_add_entry(struct list *list, const char *host, struct prefix *p)
else if (p)
{
filter->host = NULL;
filter->p = p;
filter->p = prefix_new();
prefix_copy (filter->p, p);
}
listnode_add(list, filter);
@ -347,7 +348,7 @@ bgp_debug_list_remove_entry(struct list *list, const char *host, struct prefix *
}
static int
bgp_debug_list_has_entry(struct list *list, const char *host, struct prefix *p)
bgp_debug_list_has_entry(struct list *list, const char *host, const struct prefix *p)
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
@ -582,7 +583,7 @@ DEFUN (debug_bgp_as4,
else
{
TERM_DEBUG_ON (as4, AS4);
vty_out (vty, "BGP as4 debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP as4 debugging is on");
}
return CMD_SUCCESS;
}
@ -600,7 +601,7 @@ DEFUN (no_debug_bgp_as4,
else
{
TERM_DEBUG_OFF (as4, AS4);
vty_out (vty, "BGP as4 debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP as4 debugging is off");
}
return CMD_SUCCESS;
}
@ -618,7 +619,7 @@ DEFUN (debug_bgp_as4_segment,
else
{
TERM_DEBUG_ON (as4, AS4_SEGMENT);
vty_out (vty, "BGP as4 segment debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP as4 segment debugging is on");
}
return CMD_SUCCESS;
}
@ -637,7 +638,7 @@ DEFUN (no_debug_bgp_as4_segment,
else
{
TERM_DEBUG_OFF (as4, AS4_SEGMENT);
vty_out (vty, "BGP as4 segment debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP as4 segment debugging is off");
}
return CMD_SUCCESS;
}
@ -657,7 +658,7 @@ DEFUN (debug_bgp_neighbor_events,
else
{
TERM_DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS);
vty_out (vty, "BGP neighbor-events debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP neighbor-events debugging is on");
}
return CMD_SUCCESS;
}
@ -680,7 +681,8 @@ DEFUN (debug_bgp_neighbor_events_peer,
if (bgp_debug_list_has_entry(bgp_debug_neighbor_events_peers, host, NULL))
{
vty_out (vty, "BGP neighbor-events debugging is already enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP neighbor-events debugging is already enabled for %s",
host);
return CMD_SUCCESS;
}
@ -691,7 +693,7 @@ DEFUN (debug_bgp_neighbor_events_peer,
else
{
TERM_DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS);
vty_out (vty, "BGP neighbor-events debugging is on for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP neighbor-events debugging is on for %s", host);
}
return CMD_SUCCESS;
}
@ -711,7 +713,7 @@ DEFUN (no_debug_bgp_neighbor_events,
else
{
TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
vty_out (vty, "BGP neighbor-events debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP neighbor-events debugging is off");
}
return CMD_SUCCESS;
}
@ -745,9 +747,10 @@ DEFUN (no_debug_bgp_neighbor_events_peer,
}
if (found_peer)
vty_out (vty, "BGP neighbor-events debugging is off for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP neighbor-events debugging is off for %s", host);
else
vty_out (vty, "BGP neighbor-events debugging was not enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP neighbor-events debugging was not enabled for %s",
host);
return CMD_SUCCESS;
}
@ -765,7 +768,7 @@ DEFUN (debug_bgp_nht,
else
{
TERM_DEBUG_ON (nht, NHT);
vty_out (vty, "BGP nexthop tracking debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP nexthop tracking debugging is on");
}
return CMD_SUCCESS;
}
@ -783,7 +786,7 @@ DEFUN (no_debug_bgp_nht,
else
{
TERM_DEBUG_OFF (nht, NHT);
vty_out (vty, "BGP nexthop tracking debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP nexthop tracking debugging is off");
}
return CMD_SUCCESS;
}
@ -803,7 +806,7 @@ DEFUN (debug_bgp_keepalive,
else
{
TERM_DEBUG_ON (keepalive, KEEPALIVE);
vty_out (vty, "BGP keepalives debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP keepalives debugging is on");
}
return CMD_SUCCESS;
}
@ -826,7 +829,8 @@ DEFUN (debug_bgp_keepalive_peer,
if (bgp_debug_list_has_entry(bgp_debug_keepalive_peers, host, NULL))
{
vty_out (vty, "BGP keepalive debugging is already enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP keepalive debugging is already enabled for %s",
host);
return CMD_SUCCESS;
}
@ -837,7 +841,7 @@ DEFUN (debug_bgp_keepalive_peer,
else
{
TERM_DEBUG_ON (keepalive, KEEPALIVE);
vty_out (vty, "BGP keepalives debugging is on for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP keepalives debugging is on for %s", host);
}
return CMD_SUCCESS;
}
@ -857,7 +861,7 @@ DEFUN (no_debug_bgp_keepalive,
else
{
TERM_DEBUG_OFF (keepalive, KEEPALIVE);
vty_out (vty, "BGP keepalives debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP keepalives debugging is off");
}
return CMD_SUCCESS;
}
@ -891,17 +895,21 @@ DEFUN (no_debug_bgp_keepalive_peer,
}
if (found_peer)
vty_out (vty, "BGP keepalives debugging is off for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP keepalives debugging is off for %s", host);
else
vty_out (vty, "BGP keepalives debugging was not enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP keepalives debugging was not enabled for %s", host);
return CMD_SUCCESS;
}
#ifndef VTYSH_EXTRACT_PL
#include "bgp_debug_clippy.c"
#endif
/* debug bgp bestpath */
DEFUN (debug_bgp_bestpath_prefix,
DEFPY (debug_bgp_bestpath_prefix,
debug_bgp_bestpath_prefix_cmd,
"debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
"debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>$bestpath",
DEBUG_STR
BGP_STR
"BGP bestpath\n"
@ -909,30 +917,16 @@ DEFUN (debug_bgp_bestpath_prefix,
"IPv6 prefix\n")
{
int idx_ipv4_ipv6_prefixlen = 3;
struct prefix *argv_p;
int ret;
argv_p = prefix_new();
ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (!bgp_debug_bestpath_prefixes)
bgp_debug_bestpath_prefixes = list_new ();
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, argv_p))
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, bestpath))
{
vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP bestpath debugging is already enabled for %s", bestpath_str);
return CMD_SUCCESS;
}
bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, argv_p);
bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, bestpath);
if (vty->node == CONFIG_NODE)
{
@ -941,7 +935,7 @@ DEFUN (debug_bgp_bestpath_prefix,
else
{
TERM_DEBUG_ON (bestpath, BESTPATH);
vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP bestpath debugging is on for %s", bestpath_str);
}
return CMD_SUCCESS;
@ -968,7 +962,7 @@ DEFUN (no_debug_bgp_bestpath_prefix,
if (!ret)
{
prefix_free(argv_p);
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
@ -985,15 +979,17 @@ DEFUN (no_debug_bgp_bestpath_prefix,
else
{
TERM_DEBUG_OFF (bestpath, BESTPATH);
vty_out (vty, "BGP bestpath debugging (per prefix) is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP bestpath debugging (per prefix) is off");
}
}
}
if (found_prefix)
vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP bestpath debugging is off for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
else
vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP bestpath debugging was not enabled for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
return CMD_SUCCESS;
}
@ -1013,7 +1009,7 @@ DEFUN (no_debug_bgp_bestpath,
else
{
TERM_DEBUG_OFF (bestpath, BESTPATH);
vty_out (vty, "BGP bestpath debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP bestpath debugging is off");
}
return CMD_SUCCESS;
}
@ -1039,7 +1035,7 @@ DEFUN (debug_bgp_update,
{
TERM_DEBUG_ON (update, UPDATE_IN);
TERM_DEBUG_ON (update, UPDATE_OUT);
vty_out (vty, "BGP updates debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is on");
}
return CMD_SUCCESS;
}
@ -1072,12 +1068,12 @@ DEFUN (debug_bgp_update_direct,
if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
{
TERM_DEBUG_ON (update, UPDATE_IN);
vty_out (vty, "BGP updates debugging is on (inbound)%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is on (inbound)");
}
else
{
TERM_DEBUG_ON (update, UPDATE_OUT);
vty_out (vty, "BGP updates debugging is on (outbound)%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is on (outbound)");
}
}
return CMD_SUCCESS;
@ -1115,7 +1111,8 @@ DEFUN (debug_bgp_update_direct_peer,
{
if (bgp_debug_list_has_entry(bgp_debug_update_in_peers, host, NULL))
{
vty_out (vty, "BGP inbound update debugging is already enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP inbound update debugging is already enabled for %s",
host);
return CMD_SUCCESS;
}
}
@ -1124,7 +1121,8 @@ DEFUN (debug_bgp_update_direct_peer,
{
if (bgp_debug_list_has_entry(bgp_debug_update_out_peers, host, NULL))
{
vty_out (vty, "BGP outbound update debugging is already enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP outbound update debugging is already enabled for %s",
host);
return CMD_SUCCESS;
}
}
@ -1168,12 +1166,14 @@ DEFUN (debug_bgp_update_direct_peer,
if (inbound)
{
TERM_DEBUG_ON (update, UPDATE_IN);
vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is on (inbound) for %s",
argv[idx_peer]->arg);
}
else
{
TERM_DEBUG_ON (update, UPDATE_OUT);
vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is on (outbound) for %s",
argv[idx_peer]->arg);
}
}
return CMD_SUCCESS;
@ -1201,7 +1201,7 @@ DEFUN (no_debug_bgp_update_direct,
else
{
TERM_DEBUG_OFF (update, UPDATE_IN);
vty_out (vty, "BGP updates debugging is off (inbound)%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is off (inbound)");
}
}
else
@ -1215,7 +1215,7 @@ DEFUN (no_debug_bgp_update_direct,
else
{
TERM_DEBUG_OFF (update, UPDATE_OUT);
vty_out (vty, "BGP updates debugging is off (outbound)%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is off (outbound)");
}
}
@ -1258,7 +1258,7 @@ DEFUN (no_debug_bgp_update_direct_peer,
else
{
TERM_DEBUG_OFF (update, UPDATE_IN);
vty_out (vty, "BGP updates debugging (inbound) is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (inbound) is off");
}
}
}
@ -1275,7 +1275,7 @@ DEFUN (no_debug_bgp_update_direct_peer,
else
{
TERM_DEBUG_OFF (update, UPDATE_OUT);
vty_out (vty, "BGP updates debugging (outbound) is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (outbound) is off");
}
}
@ -1302,14 +1302,17 @@ DEFUN (no_debug_bgp_update_direct_peer,
if (found_peer)
if (inbound)
vty_out (vty, "BGP updates debugging (inbound) is off for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (inbound) is off for %s", host);
else
vty_out (vty, "BGP updates debugging (outbound) is off for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (outbound) is off for %s",
host);
else
if (inbound)
vty_out (vty, "BGP updates debugging (inbound) was not enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (inbound) was not enabled for %s",
host);
else
vty_out (vty, "BGP updates debugging (outbound) was not enabled for %s%s", host, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (outbound) was not enabled for %s",
host);
return CMD_SUCCESS;
}
@ -1334,7 +1337,7 @@ DEFUN (debug_bgp_update_prefix,
if (!ret)
{
prefix_free(argv_p);
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
@ -1344,7 +1347,8 @@ DEFUN (debug_bgp_update_prefix,
if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p))
{
vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is already enabled for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
return CMD_SUCCESS;
}
@ -1357,7 +1361,8 @@ DEFUN (debug_bgp_update_prefix,
else
{
TERM_DEBUG_ON (update, UPDATE_PREFIX);
vty_out (vty, "BGP updates debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is on for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
}
return CMD_SUCCESS;
@ -1385,7 +1390,7 @@ DEFUN (no_debug_bgp_update_prefix,
if (!ret)
{
prefix_free(argv_p);
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
@ -1402,15 +1407,17 @@ DEFUN (no_debug_bgp_update_prefix,
else
{
TERM_DEBUG_OFF (update, UPDATE_PREFIX);
vty_out (vty, "BGP updates debugging (per prefix) is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging (per prefix) is off");
}
}
}
if (found_prefix)
vty_out (vty, "BGP updates debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is off for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
else
vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging was not enabled for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
return CMD_SUCCESS;
}
@ -1441,7 +1448,7 @@ DEFUN (no_debug_bgp_update,
TERM_DEBUG_OFF (update, UPDATE_IN);
TERM_DEBUG_OFF (update, UPDATE_OUT);
TERM_DEBUG_OFF (update, UPDATE_PREFIX);
vty_out (vty, "BGP updates debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP updates debugging is off");
}
return CMD_SUCCESS;
}
@ -1459,7 +1466,7 @@ DEFUN (debug_bgp_zebra,
else
{
TERM_DEBUG_ON (zebra, ZEBRA);
vty_out (vty, "BGP zebra debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging is on");
}
return CMD_SUCCESS;
}
@ -1484,7 +1491,7 @@ DEFUN (debug_bgp_zebra_prefix,
if (!ret)
{
prefix_free(argv_p);
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
@ -1493,7 +1500,8 @@ DEFUN (debug_bgp_zebra_prefix,
if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, argv_p))
{
vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging is already enabled for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
return CMD_SUCCESS;
}
@ -1504,7 +1512,8 @@ DEFUN (debug_bgp_zebra_prefix,
else
{
TERM_DEBUG_ON (zebra, ZEBRA);
vty_out (vty, "BGP zebra debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging is on for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
}
return CMD_SUCCESS;
@ -1525,7 +1534,7 @@ DEFUN (no_debug_bgp_zebra,
else
{
TERM_DEBUG_OFF (zebra, ZEBRA);
vty_out (vty, "BGP zebra debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging is off");
}
return CMD_SUCCESS;
}
@ -1552,7 +1561,7 @@ DEFUN (no_debug_bgp_zebra_prefix,
if (!ret)
{
prefix_free(argv_p);
vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
@ -1567,15 +1576,17 @@ DEFUN (no_debug_bgp_zebra_prefix,
else
{
TERM_DEBUG_OFF (zebra, ZEBRA);
vty_out (vty, "BGP zebra debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging is off");
}
}
}
if (found_prefix)
vty_out (vty, "BGP zebra debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging is off for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
else
vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
vty_outln (vty, "BGP zebra debugging was not enabled for %s",
argv[idx_ipv4_ipv6_prefixlen]->arg);
return CMD_SUCCESS;
}
@ -1592,7 +1603,7 @@ DEFUN (debug_bgp_allow_martians,
else
{
TERM_DEBUG_ON (allow_martians, ALLOW_MARTIANS);
vty_out (vty, "BGP allow_martian next hop debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP allow_martian next hop debugging is on");
}
return CMD_SUCCESS;
}
@ -1610,7 +1621,7 @@ DEFUN (no_debug_bgp_allow_martians,
else
{
TERM_DEBUG_OFF (allow_martians, ALLOW_MARTIANS);
vty_out (vty, "BGP allow martian next hop debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP allow martian next hop debugging is off");
}
return CMD_SUCCESS;
}
@ -1629,7 +1640,7 @@ DEFUN (debug_bgp_update_groups,
else
{
TERM_DEBUG_ON (update_groups, UPDATE_GROUPS);
vty_out (vty, "BGP update-groups debugging is on%s", VTY_NEWLINE);
vty_outln (vty, "BGP update-groups debugging is on");
}
return CMD_SUCCESS;
}
@ -1647,7 +1658,7 @@ DEFUN (no_debug_bgp_update_groups,
else
{
TERM_DEBUG_OFF (update_groups, UPDATE_GROUPS);
vty_out (vty, "BGP update-groups debugging is off%s", VTY_NEWLINE);
vty_outln (vty, "BGP update-groups debugging is off");
}
return CMD_SUCCESS;
}
@ -1680,7 +1691,7 @@ DEFUN (no_debug_bgp,
TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
TERM_DEBUG_OFF (zebra, ZEBRA);
TERM_DEBUG_OFF (allow_martians, ALLOW_MARTIANS);
vty_out (vty, "All possible debugging has been turned off%s", VTY_NEWLINE);
vty_outln (vty, "All possible debugging has been turned off");
return CMD_SUCCESS;
}
@ -1692,13 +1703,13 @@ DEFUN (show_debugging_bgp,
DEBUG_STR
BGP_STR)
{
vty_out (vty, "BGP debugging status:%s", VTY_NEWLINE);
vty_outln (vty, "BGP debugging status:");
if (BGP_DEBUG (as4, AS4))
vty_out (vty, " BGP as4 debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " BGP as4 debugging is on");
if (BGP_DEBUG (as4, AS4_SEGMENT))
vty_out (vty, " BGP as4 aspath segment debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " BGP as4 aspath segment debugging is on");
if (BGP_DEBUG (bestpath, BESTPATH))
bgp_debug_list_print (vty, " BGP bestpath debugging is on",
@ -1713,10 +1724,10 @@ DEFUN (show_debugging_bgp,
bgp_debug_neighbor_events_peers);
if (BGP_DEBUG (nht, NHT))
vty_out (vty, " BGP next-hop tracking debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " BGP next-hop tracking debugging is on");
if (BGP_DEBUG (update_groups, UPDATE_GROUPS))
vty_out (vty, " BGP update-groups debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " BGP update-groups debugging is on");
if (BGP_DEBUG (update, UPDATE_PREFIX))
bgp_debug_list_print (vty, " BGP updates debugging is on",
@ -1735,8 +1746,8 @@ DEFUN (show_debugging_bgp,
bgp_debug_zebra_prefixes);
if (BGP_DEBUG (allow_martians, ALLOW_MARTIANS))
vty_out (vty, " BGP allow martian next hop debugging is on%s", VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE);
vty_outln (vty, " BGP allow martian next hop debugging is on");
vty_out (vty, VTYNL);
return CMD_SUCCESS;
}
@ -1791,13 +1802,13 @@ bgp_config_write_debug (struct vty *vty)
if (CONF_BGP_DEBUG (as4, AS4))
{
vty_out (vty, "debug bgp as4%s", VTY_NEWLINE);
vty_outln (vty, "debug bgp as4");
write++;
}
if (CONF_BGP_DEBUG (as4, AS4_SEGMENT))
{
vty_out (vty, "debug bgp as4 segment%s", VTY_NEWLINE);
vty_outln (vty, "debug bgp as4 segment");
write++;
}
@ -1821,13 +1832,13 @@ bgp_config_write_debug (struct vty *vty)
if (CONF_BGP_DEBUG (nht, NHT))
{
vty_out (vty, "debug bgp nht%s", VTY_NEWLINE);
vty_outln (vty, "debug bgp nht");
write++;
}
if (CONF_BGP_DEBUG (update_groups, UPDATE_GROUPS))
{
vty_out (vty, "debug bgp update-groups%s", VTY_NEWLINE);
vty_outln (vty, "debug bgp update-groups");
write++;
}
@ -1853,7 +1864,7 @@ bgp_config_write_debug (struct vty *vty)
{
if (!bgp_debug_zebra_prefixes || list_isempty(bgp_debug_zebra_prefixes))
{
vty_out (vty, "debug bgp zebra%s", VTY_NEWLINE);
vty_outln (vty, "debug bgp zebra");
write++;
}
else
@ -1865,7 +1876,7 @@ bgp_config_write_debug (struct vty *vty)
if (CONF_BGP_DEBUG (allow_martians, ALLOW_MARTIANS))
{
vty_out (vty, "debug bgp allow-martians%s", VTY_NEWLINE);
vty_outln (vty, "debug bgp allow-martians");
write++;
}

View File

@ -667,7 +667,7 @@ bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump,
interval = bgp_dump_parse_time (interval_str);
if (interval == 0)
{
vty_out (vty, "Malformed interval string%s", VTY_NEWLINE);
vty_outln (vty, "Malformed interval string");
return CMD_WARNING;
}
@ -753,7 +753,7 @@ DEFUN (dump_bgp_all,
const struct bgp_dump_type_map *map = NULL;
for (map = bgp_dump_type_map; map->str; map++)
if (strcmp(argv[idx_dump_routes]->arg, map->str) == 0)
if (strmatch(argv[idx_dump_routes]->text, map->str))
bgp_dump_type = map->type;
switch (bgp_dump_type)
@ -800,7 +800,7 @@ DEFUN (no_dump_bgp_all,
struct bgp_dump *bgp_dump_struct = NULL;
for (map = bgp_dump_type_map; map->str; map++)
if (strcmp(argv[idx_dump_routes]->arg, map->str) == 0)
if (strmatch(argv[idx_dump_routes]->text, map->str))
bgp_dump_type = map->type;
switch (bgp_dump_type)
@ -866,12 +866,11 @@ config_write_bgp_dump (struct vty *vty)
type_str = "all-et";
if (bgp_dump_all.interval_str)
vty_out (vty, "dump bgp %s %s %s%s", type_str,
bgp_dump_all.filename, bgp_dump_all.interval_str,
VTY_NEWLINE);
vty_outln (vty, "dump bgp %s %s %s", type_str,
bgp_dump_all.filename,bgp_dump_all.interval_str);
else
vty_out (vty, "dump bgp %s %s%s", type_str,
bgp_dump_all.filename, VTY_NEWLINE);
vty_outln (vty, "dump bgp %s %s", type_str,
bgp_dump_all.filename);
}
if (bgp_dump_updates.filename)
{
@ -880,22 +879,20 @@ config_write_bgp_dump (struct vty *vty)
type_str = "updates-et";
if (bgp_dump_updates.interval_str)
vty_out (vty, "dump bgp %s %s %s%s", type_str,
bgp_dump_updates.filename, bgp_dump_updates.interval_str,
VTY_NEWLINE);
vty_outln (vty, "dump bgp %s %s %s", type_str,
bgp_dump_updates.filename,bgp_dump_updates.interval_str);
else
vty_out (vty, "dump bgp %s %s%s", type_str,
bgp_dump_updates.filename, VTY_NEWLINE);
vty_outln (vty, "dump bgp %s %s", type_str,
bgp_dump_updates.filename);
}
if (bgp_dump_routes.filename)
{
if (bgp_dump_routes.interval_str)
vty_out (vty, "dump bgp routes-mrt %s %s%s",
bgp_dump_routes.filename, bgp_dump_routes.interval_str,
VTY_NEWLINE);
vty_outln (vty, "dump bgp routes-mrt %s %s",
bgp_dump_routes.filename,bgp_dump_routes.interval_str);
else
vty_out (vty, "dump bgp routes-mrt %s%s",
bgp_dump_routes.filename, VTY_NEWLINE);
vty_outln (vty, "dump bgp routes-mrt %s",
bgp_dump_routes.filename);
}
return 0;

View File

@ -49,12 +49,6 @@ bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
struct bgp_info *ri;
int rd_header;
int header = 1;
char v4_header[] =
" Network Next Hop Metric LocPrf Weight Path%s";
char v4_header_tag[] =
" Network Next Hop In tag/Out tag%s";
char v4_header_overlay[] =
" Network Next Hop EthTag Overlay Index RouterMac%s";
unsigned long output_count = 0;
unsigned long total_count = 0;
@ -67,8 +61,7 @@ bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
bgp = bgp_get_default();
if (bgp == NULL) {
if (!use_json)
vty_out(vty, "No BGP process is configured%s",
VTY_NEWLINE);
vty_outln (vty,"No BGP process is configured");
return CMD_WARNING;
}
@ -142,31 +135,20 @@ bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
} else {
if (option ==
SHOW_DISPLAY_TAGS)
vty_out(vty,
v4_header_tag,
VTY_NEWLINE);
vty_outln(vty, V4_HEADER_TAG);
else if (option ==
SHOW_DISPLAY_OVERLAY)
vty_out(vty,
v4_header_overlay,
VTY_NEWLINE);
vty_outln(vty, V4_HEADER_OVERLAY);
else {
vty_out(vty,
"BGP table version is 0, local router ID is %s%s",
inet_ntoa
(bgp->
router_id),
VTY_NEWLINE);
vty_out(vty,
"Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
VTY_NEWLINE);
vty_out(vty,
"Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
VTY_NEWLINE,
VTY_NEWLINE);
vty_out(vty,
v4_header,
VTY_NEWLINE);
vty_outln (vty,
"BGP table version is 0, local router ID is %s",
inet_ntoa(bgp->router_id));
vty_outln (vty,
"Status codes: s suppressed, d damped, h history, * valid, > best, i - internal");
vty_outln (vty,
"Origin codes: i - IGP, e - EGP, ? - incomplete%s",
VTYNL);
vty_outln(vty, V4_HEADER);
}
}
header = 0;
@ -242,8 +224,7 @@ bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
ip),
rd_ip.
val);
vty_out(vty, "%s",
VTY_NEWLINE);
vty_outln (vty, VTYNL);
}
rd_header = 0;
}
@ -272,11 +253,11 @@ bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
}
}
if (output_count == 0)
vty_out(vty, "No prefixes displayed, %ld exist%s", total_count,
VTY_NEWLINE);
vty_outln (vty, "No prefixes displayed, %ld exist",
total_count);
else
vty_out(vty, "%sDisplayed %ld out of %ld total prefixes%s",
VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
vty_outln (vty, "%sDisplayed %ld out of %ld total prefixes",
VTYNL, output_count, total_count);
return CMD_SUCCESS;
}
@ -308,7 +289,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd,
ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);
if (!ret) {
vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_normal, NULL, 0,
@ -349,7 +330,7 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_tags,
ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);
if (!ret) {
vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_normal, NULL, 1,
@ -384,13 +365,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "Malformed address: %s%s",
argv[idx_ipv4]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s",
argv[idx_ipv4]->arg);
return CMD_WARNING;
}
@ -401,13 +381,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "%% No such neighbor or address family%s",
VTY_NEWLINE);
vty_outln (vty,
"%% No such neighbor or address family");
return CMD_WARNING;
}
@ -447,13 +426,11 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed Route Distinguisher");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "%% Malformed Route Distinguisher%s",
VTY_NEWLINE);
vty_outln (vty,"%% Malformed Route Distinguisher");
return CMD_WARNING;
}
@ -464,13 +441,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "Malformed address: %s%s",
argv[idx_ext_community]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s",
argv[idx_ext_community]->arg);
return CMD_WARNING;
}
@ -481,13 +457,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "%% No such neighbor or address family%s",
VTY_NEWLINE);
vty_outln (vty,
"%% No such neighbor or address family");
return CMD_WARNING;
}
@ -523,13 +498,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "Malformed address: %s%s",
argv[idx_ipv4]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s",
argv[idx_ipv4]->arg);
return CMD_WARNING;
}
peer = peer_lookup(NULL, &su);
@ -539,13 +513,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_all_neighbor_advertised_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "%% No such neighbor or address family%s",
VTY_NEWLINE);
vty_outln (vty,
"%% No such neighbor or address family");
return CMD_WARNING;
}
@ -584,13 +557,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "Malformed address: %s%s",
argv[idx_ext_community]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s",
argv[idx_ext_community]->arg);
return CMD_WARNING;
}
peer = peer_lookup(NULL, &su);
@ -600,13 +572,12 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "%% No such neighbor or address family%s",
VTY_NEWLINE);
vty_outln (vty,
"%% No such neighbor or address family");
return CMD_WARNING;
}
@ -617,13 +588,11 @@ DEFUN(show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed Route Distinguisher");
vty_out(vty, "%s%s",
json_object_to_json_string(json_no),
VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string(json_no));
json_object_free(json_no);
} else
vty_out(vty, "%% Malformed Route Distinguisher%s",
VTY_NEWLINE);
vty_outln (vty,"%% Malformed Route Distinguisher");
return CMD_WARNING;
}
@ -666,7 +635,7 @@ DEFUN(show_ip_bgp_evpn_rd_overlay,
ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);
if (!ret) {
vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_normal, NULL,

View File

@ -457,7 +457,7 @@ DEFUN (ip_as_path,
regex = bgp_regcomp (regstr);
if (!regex)
{
vty_out (vty, "can't compile regexp %s%s", regstr, VTY_NEWLINE);
vty_outln (vty, "can't compile regexp %s", regstr);
XFREE (MTYPE_TMP, regstr);
return CMD_WARNING;
}
@ -503,8 +503,7 @@ DEFUN (no_ip_as_path,
aslist = as_list_lookup (aslistname);
if (aslist == NULL)
{
vty_out (vty, "ip as-path access-list %s doesn't exist%s", aslistname,
VTY_NEWLINE);
vty_outln (vty, "ip as-path access-list %s doesn't exist",aslistname);
return CMD_WARNING;
}
@ -515,7 +514,7 @@ DEFUN (no_ip_as_path,
type = AS_FILTER_DENY;
else
{
vty_out (vty, "filter type must be [permit|deny]%s", VTY_NEWLINE);
vty_outln (vty, "filter type must be [permit|deny]");
return CMD_WARNING;
}
@ -526,7 +525,7 @@ DEFUN (no_ip_as_path,
regex = bgp_regcomp (regstr);
if (!regex)
{
vty_out (vty, "can't compile regexp %s%s", regstr, VTY_NEWLINE);
vty_outln (vty, "can't compile regexp %s", regstr);
XFREE (MTYPE_TMP, regstr);
return CMD_WARNING;
}
@ -539,7 +538,7 @@ DEFUN (no_ip_as_path,
if (asfilter == NULL)
{
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return CMD_WARNING;
}
@ -563,8 +562,8 @@ DEFUN (no_ip_as_path_all,
aslist = as_list_lookup (argv[idx_word]->arg);
if (aslist == NULL)
{
vty_out (vty, "ip as-path access-list %s doesn't exist%s", argv[idx_word]->arg,
VTY_NEWLINE);
vty_outln (vty, "ip as-path access-list %s doesn't exist",
argv[idx_word]->arg);
return CMD_WARNING;
}
@ -582,12 +581,12 @@ as_list_show (struct vty *vty, struct as_list *aslist)
{
struct as_filter *asfilter;
vty_out (vty, "AS path access list %s%s", aslist->name, VTY_NEWLINE);
vty_outln (vty, "AS path access list %s", aslist->name);
for (asfilter = aslist->head; asfilter; asfilter = asfilter->next)
{
vty_out (vty, " %s %s%s", filter_type_str (asfilter->type),
asfilter->reg_str, VTY_NEWLINE);
vty_outln (vty, " %s %s", filter_type_str (asfilter->type),
asfilter->reg_str);
}
}
@ -599,23 +598,23 @@ as_list_show_all (struct vty *vty)
for (aslist = as_list_master.num.head; aslist; aslist = aslist->next)
{
vty_out (vty, "AS path access list %s%s", aslist->name, VTY_NEWLINE);
vty_outln (vty, "AS path access list %s", aslist->name);
for (asfilter = aslist->head; asfilter; asfilter = asfilter->next)
{
vty_out (vty, " %s %s%s", filter_type_str (asfilter->type),
asfilter->reg_str, VTY_NEWLINE);
vty_outln (vty, " %s %s", filter_type_str (asfilter->type),
asfilter->reg_str);
}
}
for (aslist = as_list_master.str.head; aslist; aslist = aslist->next)
{
vty_out (vty, "AS path access list %s%s", aslist->name, VTY_NEWLINE);
vty_outln (vty, "AS path access list %s", aslist->name);
for (asfilter = aslist->head; asfilter; asfilter = asfilter->next)
{
vty_out (vty, " %s %s%s", filter_type_str (asfilter->type),
asfilter->reg_str, VTY_NEWLINE);
vty_outln (vty, " %s %s", filter_type_str (asfilter->type),
asfilter->reg_str);
}
}
}
@ -659,20 +658,18 @@ config_write_as_list (struct vty *vty)
for (aslist = as_list_master.num.head; aslist; aslist = aslist->next)
for (asfilter = aslist->head; asfilter; asfilter = asfilter->next)
{
vty_out (vty, "ip as-path access-list %s %s %s%s",
vty_outln (vty, "ip as-path access-list %s %s %s",
aslist->name, filter_type_str (asfilter->type),
asfilter->reg_str,
VTY_NEWLINE);
asfilter->reg_str);
write++;
}
for (aslist = as_list_master.str.head; aslist; aslist = aslist->next)
for (asfilter = aslist->head; asfilter; asfilter = asfilter->next)
{
vty_out (vty, "ip as-path access-list %s %s %s%s",
vty_outln (vty, "ip as-path access-list %s %s %s",
aslist->name, filter_type_str (asfilter->type),
asfilter->reg_str,
VTY_NEWLINE);
asfilter->reg_str);
write++;
}
return write;

View File

@ -550,8 +550,6 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
struct bgp_info *ri;
int rd_header;
int header = 1;
char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s";
char v4_header_tag[] = " Network Next Hop In tag/Out tag%s";
unsigned long output_count = 0;
unsigned long total_count = 0;
json_object *json = NULL;
@ -565,7 +563,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
if (bgp == NULL)
{
if (!use_json)
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
vty_outln (vty, "No BGP process is configured");
return CMD_WARNING;
}
@ -591,7 +589,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
if ((afi != AFI_IP) && (afi != AFI_IP6))
{
vty_out (vty, "Afi %d not supported%s", afi, VTY_NEWLINE);
vty_outln (vty, "Afi %d not supported", afi);
return CMD_WARNING;
}
@ -636,16 +634,16 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
else
{
if (tags)
vty_out (vty, v4_header_tag, VTY_NEWLINE);
vty_outln (vty, V4_HEADER_TAG);
else
{
vty_out (vty, "BGP table version is 0, local router ID is %s%s",
inet_ntoa (bgp->router_id), VTY_NEWLINE);
vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
VTY_NEWLINE);
vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, v4_header, VTY_NEWLINE);
vty_outln (vty, "BGP table version is 0, local router ID is %s",
inet_ntoa(bgp->router_id));
vty_outln (vty,
"Status codes: s suppressed, d damped, h history, * valid, > best, i - internal");
vty_outln (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s",
VTYNL);
vty_outln (vty, V4_HEADER);
}
}
header = 0;
@ -705,7 +703,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
rd_vnc_eth.macaddr.octet[4],
rd_vnc_eth.macaddr.octet[5]);
#endif
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
rd_header = 0;
}
@ -742,16 +740,17 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
if (use_json)
{
json_object_object_add(json, "routes", json_nroute);
vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
else
{
if (output_count == 0)
vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
vty_outln (vty, "No prefixes displayed, %ld exist", total_count);
else
vty_out (vty, "%sDisplayed %ld routes and %ld total paths%s",
VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
vty_outln (vty, "%sDisplayed %ld routes and %ld total paths",
VTYNL, output_count, total_count);
}
return CMD_SUCCESS;
@ -782,7 +781,7 @@ DEFUN (show_bgp_ip_vpn_all_rd,
ret = str2prefix_rd (argv[idx_rd]->arg, &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
@ -817,7 +816,7 @@ DEFUN (show_ip_bgp_vpn_rd,
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 0, 0);
@ -882,7 +881,7 @@ DEFUN (show_ip_bgp_vpn_rd_tags,
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 1, 0);
@ -921,11 +920,11 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s", argv[idx_ipv4]->arg);
return CMD_WARNING;
}
@ -937,11 +936,11 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
vty_outln (vty, "%% No such neighbor or address family");
return CMD_WARNING;
}
@ -984,11 +983,11 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}
@ -1000,11 +999,12 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s",
argv[idx_ext_community]->arg);
return CMD_WARNING;
}
@ -1016,11 +1016,11 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
vty_outln (vty, "%% No such neighbor or address family");
return CMD_WARNING;
}
@ -1060,11 +1060,11 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_advertised_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s", argv[idx_ipv4]->arg);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
@ -1075,11 +1075,11 @@ DEFUN (show_ip_bgp_vpn_all_neighbor_advertised_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
vty_outln (vty, "%% No such neighbor or address family");
return CMD_WARNING;
}
return show_adj_route_vpn (vty, peer, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
@ -1121,11 +1121,12 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address: %s",
argv[idx_ext_community]->arg);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
@ -1136,11 +1137,11 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
vty_outln (vty, "%% No such neighbor or address family");
return CMD_WARNING;
}
@ -1152,11 +1153,11 @@ DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes,
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
vty_outln (vty, "%s", json_object_to_json_string(json_no));
json_object_free(json_no);
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed Route Distinguisher");
return CMD_WARNING;
}

View File

@ -67,6 +67,13 @@ typedef enum {
"Address Family\n" \
"Address Family\n"
#define V4_HEADER \
" Network Next Hop Metric LocPrf Weight Path"
#define V4_HEADER_TAG \
" Network Next Hop In tag/Out tag"
#define V4_HEADER_OVERLAY \
" Network Next Hop EthTag Overlay Index RouterMac"
struct rd_as
{
u_int16_t type;

View File

@ -387,7 +387,7 @@ bgp_show_nexthops (struct vty *vty, struct bgp *bgp, int detail)
time_t tbuf;
afi_t afi;
vty_out (vty, "Current BGP nexthop cache:%s", VTY_NEWLINE);
vty_outln (vty, "Current BGP nexthop cache:");
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
{
if (!bgp->nexthop_cache_table[afi])
@ -399,56 +399,52 @@ bgp_show_nexthops (struct vty *vty, struct bgp *bgp, int detail)
{
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID))
{
vty_out (vty, " %s valid [IGP metric %d], #paths %d%s",
vty_outln (vty, " %s valid [IGP metric %d], #paths %d",
inet_ntop (rn->p.family, &rn->p.u.prefix, buf, sizeof (buf)),
bnc->metric, bnc->path_count, VTY_NEWLINE);
bnc->metric, bnc->path_count);
if (detail)
for (nexthop = bnc->nexthop; nexthop; nexthop = nexthop->next)
switch (nexthop->type)
{
case NEXTHOP_TYPE_IPV6:
vty_out (vty, " gate %s%s",
inet_ntop (AF_INET6, &nexthop->gate.ipv6,
buf, sizeof (buf)), VTY_NEWLINE);
vty_outln (vty, " gate %s",
inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf)));
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
vty_out(vty, " gate %s, if %s%s",
vty_outln (vty, " gate %s, if %s",
inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf,
sizeof (buf)),
ifindex2ifname(nexthop->ifindex, bgp->vrf_id),
VTY_NEWLINE);
ifindex2ifname(nexthop->ifindex, bgp->vrf_id));
break;
case NEXTHOP_TYPE_IPV4:
vty_out (vty, " gate %s%s",
inet_ntop (AF_INET, &nexthop->gate.ipv4, buf,
sizeof (buf)), VTY_NEWLINE);
vty_outln (vty, " gate %s",
inet_ntop(AF_INET, &nexthop->gate.ipv4, buf, sizeof(buf)));
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out (vty, " if %s%s",
ifindex2ifname(nexthop->ifindex, bgp->vrf_id), VTY_NEWLINE);
vty_outln (vty, " if %s",
ifindex2ifname(nexthop->ifindex, bgp->vrf_id));
break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
vty_out (vty, " gate %s, if %s%s",
vty_outln (vty, " gate %s, if %s",
inet_ntop(AF_INET, &nexthop->gate.ipv4, buf,
sizeof (buf)),
ifindex2ifname(nexthop->ifindex, bgp->vrf_id), VTY_NEWLINE);
ifindex2ifname(nexthop->ifindex, bgp->vrf_id));
break;
default:
vty_out (vty, " invalid nexthop type %u%s",
nexthop->type, VTY_NEWLINE);
vty_outln (vty, " invalid nexthop type %u",
nexthop->type);
}
}
else
{
vty_out (vty, " %s invalid%s",
inet_ntop (rn->p.family, &rn->p.u.prefix,
buf, sizeof (buf)), VTY_NEWLINE);
vty_outln (vty, " %s invalid",
inet_ntop(rn->p.family, &rn->p.u.prefix, buf, sizeof(buf)));
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED))
vty_out (vty, " Must be Connected%s", VTY_NEWLINE);
vty_outln (vty, " Must be Connected");
}
tbuf = time(NULL) - (bgp_clock() - bnc->last_update);
vty_out (vty, " Last update: %s", ctime(&tbuf));
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
}
@ -465,7 +461,7 @@ show_ip_bgp_nexthop_table (struct vty *vty, const char *name, int detail)
bgp = bgp_get_default ();
if (!bgp)
{
vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
vty_outln (vty, "%% No such BGP instance exist");
return CMD_WARNING;
}
@ -482,10 +478,9 @@ bgp_show_all_instances_nexthops_vty (struct vty *vty)
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
{
vty_out (vty, "%sInstance %s:%s",
VTY_NEWLINE,
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
VTY_NEWLINE);
vty_outln (vty, "%sInstance %s:",
VTYNL,
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name);
bgp_show_nexthops (vty, bgp, 0);
}
}

View File

@ -167,7 +167,7 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso
vty_out (vty, "SAFI Unknown %d ", mpc.safi);
break;
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
else if (hdr->code >= 128)

File diff suppressed because it is too large Load Diff

View File

@ -54,9 +54,9 @@ enum bgp_show_type
#define BGP_SHOW_SCODE_HEADER "Status codes: s suppressed, d damped, "\
"h history, * valid, > best, = multipath,%s"\
" i internal, r RIB-failure, S Stale, R Removed%s"
#define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
#define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path%s"
" i internal, r RIB-failure, S Stale, R Removed"
#define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s"
#define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path"
/* Ancillary information to struct bgp_info,
* used for uncommonly used data (aggregation, MPLS, etc.)

View File

@ -2851,10 +2851,10 @@ bgp_route_match_add (struct vty *vty,
switch (ret)
{
case RMAP_RULE_MISSING:
vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
vty_outln (vty, "%% BGP Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
vty_outln (vty, "%% BGP Argument is malformed.");
return CMD_WARNING;
}
}
@ -2900,10 +2900,10 @@ bgp_route_match_delete (struct vty *vty,
switch (ret)
{
case RMAP_RULE_MISSING:
vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
vty_outln (vty, "%% BGP Can't find rule.");
break;
case RMAP_COMPILE_ERROR:
vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
vty_outln (vty, "%% BGP Argument is malformed.");
break;
}
if (dep_name)
@ -3886,7 +3886,7 @@ DEFUN (set_community,
/* Can't compile user input into communities attribute. */
if (! com)
{
vty_out (vty, "%% Malformed communities attribute%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed communities attribute");
return CMD_WARNING;
}
@ -4210,7 +4210,7 @@ DEFUN (set_aggregator_as,
ret = inet_aton (argv[idx_ipv4]->arg, &address);
if (ret == 0)
{
vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE);
vty_outln (vty, "Aggregator IP address is invalid");
return CMD_WARNING;
}
@ -4251,7 +4251,7 @@ DEFUN (no_set_aggregator_as,
ret = inet_aton (argv[idx_ip]->arg, &address);
if (ret == 0)
{
vty_out (vty, "Aggregator IP address is invalid%s", VTY_NEWLINE);
vty_outln (vty, "Aggregator IP address is invalid");
return CMD_WARNING;
}
@ -4362,7 +4362,7 @@ DEFUN (set_ipv6_nexthop_global,
ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr);
if (!ret)
{
vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed nexthop address");
return CMD_WARNING;
}
if (IN6_IS_ADDR_UNSPECIFIED(&addr) ||
@ -4370,7 +4370,7 @@ DEFUN (set_ipv6_nexthop_global,
IN6_IS_ADDR_MULTICAST(&addr) ||
IN6_IS_ADDR_LINKLOCAL(&addr))
{
vty_out (vty, "%% Invalid global nexthop address%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid global nexthop address");
return CMD_WARNING;
}

View File

@ -564,73 +564,69 @@ update_group_show_walkcb (struct update_group *updgrp, void *arg)
vty = ctx->vty;
vty_out (vty, "Update-group %" PRIu64 ":%s", updgrp->id, VTY_NEWLINE);
vty_outln (vty, "Update-group %" PRIu64 ":", updgrp->id);
vty_out (vty, " Created: %s", timestamp_string (updgrp->uptime));
filter = &updgrp->conf->filter[updgrp->afi][updgrp->safi];
if (filter->map[RMAP_OUT].name)
vty_out (vty, " Outgoing route map: %s%s%s",
vty_outln (vty, " Outgoing route map: %s%s",
filter->map[RMAP_OUT].map ? "X" : "",
filter->map[RMAP_OUT].name, VTY_NEWLINE);
vty_out (vty, " MRAI value (seconds): %d%s",
updgrp->conf->v_routeadv, VTY_NEWLINE);
filter->map[RMAP_OUT].name);
vty_outln (vty, " MRAI value (seconds): %d",
updgrp->conf->v_routeadv);
if (updgrp->conf->change_local_as)
vty_out (vty, " Local AS %u%s%s%s",
vty_outln (vty, " Local AS %u%s%s",
updgrp->conf->change_local_as,
CHECK_FLAG (updgrp->conf->flags,
PEER_FLAG_LOCAL_AS_NO_PREPEND) ? " no-prepend" : "",
CHECK_FLAG (updgrp->conf->flags,
PEER_FLAG_LOCAL_AS_REPLACE_AS) ? " replace-as" : "",
VTY_NEWLINE);
CHECK_FLAG(updgrp->conf->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? " replace-as" : "");
UPDGRP_FOREACH_SUBGRP (updgrp, subgrp)
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue;
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, " Update-subgroup %" PRIu64 ":%s", subgrp->id, VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_outln (vty, " Update-subgroup %" PRIu64 ":", subgrp->id);
vty_out (vty, " Created: %s", timestamp_string (subgrp->uptime));
if (subgrp->split_from.update_group_id || subgrp->split_from.subgroup_id)
{
vty_out (vty, " Split from group id: %" PRIu64 "%s",
subgrp->split_from.update_group_id, VTY_NEWLINE);
vty_out (vty, " Split from subgroup id: %" PRIu64 "%s",
subgrp->split_from.subgroup_id, VTY_NEWLINE);
vty_outln (vty, " Split from group id: %" PRIu64 "",
subgrp->split_from.update_group_id);
vty_outln (vty, " Split from subgroup id: %" PRIu64 "",
subgrp->split_from.subgroup_id);
}
vty_out (vty, " Join events: %u%s", subgrp->join_events, VTY_NEWLINE);
vty_out (vty, " Prune events: %u%s",
subgrp->prune_events, VTY_NEWLINE);
vty_out (vty, " Merge events: %u%s",
subgrp->merge_events, VTY_NEWLINE);
vty_out (vty, " Split events: %u%s",
subgrp->split_events, VTY_NEWLINE);
vty_out (vty, " Update group switch events: %u%s",
subgrp->updgrp_switch_events, VTY_NEWLINE);
vty_out (vty, " Peer refreshes combined: %u%s",
subgrp->peer_refreshes_combined, VTY_NEWLINE);
vty_out (vty, " Merge checks triggered: %u%s",
subgrp->merge_checks_triggered, VTY_NEWLINE);
vty_out (vty, " Version: %" PRIu64 "%s", subgrp->version, VTY_NEWLINE);
vty_out (vty, " Packet queue length: %d%s",
bpacket_queue_length (SUBGRP_PKTQ (subgrp)), VTY_NEWLINE);
vty_out (vty, " Total packets enqueued: %u%s",
subgroup_total_packets_enqueued (subgrp), VTY_NEWLINE);
vty_out (vty, " Packet queue high watermark: %d%s",
bpacket_queue_hwm_length (SUBGRP_PKTQ (subgrp)), VTY_NEWLINE);
vty_out (vty, " Adj-out list count: %u%s",
subgrp->adj_count, VTY_NEWLINE);
vty_out (vty, " Advertise list: %s%s",
advertise_list_is_empty (subgrp) ? "empty" : "not empty",
VTY_NEWLINE);
vty_out (vty, " Flags: %s%s",
CHECK_FLAG (subgrp->flags,
SUBGRP_FLAG_NEEDS_REFRESH) ? "R" : "", VTY_NEWLINE);
vty_outln (vty, " Join events: %u", subgrp->join_events);
vty_outln (vty, " Prune events: %u",
subgrp->prune_events);
vty_outln (vty, " Merge events: %u",
subgrp->merge_events);
vty_outln (vty, " Split events: %u",
subgrp->split_events);
vty_outln (vty, " Update group switch events: %u",
subgrp->updgrp_switch_events);
vty_outln (vty, " Peer refreshes combined: %u",
subgrp->peer_refreshes_combined);
vty_outln (vty, " Merge checks triggered: %u",
subgrp->merge_checks_triggered);
vty_outln (vty, " Version: %" PRIu64 "", subgrp->version);
vty_outln (vty, " Packet queue length: %d",
bpacket_queue_length(SUBGRP_PKTQ(subgrp)));
vty_outln (vty, " Total packets enqueued: %u",
subgroup_total_packets_enqueued(subgrp));
vty_outln (vty, " Packet queue high watermark: %d",
bpacket_queue_hwm_length(SUBGRP_PKTQ(subgrp)));
vty_outln (vty, " Adj-out list count: %u",
subgrp->adj_count);
vty_outln (vty, " Advertise list: %s",
advertise_list_is_empty(subgrp) ? "empty" : "not empty");
vty_outln (vty, " Flags: %s",
CHECK_FLAG(subgrp->flags, SUBGRP_FLAG_NEEDS_REFRESH) ? "R" : "");
if (subgrp->peer_count > 0)
{
vty_out (vty, " Peers:%s", VTY_NEWLINE);
vty_outln (vty, " Peers:");
SUBGRP_FOREACH_PEER (subgrp, paf)
vty_out (vty, " - %s%s", paf->peer->host, VTY_NEWLINE);
vty_outln (vty, " - %s", paf->peer->host);
}
}
return UPDWALK_CONTINUE;
@ -652,8 +648,8 @@ updgrp_show_packet_queue_walkcb (struct update_group *updgrp, void *arg)
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue;
vty_out (vty, "update group %" PRIu64 ", subgroup %" PRIu64 "%s", updgrp->id,
subgrp->id, VTY_NEWLINE);
vty_outln (vty, "update group %" PRIu64 ", subgroup %" PRIu64 "", updgrp->id,
subgrp->id);
bpacket_queue_show_vty (SUBGRP_PKTQ (subgrp), vty);
}
return UPDWALK_CONTINUE;
@ -1601,28 +1597,28 @@ update_group_show (struct bgp *bgp, afi_t afi, safi_t safi, struct vty *vty,
void
update_group_show_stats (struct bgp *bgp, struct vty *vty)
{
vty_out (vty, "Update groups created: %u%s",
bgp->update_group_stats.updgrps_created, VTY_NEWLINE);
vty_out (vty, "Update groups deleted: %u%s",
bgp->update_group_stats.updgrps_deleted, VTY_NEWLINE);
vty_out (vty, "Update subgroups created: %u%s",
bgp->update_group_stats.subgrps_created, VTY_NEWLINE);
vty_out (vty, "Update subgroups deleted: %u%s",
bgp->update_group_stats.subgrps_deleted, VTY_NEWLINE);
vty_out (vty, "Join events: %u%s",
bgp->update_group_stats.join_events, VTY_NEWLINE);
vty_out (vty, "Prune events: %u%s",
bgp->update_group_stats.prune_events, VTY_NEWLINE);
vty_out (vty, "Merge events: %u%s",
bgp->update_group_stats.merge_events, VTY_NEWLINE);
vty_out (vty, "Split events: %u%s",
bgp->update_group_stats.split_events, VTY_NEWLINE);
vty_out (vty, "Update group switch events: %u%s",
bgp->update_group_stats.updgrp_switch_events, VTY_NEWLINE);
vty_out (vty, "Peer route refreshes combined: %u%s",
bgp->update_group_stats.peer_refreshes_combined, VTY_NEWLINE);
vty_out (vty, "Merge checks triggered: %u%s",
bgp->update_group_stats.merge_checks_triggered, VTY_NEWLINE);
vty_outln (vty, "Update groups created: %u",
bgp->update_group_stats.updgrps_created);
vty_outln (vty, "Update groups deleted: %u",
bgp->update_group_stats.updgrps_deleted);
vty_outln (vty, "Update subgroups created: %u",
bgp->update_group_stats.subgrps_created);
vty_outln (vty, "Update subgroups deleted: %u",
bgp->update_group_stats.subgrps_deleted);
vty_outln (vty, "Join events: %u",
bgp->update_group_stats.join_events);
vty_outln (vty, "Prune events: %u",
bgp->update_group_stats.prune_events);
vty_outln (vty, "Merge events: %u",
bgp->update_group_stats.merge_events);
vty_outln (vty, "Split events: %u",
bgp->update_group_stats.split_events);
vty_outln (vty, "Update group switch events: %u",
bgp->update_group_stats.updgrp_switch_events);
vty_outln (vty, "Peer route refreshes combined: %u",
bgp->update_group_stats.peer_refreshes_combined);
vty_outln (vty, "Merge checks triggered: %u",
bgp->update_group_stats.merge_checks_triggered);
}
/*

View File

@ -226,17 +226,16 @@ subgrp_show_adjq_vty (struct update_subgroup *subgrp, struct vty *vty,
{
if (header1)
{
vty_out (vty,
"BGP table version is %" PRIu64 ", local router ID is %s%s",
table->version, inet_ntoa (bgp->router_id),
VTY_NEWLINE);
vty_out (vty, BGP_SHOW_SCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, BGP_SHOW_OCODE_HEADER, VTY_NEWLINE, VTY_NEWLINE);
vty_outln (vty,
"BGP table version is %" PRIu64 ", local router ID is %s",
table->version,inet_ntoa(bgp->router_id));
vty_outln (vty, BGP_SHOW_SCODE_HEADER, VTYNL);
vty_outln (vty, BGP_SHOW_OCODE_HEADER, VTYNL);
header1 = 0;
}
if (header2)
{
vty_out (vty, BGP_SHOW_HEADER, VTY_NEWLINE);
vty_outln (vty, BGP_SHOW_HEADER);
header2 = 0;
}
if ((flags & UPDWALK_FLAGS_ADVQUEUE) && adj->adv && adj->adv->baa)
@ -251,8 +250,8 @@ subgrp_show_adjq_vty (struct update_subgroup *subgrp, struct vty *vty,
}
}
if (output_count != 0)
vty_out (vty, "%sTotal number of prefixes %ld%s",
VTY_NEWLINE, output_count, VTY_NEWLINE);
vty_outln (vty, "%sTotal number of prefixes %ld",
VTYNL, output_count);
}
static int
@ -267,8 +266,8 @@ updgrp_show_adj_walkcb (struct update_group *updgrp, void *arg)
{
if (ctx->subgrp_id && (ctx->subgrp_id != subgrp->id))
continue;
vty_out (vty, "update group %" PRIu64 ", subgroup %" PRIu64 "%s", updgrp->id,
subgrp->id, VTY_NEWLINE);
vty_outln (vty, "update group %" PRIu64 ", subgroup %" PRIu64 "", updgrp->id,
subgrp->id);
subgrp_show_adjq_vty (subgrp, vty, ctx->flags);
}
return UPDWALK_CONTINUE;

View File

@ -392,12 +392,12 @@ bpacket_queue_show_vty (struct bpacket_queue *q, struct vty *vty)
pkt = bpacket_queue_first (q);
while (pkt)
{
vty_out (vty, " Packet %p ver %u buffer %p%s", pkt, pkt->ver,
pkt->buffer, VTY_NEWLINE);
vty_outln (vty, " Packet %p ver %u buffer %p", pkt, pkt->ver,
pkt->buffer);
LIST_FOREACH (paf, &(pkt->peers), pkt_train)
{
vty_out (vty, " - %s%s", paf->peer->host, VTY_NEWLINE);
vty_outln (vty, " - %s", paf->peer->host);
}
pkt = bpacket_next (pkt);
}

View File

@ -41,7 +41,6 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd,
struct attr *attr;
int rd_header;
int header = 1;
char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s";
json_object *json = NULL;
json_object *json_scode = NULL;
json_object *json_ocode = NULL;
@ -52,7 +51,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd,
if (bgp == NULL)
{
if (!use_json)
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
vty_outln (vty, "No BGP process is configured");
return CMD_WARNING;
}
@ -105,13 +104,13 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd,
}
else
{
vty_out (vty, "BGP table version is 0, local router ID is %s%s",
inet_ntoa (bgp->router_id), VTY_NEWLINE);
vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
VTY_NEWLINE);
vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, v4_header, VTY_NEWLINE);
vty_outln (vty, "BGP table version is 0, local router ID is %s",
inet_ntoa(bgp->router_id));
vty_outln (vty,
"Status codes: s suppressed, d damped, h history, * valid, > best, i - internal");
vty_outln (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s",
VTYNL);
vty_outln (vty, V4_HEADER);
}
header = 0;
}
@ -171,7 +170,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd,
rd_vnc_eth.macaddr.octet[5]);
#endif
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
rd_header = 0;
}
@ -192,7 +191,8 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd,
if (use_json)
{
json_object_object_add(json, "routes", json_routes);
vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
return CMD_SUCCESS;

File diff suppressed because it is too large Load Diff

View File

@ -54,14 +54,11 @@ extern int bgp_vty_return (struct vty *vty, int ret);
extern struct peer *
peer_and_group_lookup_vty (struct vty *vty, const char *peer_str);
extern int
bgp_parse_afi(const char *str, afi_t *afi);
extern afi_t
bgp_vty_afi_from_arg(const char *afi_str);
bgp_vty_afi_from_str(const char *afi_str);
extern safi_t
bgp_vty_safi_from_arg(const char *safi_str);
bgp_vty_safi_from_str(const char *safi_str);
extern int
argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *afi);

View File

@ -581,7 +581,7 @@ bgp_interface_vrf_update (int command, struct zclient *zclient, zebra_size_t len
}
}
if_update (ifp, ifp->name, strlen (ifp->name), new_vrf_id);
if_update_to_new_vrf (ifp, new_vrf_id);
bgp = bgp_lookup_by_vrf_id (new_vrf_id);
if (!bgp)

View File

@ -6416,7 +6416,7 @@ peer_uptime (time_t uptime2, char *buf, size_t len, u_char use_json, json_object
{
epoch_tbuf = time(NULL) - uptime1;
json_object_string_add(json, "peerUptime", buf);
json_object_long_add(json, "peerUptimeMsec", uptime1 * 1000);
json_object_int_add(json, "peerUptimeMsec", uptime1 * 1000);
json_object_int_add(json, "peerUptimeEstablishedEpoch", epoch_tbuf);
}
@ -6472,14 +6472,14 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s distribute-list %s in%s",
addr, filter->dlist[in].name, VTY_NEWLINE);
addr, filter->dlist[in].name, VTYNL);
}
if (filter->dlist[out].name && ! gfilter)
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s distribute-list %s out%s",
addr, filter->dlist[out].name, VTY_NEWLINE);
addr, filter->dlist[out].name, VTYNL);
}
/* prefix-list. */
@ -6489,14 +6489,14 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s prefix-list %s in%s",
addr, filter->plist[in].name, VTY_NEWLINE);
addr, filter->plist[in].name, VTYNL);
}
if (filter->plist[out].name && ! gfilter)
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s prefix-list %s out%s",
addr, filter->plist[out].name, VTY_NEWLINE);
addr, filter->plist[out].name, VTYNL);
}
/* route-map. */
@ -6506,7 +6506,7 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s route-map %s in%s",
addr, filter->map[RMAP_IN].name, VTY_NEWLINE);
addr, filter->map[RMAP_IN].name, VTYNL);
}
if (filter->map[RMAP_OUT].name)
@ -6515,7 +6515,7 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s route-map %s out%s",
addr, filter->map[RMAP_OUT].name, VTY_NEWLINE);
addr, filter->map[RMAP_OUT].name, VTYNL);
}
/* unsuppress-map */
@ -6523,7 +6523,7 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s unsuppress-map %s%s",
addr, filter->usmap.name, VTY_NEWLINE);
addr, filter->usmap.name, VTYNL);
}
/* filter-list. */
@ -6533,14 +6533,14 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s filter-list %s in%s",
addr, filter->aslist[in].name, VTY_NEWLINE);
addr, filter->aslist[in].name, VTYNL);
}
if (filter->aslist[out].name && ! gfilter)
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s filter-list %s out%s",
addr, filter->aslist[out].name, VTY_NEWLINE);
addr, filter->aslist[out].name, VTYNL);
}
}
@ -6595,7 +6595,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if_ras_printed = TRUE;
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* remote-as and peer-group */
@ -6608,24 +6608,23 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
{
if (peer->as_type == AS_SPECIFIED)
{
vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s remote-as %u", addr,peer->as);
}
else if (peer->as_type == AS_INTERNAL)
{
vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s remote-as internal", addr);
}
else if (peer->as_type == AS_EXTERNAL)
{
vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s remote-as external", addr);
}
}
/* For swpX peers we displayed the peer-group
* via 'neighbor swpX interface peer-group WORD' */
if (!if_pg_printed)
vty_out (vty, " neighbor %s peer-group %s%s", addr,
peer->group->name, VTY_NEWLINE);
vty_outln (vty, " neighbor %s peer-group %s", addr,
peer->group->name);
}
/* peer is NOT a member of a peer-group */
@ -6634,24 +6633,22 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
/* peer is a peer-group, declare the peer-group */
if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
vty_out (vty, " neighbor %s peer-group%s", addr,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s peer-group",addr);
}
if (!if_ras_printed)
{
if (peer->as_type == AS_SPECIFIED)
{
vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s remote-as %u", addr,peer->as);
}
else if (peer->as_type == AS_INTERNAL)
{
vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s remote-as internal", addr);
}
else if (peer->as_type == AS_EXTERNAL)
{
vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s remote-as external", addr);
}
}
}
@ -6666,20 +6663,18 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
|| (CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) !=
CHECK_FLAG (g_peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)))
{
vty_out (vty, " neighbor %s local-as %u%s%s%s", addr,
vty_outln (vty, " neighbor %s local-as %u%s%s", addr,
peer->change_local_as,
CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
" no-prepend" : "",
CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
" replace-as" : "", VTY_NEWLINE);
CHECK_FLAG(peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? " replace-as" : "");
}
}
/* description */
if (peer->desc)
{
vty_out (vty, " neighbor %s description %s%s", addr, peer->desc,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s description %s", addr,peer->desc);
}
/* shutdown */
@ -6690,10 +6685,10 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
peer->tx_shutdown_message)
{
if (peer->tx_shutdown_message)
vty_out (vty, " neighbor %s shutdown message %s%s", addr,
peer->tx_shutdown_message, VTY_NEWLINE);
vty_outln (vty, " neighbor %s shutdown message %s", addr,
peer->tx_shutdown_message);
else
vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s shutdown", addr);
}
}
@ -6713,8 +6708,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
|| ! g_peer->password
|| strcmp (peer->password, g_peer->password) != 0)
{
vty_out (vty, " neighbor %s password %s%s", addr, peer->password,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s password %s", addr,peer->password);
}
}
@ -6723,22 +6717,20 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
{
if (!peer_group_active (peer))
{
vty_out (vty, " neighbor %s solo%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s solo", addr);
}
}
/* BGP port */
if (peer->port != BGP_PORT_DEFAULT)
{
vty_out (vty, " neighbor %s port %d%s", addr, peer->port,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s port %d", addr,peer->port);
}
/* Local interface name */
if (peer->ifname)
{
vty_out (vty, " neighbor %s interface %s%s", addr, peer->ifname,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s interface %s", addr,peer->ifname);
}
/* passive */
@ -6747,7 +6739,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSIVE))
{
vty_out (vty, " neighbor %s passive%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s passive", addr);
}
}
@ -6757,8 +6749,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
{
if (! peer_group_active (peer) || g_peer->ttl != peer->ttl)
{
vty_out (vty, " neighbor %s ebgp-multihop %d%s", addr, peer->ttl,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s ebgp-multihop %d", addr,peer->ttl);
}
}
@ -6767,8 +6758,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
{
if (! peer_group_active (peer) || g_peer->gtsm_hops != peer->gtsm_hops)
{
vty_out (vty, " neighbor %s ttl-security hops %d%s", addr,
peer->gtsm_hops, VTY_NEWLINE);
vty_outln (vty, " neighbor %s ttl-security hops %d", addr,
peer->gtsm_hops);
}
}
@ -6778,7 +6769,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
{
vty_out (vty, " neighbor %s disable-connected-check%s", addr, VTY_NEWLINE);
vty_outln (vty, " neighbor %s disable-connected-check", addr);
}
}
@ -6788,8 +6779,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) || ! g_peer->update_if
|| strcmp (g_peer->update_if, peer->update_if) != 0)
{
vty_out (vty, " neighbor %s update-source %s%s", addr,
peer->update_if, VTY_NEWLINE);
vty_outln (vty, " neighbor %s update-source %s", addr,
peer->update_if);
}
}
if (peer->update_source)
@ -6798,9 +6789,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
|| sockunion_cmp (g_peer->update_source,
peer->update_source) != 0)
{
vty_out (vty, " neighbor %s update-source %s%s", addr,
sockunion2str (peer->update_source, buf, SU_ADDRSTRLEN),
VTY_NEWLINE);
vty_outln (vty, " neighbor %s update-source %s", addr,
sockunion2str(peer->update_source, buf, SU_ADDRSTRLEN));
}
}
@ -6809,8 +6799,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
((! peer_group_active (peer) && peer->v_routeadv != BGP_DEFAULT_EBGP_ROUTEADV) ||
(peer_group_active (peer) && peer->v_routeadv != g_peer->v_routeadv)))
{
vty_out (vty, " neighbor %s advertisement-interval %u%s",
addr, peer->v_routeadv, VTY_NEWLINE);
vty_outln (vty, " neighbor %s advertisement-interval %u",
addr, peer->v_routeadv);
}
/* timers */
@ -6818,8 +6808,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
((! peer_group_active (peer) && (peer->keepalive != BGP_DEFAULT_KEEPALIVE || peer->holdtime != BGP_DEFAULT_HOLDTIME)) ||
(peer_group_active (peer) && (peer->keepalive != g_peer->keepalive || peer->holdtime != g_peer->holdtime))))
{
vty_out (vty, " neighbor %s timers %u %u%s", addr,
peer->keepalive, peer->holdtime, VTY_NEWLINE);
vty_outln (vty, " neighbor %s timers %u %u", addr,
peer->keepalive, peer->holdtime);
}
if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) &&
@ -6827,8 +6817,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
(peer_group_active (peer) && peer->connect != g_peer->connect)))
{
vty_out (vty, " neighbor %s timers connect %u%s", addr,
peer->connect, VTY_NEWLINE);
vty_outln (vty, " neighbor %s timers connect %u", addr,
peer->connect);
}
/* capability dynamic */
@ -6837,8 +6827,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
{
vty_out (vty, " neighbor %s capability dynamic%s", addr,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s capability dynamic",addr);
}
}
@ -6848,8 +6837,8 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_CAPABILITY_ENHE))
{
vty_out (vty, " no neighbor %s capability extended-nexthop%s", addr,
VTY_NEWLINE);
vty_outln (vty, " no neighbor %s capability extended-nexthop",
addr);
}
}
@ -6858,8 +6847,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_CAPABILITY_ENHE))
{
vty_out (vty, " neighbor %s capability extended-nexthop%s", addr,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s capability extended-nexthop",addr);
}
}
@ -6869,8 +6857,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_DONT_CAPABILITY))
{
vty_out (vty, " neighbor %s dont-capability-negotiate%s", addr,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s dont-capability-negotiate",addr);
}
}
@ -6880,8 +6867,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
{
vty_out (vty, " neighbor %s override-capability%s", addr,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s override-capability",addr);
}
}
@ -6891,8 +6877,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
if (! peer_group_active (peer) ||
! CHECK_FLAG (g_peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
{
vty_out (vty, " neighbor %s strict-capability-match%s", addr,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s strict-capability-match",addr);
}
}
}
@ -6927,7 +6912,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s activate%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* If the peer-group is not active but peer is, print an 'activate' */
@ -6935,7 +6920,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s activate%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
}
else
@ -6948,13 +6933,13 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out(vty, afi, safi, write,
" neighbor %s activate%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
}
else
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s activate%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else
{
@ -6964,7 +6949,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s activate%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
}
}
@ -6975,14 +6960,14 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s addpath-tx-all-paths%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s addpath-tx-bestpath-per-AS%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* ORF capability. */
@ -7000,7 +6985,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
vty_out (vty, " send");
else
vty_out (vty, " receive");
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* Route reflector client. */
@ -7008,7 +6993,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s route-reflector-client%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* next-hop-self force */
@ -7016,7 +7001,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s next-hop-self force%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* next-hop-self */
@ -7024,7 +7009,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s next-hop-self%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* remove-private-AS */
@ -7032,28 +7017,28 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s remove-private-AS all replace-AS%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s remove-private-AS replace-AS%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s remove-private-AS all%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s remove-private-AS%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* as-override */
@ -7061,7 +7046,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s as-override%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* send-community print. */
@ -7073,25 +7058,25 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s send-community all%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_LARGE_COMMUNITY))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s send-community large%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s send-community extended%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else if (peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY))
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s send-community%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
}
else
@ -7105,7 +7090,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s send-community all%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else
{
@ -7114,7 +7099,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s send-community large%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
if (!peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY) &&
@ -7122,7 +7107,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s send-community extended%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
if (!peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY) &&
@ -7130,7 +7115,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s send-community%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
}
}
@ -7147,7 +7132,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
" neighbor %s default-originate", addr);
if (peer->default_rmap[afi][safi].name)
vty_out (vty, " route-map %s", peer->default_rmap[afi][safi].name);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* Soft reconfiguration inbound. */
@ -7155,7 +7140,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s soft-reconfiguration inbound%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* maximum-prefix. */
@ -7175,7 +7160,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
vty_out (vty, " warning-only");
if (peer->pmax_restart[afi][safi])
vty_out (vty, " restart %u", peer->pmax_restart[afi][safi]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* Route server client. */
@ -7183,7 +7168,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s route-server-client%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* Nexthop-local unchanged. */
@ -7191,7 +7176,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s nexthop-local unchanged%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
/* allowas-in <1-10> */
@ -7205,13 +7190,13 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s allowas-in%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s allowas-in %d%s",
addr, peer->allowas_in[afi][safi], VTY_NEWLINE);
addr, peer->allowas_in[afi][safi], VTYNL);
}
}
}
@ -7224,7 +7209,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s allowas-in origin%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
}
@ -7238,7 +7223,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s weight %lu%s",
addr, peer->weight[afi][safi], VTY_NEWLINE);
addr, peer->weight[afi][safi], VTYNL);
}
}
@ -7256,7 +7241,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s attribute-unchanged%s",
addr, VTY_NEWLINE);
addr, VTYNL);
}
else
{
@ -7267,7 +7252,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_UNCHANGED) ?
" next-hop" : "",
peergroup_af_flag_check (peer, afi, safi, PEER_FLAG_MED_UNCHANGED) ?
" med" : "", VTY_NEWLINE);
" med" : "", VTYNL);
}
}
}
@ -7280,7 +7265,7 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,
if (*write)
return;
vty_out (vty, " !%s address-family ", VTY_NEWLINE);
vty_outln (vty, " !%s address-family ", VTYNL);
if (afi == AFI_IP)
{
@ -7313,7 +7298,7 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,
if (safi == SAFI_EVPN)
vty_out (vty, "l2vpn evpn");
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
*write = 1;
}
@ -7352,7 +7337,7 @@ bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi,
bgp_config_write_table_map (vty, bgp, afi, safi, &write);
if (write)
vty_out (vty, " exit-address-family%s", VTY_NEWLINE);
vty_outln (vty, " exit-address-family");
return write;
}
@ -7370,26 +7355,25 @@ bgp_config_write (struct vty *vty)
/* BGP Multiple instance. */
if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
{
vty_out (vty, "no bgp multiple-instance%s", VTY_NEWLINE);
vty_outln (vty, "no bgp multiple-instance");
write++;
}
/* BGP Config type. */
if (bgp_option_check (BGP_OPT_CONFIG_CISCO))
{
vty_out (vty, "bgp config-type cisco%s", VTY_NEWLINE);
vty_outln (vty, "bgp config-type cisco");
write++;
}
if (bm->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER)
vty_out (vty, "bgp route-map delay-timer %u%s", bm->rmap_update_timer,
VTY_NEWLINE);
vty_outln (vty, "bgp route-map delay-timer %u",bm->rmap_update_timer);
/* BGP configuration. */
for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp))
{
if (write)
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
/* Router bgp ASN */
vty_out (vty, "router bgp %u", bgp->as);
@ -7401,70 +7385,66 @@ bgp_config_write (struct vty *vty)
(bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) ?
"view" : "vrf", bgp->name);
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
/* No Synchronization */
if (bgp_option_check (BGP_OPT_CONFIG_CISCO))
vty_out (vty, " no synchronization%s", VTY_NEWLINE);
vty_outln (vty, " no synchronization");
/* BGP fast-external-failover. */
if (CHECK_FLAG (bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER))
vty_out (vty, " no bgp fast-external-failover%s", VTY_NEWLINE);
vty_outln (vty, " no bgp fast-external-failover");
/* BGP router ID. */
if (bgp->router_id_static.s_addr != 0)
vty_out (vty, " bgp router-id %s%s",
inet_ntoa (bgp->router_id_static), VTY_NEWLINE);
vty_outln (vty, " bgp router-id %s",
inet_ntoa(bgp->router_id_static));
/* BGP log-neighbor-changes. */
if (!!bgp_flag_check (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)
!= DFLT_BGP_LOG_NEIGHBOR_CHANGES)
vty_out (vty, " %sbgp log-neighbor-changes%s",
bgp_flag_check (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES) ? "" : "no ",
VTY_NEWLINE);
vty_outln (vty, " %sbgp log-neighbor-changes",
bgp_flag_check(bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES) ? "" : "no ");
/* BGP configuration. */
if (bgp_flag_check (bgp, BGP_FLAG_ALWAYS_COMPARE_MED))
vty_out (vty, " bgp always-compare-med%s", VTY_NEWLINE);
vty_outln (vty, " bgp always-compare-med");
/* BGP default ipv4-unicast. */
if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4))
vty_out (vty, " no bgp default ipv4-unicast%s", VTY_NEWLINE);
vty_outln (vty, " no bgp default ipv4-unicast");
/* BGP default local-preference. */
if (bgp->default_local_pref != BGP_DEFAULT_LOCAL_PREF)
vty_out (vty, " bgp default local-preference %u%s",
bgp->default_local_pref, VTY_NEWLINE);
vty_outln (vty, " bgp default local-preference %u",
bgp->default_local_pref);
/* BGP default show-hostname */
if (!!bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)
!= DFLT_BGP_SHOW_HOSTNAME)
vty_out (vty, " %sbgp default show-hostname%s",
bgp_flag_check (bgp, BGP_FLAG_SHOW_HOSTNAME) ? "" : "no ",
VTY_NEWLINE);
vty_outln (vty, " %sbgp default show-hostname",
bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME) ? "" : "no ");
/* BGP default subgroup-pkt-queue-max. */
if (bgp->default_subgroup_pkt_queue_max != BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX)
vty_out (vty, " bgp default subgroup-pkt-queue-max %u%s",
bgp->default_subgroup_pkt_queue_max, VTY_NEWLINE);
vty_outln (vty, " bgp default subgroup-pkt-queue-max %u",
bgp->default_subgroup_pkt_queue_max);
/* BGP client-to-client reflection. */
if (bgp_flag_check (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
vty_out (vty, " no bgp client-to-client reflection%s", VTY_NEWLINE);
vty_outln (vty, " no bgp client-to-client reflection");
/* BGP cluster ID. */
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CLUSTER_ID))
vty_out (vty, " bgp cluster-id %s%s", inet_ntoa (bgp->cluster_id),
VTY_NEWLINE);
vty_outln (vty, " bgp cluster-id %s",inet_ntoa(bgp->cluster_id));
/* Disable ebgp connected nexthop check */
if (bgp_flag_check (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
vty_out (vty, " bgp disable-ebgp-connected-route-check%s", VTY_NEWLINE);
vty_outln (vty, " bgp disable-ebgp-connected-route-check");
/* Confederation identifier*/
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION))
vty_out (vty, " bgp confederation identifier %i%s", bgp->confed_id,
VTY_NEWLINE);
vty_outln (vty, " bgp confederation identifier %i",bgp->confed_id);
/* Confederation peer */
if (bgp->confed_peers_cnt > 0)
@ -7476,19 +7456,18 @@ bgp_config_write (struct vty *vty)
for (i = 0; i < bgp->confed_peers_cnt; i++)
vty_out(vty, " %u", bgp->confed_peers[i]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* BGP enforce-first-as. */
if (bgp_flag_check (bgp, BGP_FLAG_ENFORCE_FIRST_AS))
vty_out (vty, " bgp enforce-first-as%s", VTY_NEWLINE);
vty_outln (vty, " bgp enforce-first-as");
/* BGP deterministic-med. */
if (!!bgp_flag_check (bgp, BGP_FLAG_DETERMINISTIC_MED)
!= DFLT_BGP_DETERMINISTIC_MED)
vty_out (vty, " %sbgp deterministic-med%s",
bgp_flag_check (bgp, BGP_FLAG_DETERMINISTIC_MED) ? "" : "no ",
VTY_NEWLINE);
vty_outln (vty, " %sbgp deterministic-med",
bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED) ? "" : "no ");
/* BGP update-delay. */
bgp_config_write_update_delay (vty, bgp);
@ -7498,14 +7477,14 @@ bgp_config_write (struct vty *vty)
vty_out (vty, " bgp max-med on-startup %u", bgp->v_maxmed_onstartup);
if (bgp->maxmed_onstartup_value != BGP_MAXMED_VALUE_DEFAULT)
vty_out (vty, " %u", bgp->maxmed_onstartup_value);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (bgp->v_maxmed_admin != BGP_MAXMED_ADMIN_UNCONFIGURED)
{
vty_out (vty, " bgp max-med administrative");
if (bgp->maxmed_admin_value != BGP_MAXMED_VALUE_DEFAULT)
vty_out (vty, " %u", bgp->maxmed_admin_value);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* write quanta */
@ -7516,42 +7495,42 @@ bgp_config_write (struct vty *vty)
/* BGP graceful-restart. */
if (bgp->stalepath_time != BGP_DEFAULT_STALEPATH_TIME)
vty_out (vty, " bgp graceful-restart stalepath-time %u%s",
bgp->stalepath_time, VTY_NEWLINE);
vty_outln (vty, " bgp graceful-restart stalepath-time %u",
bgp->stalepath_time);
if (bgp->restart_time != BGP_DEFAULT_RESTART_TIME)
vty_out (vty, " bgp graceful-restart restart-time %u%s",
bgp->restart_time, VTY_NEWLINE);
vty_outln (vty, " bgp graceful-restart restart-time %u",
bgp->restart_time);
if (bgp_flag_check (bgp, BGP_FLAG_GRACEFUL_RESTART))
vty_out (vty, " bgp graceful-restart%s", VTY_NEWLINE);
vty_outln (vty, " bgp graceful-restart");
/* BGP graceful-restart Preserve State F bit. */
if (bgp_flag_check (bgp, BGP_FLAG_GR_PRESERVE_FWD))
vty_out (vty, " bgp graceful-restart preserve-fw-state%s", VTY_NEWLINE);
vty_outln (vty, " bgp graceful-restart preserve-fw-state");
/* BGP bestpath method. */
if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_IGNORE))
vty_out (vty, " bgp bestpath as-path ignore%s", VTY_NEWLINE);
vty_outln (vty, " bgp bestpath as-path ignore");
if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_CONFED))
vty_out (vty, " bgp bestpath as-path confed%s", VTY_NEWLINE);
vty_outln (vty, " bgp bestpath as-path confed");
if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX))
{
if (bgp_flag_check (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET))
{
vty_out (vty, " bgp bestpath as-path multipath-relax as-set%s", VTY_NEWLINE);
vty_outln (vty,
" bgp bestpath as-path multipath-relax as-set");
}
else
{
vty_out (vty, " bgp bestpath as-path multipath-relax%s", VTY_NEWLINE);
vty_outln (vty, " bgp bestpath as-path multipath-relax");
}
}
if (bgp_flag_check (bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) {
vty_out (vty, " bgp route-reflector allow-outbound-policy%s",
VTY_NEWLINE);
vty_outln (vty," bgp route-reflector allow-outbound-policy");
}
if (bgp_flag_check (bgp, BGP_FLAG_COMPARE_ROUTER_ID))
vty_out (vty, " bgp bestpath compare-routerid%s", VTY_NEWLINE);
vty_outln (vty, " bgp bestpath compare-routerid");
if (bgp_flag_check (bgp, BGP_FLAG_MED_CONFED)
|| bgp_flag_check (bgp, BGP_FLAG_MED_MISSING_AS_WORST))
{
@ -7560,15 +7539,14 @@ bgp_config_write (struct vty *vty)
vty_out (vty, " confed");
if (bgp_flag_check (bgp, BGP_FLAG_MED_MISSING_AS_WORST))
vty_out (vty, " missing-as-worst");
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/* BGP network import check. */
if (!!bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)
!= DFLT_BGP_IMPORT_CHECK)
vty_out (vty, " %sbgp network import-check%s",
bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) ? "" : "no ",
VTY_NEWLINE);
vty_outln (vty, " %sbgp network import-check",
bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK) ? "" : "no ");
/* BGP flag dampening. */
if (CHECK_FLAG (bgp->af_flags[AFI_IP][SAFI_UNICAST],
@ -7578,8 +7556,8 @@ bgp_config_write (struct vty *vty)
/* BGP timers configuration. */
if (bgp->default_keepalive != BGP_DEFAULT_KEEPALIVE
&& bgp->default_holdtime != BGP_DEFAULT_HOLDTIME)
vty_out (vty, " timers bgp %u %u%s", bgp->default_keepalive,
bgp->default_holdtime, VTY_NEWLINE);
vty_outln (vty, " timers bgp %u %u", bgp->default_keepalive,
bgp->default_holdtime);
/* peer-group */
for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
@ -7599,7 +7577,7 @@ bgp_config_write (struct vty *vty)
/* No auto-summary */
if (bgp_option_check (BGP_OPT_CONFIG_CISCO))
vty_out (vty, " no auto-summary%s", VTY_NEWLINE);
vty_outln (vty, " no auto-summary");
/* IPv4 unicast configuration. */
write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_UNICAST);

File diff suppressed because it is too large Load Diff

View File

@ -3101,12 +3101,12 @@ DEFUN (
if (!str2prefix (argv[5]->arg, &pfx))
{
vty_out (vty, "Malformed address \"%s\"%s", argv[5]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed address \"%s\"", argv[5]->arg);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
vty_out (vty, "Invalid address \"%s\"%s", argv[5]->arg, VTY_NEWLINE);
vty_outln (vty, "Invalid address \"%s\"", argv[5]->arg);
return CMD_WARNING;
}
@ -3144,7 +3144,7 @@ test_nexthops_callback (
fp (out, "Nexthops Callback, Target=(");
//rfapiPrintRfapiIpAddr(stream, target);
fp (out, ")%s", VTY_NEWLINE);
fp (out, ")%s", VTYNL);
rfapiPrintNhl (stream, next_hops);
@ -3185,12 +3185,12 @@ DEFUN (debug_rfapi_open,
rc = rfapi_open (rfapi_get_rfp_start_val_by_bgp (bgp_get_default ()),
&vn, &un, /*&uo */ NULL, &lifetime, NULL, &handle);
vty_out (vty, "rfapi_open: status %d, handle %p, lifetime %d%s",
rc, handle, lifetime, VTY_NEWLINE);
vty_outln (vty, "rfapi_open: status %d, handle %p, lifetime %d",
rc, handle, lifetime);
rc = rfapi_set_response_cb (handle, test_nexthops_callback);
vty_out (vty, "rfapi_set_response_cb: status %d%s", rc, VTY_NEWLINE);
vty_outln (vty, "rfapi_set_response_cb: status %d", rc);
return CMD_SUCCESS;
}
@ -3230,15 +3230,14 @@ DEFUN (debug_rfapi_close_vn_un,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[4]->arg, argv[6]->arg);
return CMD_WARNING;
}
rc = rfapi_close (handle);
vty_out (vty, "rfapi_close(handle=%p): status %d%s", handle, rc,
VTY_NEWLINE);
vty_outln (vty, "rfapi_close(handle=%p): status %d", handle,rc);
return CMD_SUCCESS;
}
@ -3259,14 +3258,13 @@ DEFUN (debug_rfapi_close_rfd,
if (*endptr != '\0' || (uintptr_t) handle == UINTPTR_MAX)
{
vty_out (vty, "Invalid value: %s%s", argv[4]->arg, VTY_NEWLINE);
vty_outln (vty, "Invalid value: %s", argv[4]->arg);
return CMD_WARNING;
}
rc = rfapi_close (handle);
vty_out (vty, "rfapi_close(handle=%p): status %d%s", handle, rc,
VTY_NEWLINE);
vty_outln (vty, "rfapi_close(handle=%p): status %d", handle,rc);
return CMD_SUCCESS;
}
@ -3313,8 +3311,8 @@ DEFUN (debug_rfapi_register_vn_un,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[4]->arg, argv[6]->arg);
return CMD_WARNING;
}
@ -3323,31 +3321,31 @@ DEFUN (debug_rfapi_register_vn_un,
*/
if (!str2prefix (argv[8]->arg, &pfx))
{
vty_out (vty, "Malformed prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed prefix \"%s\"", argv[8]->arg);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
vty_out (vty, "Bad family for prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
vty_outln (vty, "Bad family for prefix \"%s\"", argv[8]->arg);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &hpfx);
if (!strcmp (argv[10]->arg, "infinite"))
if (strmatch(argv[10]->text, "infinite"))
{
lifetime = RFAPI_INFINITE_LIFETIME;
}
else
{
VTY_GET_INTEGER ("Lifetime", lifetime, argv[10]->arg);
lifetime = strtoul(argv[10]->arg, NULL, 10);
}
rc = rfapi_register (handle, &hpfx, lifetime, NULL, NULL, 0);
if (rc)
{
vty_out (vty, "rfapi_register failed with rc=%d (%s)%s", rc,
strerror (rc), VTY_NEWLINE);
vty_outln (vty, "rfapi_register failed with rc=%d (%s)", rc,
strerror(rc));
}
return CMD_SUCCESS;
@ -3402,8 +3400,8 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[4]->arg, argv[6]->arg);
return CMD_WARNING;
}
@ -3412,32 +3410,31 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
*/
if (!str2prefix (argv[8]->arg, &pfx))
{
vty_out (vty, "Malformed prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed prefix \"%s\"", argv[8]->arg);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
vty_out (vty, "Bad family for prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
vty_outln (vty, "Bad family for prefix \"%s\"", argv[8]->arg);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &hpfx);
if (!strcmp (argv[10]->arg, "infinite"))
if (strmatch(argv[10]->text, "infinite"))
{
lifetime = RFAPI_INFINITE_LIFETIME;
}
else
{
VTY_GET_INTEGER ("Lifetime", lifetime, argv[10]->arg);
lifetime = strtoul(argv[10]->arg, NULL, 10);
}
/* L2 option parsing START */
memset (optary, 0, sizeof (optary));
VTY_GET_INTEGER ("Logical Network ID",
optary[opt_next].v.l2addr.logical_net_id, argv[14]->arg);
optary[opt_next].v.l2addr.logical_net_id = strtoul(argv[14]->arg, NULL, 10);
if ((rc = rfapiStr2EthAddr (argv[12]->arg, &optary[opt_next].v.l2addr.macaddr)))
{
vty_out (vty, "Bad mac address \"%s\"%s", argv[12]->arg, VTY_NEWLINE);
vty_outln (vty, "Bad mac address \"%s\"", argv[12]->arg);
return CMD_WARNING;
}
optary[opt_next].type = RFAPI_VN_OPTION_TYPE_L2ADDR;
@ -3456,8 +3453,8 @@ DEFUN (debug_rfapi_register_vn_un_l2o,
rc = rfapi_register (handle, &hpfx, lifetime, NULL /* &uo */ , opt, 0);
if (rc)
{
vty_out (vty, "rfapi_register failed with rc=%d (%s)%s", rc,
strerror (rc), VTY_NEWLINE);
vty_outln (vty, "rfapi_register failed with rc=%d (%s)", rc,
strerror(rc));
}
return CMD_SUCCESS;
@ -3499,8 +3496,8 @@ DEFUN (debug_rfapi_unregister_vn_un,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[4]->arg, argv[6]->arg);
return CMD_WARNING;
}
@ -3509,12 +3506,12 @@ DEFUN (debug_rfapi_unregister_vn_un,
*/
if (!str2prefix (argv[8]->arg, &pfx))
{
vty_out (vty, "Malformed prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
vty_outln (vty, "Malformed prefix \"%s\"", argv[8]->arg);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
vty_out (vty, "Bad family for prefix \"%s\"%s", argv[8]->arg, VTY_NEWLINE);
vty_outln (vty, "Bad family for prefix \"%s\"", argv[8]->arg);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &hpfx);
@ -3570,8 +3567,8 @@ DEFUN (debug_rfapi_query_vn_un,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[4]->arg, argv[6]->arg);
return CMD_WARNING;
}
@ -3582,8 +3579,8 @@ DEFUN (debug_rfapi_query_vn_un,
if (rc)
{
vty_out (vty, "rfapi_query failed with rc=%d (%s)%s", rc,
strerror (rc), VTY_NEWLINE);
vty_outln (vty, "rfapi_query failed with rc=%d (%s)", rc,
strerror(rc));
}
else
{
@ -3645,14 +3642,14 @@ DEFUN (debug_rfapi_query_vn_un_l2o,
if ((rc = rfapiCliGetRfapiIpAddr (vty, argv[2], &target)))
return rc;
#else
vty_out (vty, "%% This command is broken.%s", VTY_NEWLINE);
vty_outln (vty, "%% This command is broken.");
return CMD_WARNING;
#endif
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[4]->arg, argv[6]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[4]->arg, argv[6]->arg);
return CMD_WARNING;
}
@ -3662,11 +3659,11 @@ DEFUN (debug_rfapi_query_vn_un_l2o,
memset (&l2o_buf, 0, sizeof (l2o_buf));
if (rfapiStr2EthAddr (argv[10]->arg, &l2o_buf.macaddr))
{
vty_out (vty, "Bad mac address \"%s\"%s", argv[10]->arg, VTY_NEWLINE);
vty_outln (vty, "Bad mac address \"%s\"", argv[10]->arg);
return CMD_WARNING;
}
VTY_GET_INTEGER ("Logical Network ID", l2o_buf.logical_net_id, argv[8]->arg);
l2o_buf.logical_net_id = strtoul(argv[8]->arg, NULL, 10);
/* construct option chain */
@ -3691,8 +3688,8 @@ DEFUN (debug_rfapi_query_vn_un_l2o,
if (rc)
{
vty_out (vty, "rfapi_query failed with rc=%d (%s)%s", rc,
strerror (rc), VTY_NEWLINE);
vty_outln (vty, "rfapi_query failed with rc=%d (%s)", rc,
strerror(rc));
}
else
{
@ -3753,8 +3750,8 @@ DEFUN (debug_rfapi_query_done_vn_un,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[5]->arg, argv[7]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[5]->arg, argv[7]->arg);
return CMD_WARNING;
}
@ -3763,7 +3760,7 @@ DEFUN (debug_rfapi_query_done_vn_un,
*/
rc = rfapi_query_done (handle, &target);
vty_out (vty, "rfapi_query_done returned %d%s", rc, VTY_NEWLINE);
vty_outln (vty, "rfapi_query_done returned %d", rc);
return CMD_SUCCESS;
}
@ -3789,14 +3786,14 @@ DEFUN (debug_rfapi_show_import,
bgp = bgp_get_default (); /* assume 1 instance for now */
if (!bgp)
{
vty_out (vty, "No BGP instance%s", VTY_NEWLINE);
vty_outln (vty, "No BGP instance");
return CMD_WARNING;
}
h = bgp->rfapi;
if (!h)
{
vty_out (vty, "No RFAPI instance%s", VTY_NEWLINE);
vty_outln (vty, "No RFAPI instance");
return CMD_WARNING;
}
@ -3810,7 +3807,7 @@ DEFUN (debug_rfapi_show_import,
{
s = ecommunity_ecom2str (it->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
vty_out (vty, "Import Table %p, RTs: %s%s", it, s, VTY_NEWLINE);
vty_outln (vty, "Import Table %p, RTs: %s", it, s);
XFREE (MTYPE_ECOMMUNITY_STR, s);
rfapiShowImportTable (vty, "IP VPN", it->imported_vpn[AFI_IP], 1);
@ -3840,8 +3837,8 @@ DEFUN (debug_rfapi_show_import,
lni = lni_as_ptr;
if (first_l2)
{
vty_out (vty, "%sLNI-based Ethernet Tables:%s",
VTY_NEWLINE, VTY_NEWLINE);
vty_outln (vty, "%sLNI-based Ethernet Tables:",
VTYNL);
first_l2 = 0;
}
snprintf (buf, BUFSIZ, "L2VPN LNI=%u", lni);
@ -3892,8 +3889,8 @@ DEFUN (debug_rfapi_show_import_vn_un,
if (rfapi_find_handle_vty (vty, &vn, &un, &handle))
{
vty_out (vty, "can't locate handle matching vn=%s, un=%s%s",
argv[5]->arg, argv[7]->arg, VTY_NEWLINE);
vty_outln (vty, "can't locate handle matching vn=%s, un=%s",
argv[5]->arg, argv[7]->arg);
return CMD_WARNING;
}
@ -3923,16 +3920,16 @@ DEFUN (debug_rfapi_response_omit_self,
if (!bgp)
{
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
vty_outln (vty, "No BGP process is configured");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
vty_out (vty, "VNC not configured%s", VTY_NEWLINE);
vty_outln (vty, "VNC not configured");
return CMD_WARNING;
}
if (!strcmp (argv[3]->arg, "on"))
if (strmatch(argv[3]->text, "on"))
SET_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_FILTER_SELF_FROM_RSP);
else
UNSET_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_FILTER_SELF_FROM_RSP);
@ -4194,7 +4191,7 @@ rfapi_rfp_get_or_init_group_config_nve (
if (!rfg || !listnode_lookup (rfc->nve_groups_sequential, rfg))
{
/* Not in list anymore */
vty_out (vty, "Current NVE group no longer exists%s", VTY_NEWLINE);
vty_outln (vty, "Current NVE group no longer exists");
return NULL;
}
@ -4219,7 +4216,7 @@ rfapi_rfp_get_or_init_group_config_l2 (
if (!rfg || !listnode_lookup (rfc->l2_groups, rfg))
{
/* Not in list anymore */
vty_out (vty, "Current L2 group no longer exists%s", VTY_NEWLINE);
vty_outln (vty, "Current L2 group no longer exists");
return NULL;
}
if (rfg->rfp_cfg == NULL && size > 0)

View File

@ -2294,7 +2294,7 @@ rfapiRibShowResponsesSummary (void *stream)
fp (out, "%-24s ", "Responses: (Prefixes)");
fp (out, "%-8s %-8u ", "Active:", bgp->rfapi->rib_prefix_count_total);
fp (out, "%-8s %-8u", "Maximum:", bgp->rfapi->rib_prefix_count_total_max);
fp (out, "%s", VTY_NEWLINE);
fp (out, "%s", VTYNL);
fp (out, "%-24s ", " (Updated)");
fp (out, "%-8s %-8u ", "Update:",
@ -2304,7 +2304,7 @@ rfapiRibShowResponsesSummary (void *stream)
fp (out, "%-8s %-8u", "Total:",
bgp->rfapi->stat.count_updated_response_updates +
bgp->rfapi->stat.count_updated_response_deletes);
fp (out, "%s", VTY_NEWLINE);
fp (out, "%s", VTYNL);
fp (out, "%-24s ", " (NVEs)");
for (ALL_LIST_ELEMENTS_RO (&bgp->rfapi->descriptors, node, rfd))
@ -2315,7 +2315,7 @@ rfapiRibShowResponsesSummary (void *stream)
}
fp (out, "%-8s %-8u ", "Active:", nves_with_nonempty_ribs);
fp (out, "%-8s %-8u", "Total:", nves);
fp (out, "%s", VTY_NEWLINE);
fp (out, "%s", VTYNL);
}
@ -2388,7 +2388,7 @@ print_rib_sl (
fp (out, " %c %-20s %-15s %-15s %-4u %-8s %-8s%s%s",
deleted ? 'r' : ' ',
*printedprefix ? "" : str_pfx,
str_vn, str_un, ri->cost, str_lifetime, str_age, str_rd, VTY_NEWLINE);
str_vn, str_un, ri->cost, str_lifetime, str_age, str_rd, VTYNL);
if (!*printedprefix)
*printedprefix = 1;
@ -2501,10 +2501,10 @@ rfapiRibShowResponses (
++printedheader;
fp (out, "%s[%s]%s",
VTY_NEWLINE,
show_removed ? "Removed" : "Active", VTY_NEWLINE);
VTYNL,
show_removed ? "Removed" : "Active", VTYNL);
fp (out, "%-15s %-15s%s", "Querying VN", "Querying UN",
VTY_NEWLINE);
VTYNL);
fp (out, " %-20s %-15s %-15s %4s %-8s %-8s%s",
"Prefix", "Registered VN", "Registered UN", "Cost",
"Lifetime",
@ -2513,7 +2513,7 @@ rfapiRibShowResponses (
#else
"Remaining",
#endif
VTY_NEWLINE);
VTYNL);
}
if (!printednve)
{
@ -2526,11 +2526,11 @@ rfapiRibShowResponses (
fp (out, "%-15s %-15s%s",
rfapiRfapiIpAddr2Str (&rfd->vn_addr, str_vn, BUFSIZ),
rfapiRfapiIpAddr2Str (&rfd->un_addr, str_un, BUFSIZ),
VTY_NEWLINE);
VTYNL);
}
prefix2str (&rn->p, str_pfx, BUFSIZ);
//fp(out, " %s%s", buf, VTY_NEWLINE); /* prefix */
//fp(out, " %s%s", buf, VTYNL); /* prefix */
routes_displayed++;
nhs_displayed += print_rib_sl (fp, vty, out, sl,
@ -2542,12 +2542,12 @@ rfapiRibShowResponses (
if (routes_total)
{
fp (out, "%s", VTY_NEWLINE);
fp (out, "%s", VTYNL);
fp (out, "Displayed %u NVEs, and %u out of %u %s prefixes",
nves_displayed, routes_displayed,
routes_total, show_removed ? "removed" : "active");
if (nhs_displayed != routes_displayed || nhs_total != routes_total)
fp (out, " with %u out of %u next hops", nhs_displayed, nhs_total);
fp (out, "%s", VTY_NEWLINE);
fp (out, "%s", VTYNL);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -69,7 +69,7 @@ DEFUN (debug_bgp_vnc,
for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i)
{
if (!strcmp(argv[3]->arg, vncdebug[i].name))
if (strmatch(argv[3]->text, vncdebug[i].name))
{
if (vty->node == CONFIG_NODE)
{
@ -79,13 +79,13 @@ DEFUN (debug_bgp_vnc,
else
{
term_vnc_debug |= vncdebug[i].bit;
vty_out (vty, "BGP vnc %s debugging is on%s",
vncdebug[i].name, VTY_NEWLINE);
vty_outln (vty, "BGP vnc %s debugging is on",
vncdebug[i].name);
}
return CMD_SUCCESS;
}
}
vty_out (vty, "Unknown debug flag: %s%s", argv[3]->arg, VTY_NEWLINE);
vty_outln (vty, "Unknown debug flag: %s", argv[3]->arg);
return CMD_WARNING;
}
@ -104,11 +104,11 @@ DEFUN (no_debug_bgp_vnc,
{
size_t i;
if (!strcmp(argv[0]->arg, "no"))
if (strmatch(argv[0]->text, "no"))
argc--, argv++;
for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i)
{
if (!strcmp(argv[3]->arg, vncdebug[i].name))
if (strmatch(argv[3]->text, vncdebug[i].name))
{
if (vty->node == CONFIG_NODE)
{
@ -118,13 +118,13 @@ DEFUN (no_debug_bgp_vnc,
else
{
term_vnc_debug &= ~vncdebug[i].bit;
vty_out (vty, "BGP vnc %s debugging is off%s",
vncdebug[i].name, VTY_NEWLINE);
vty_outln (vty, "BGP vnc %s debugging is off",
vncdebug[i].name);
}
return CMD_SUCCESS;
}
}
vty_out (vty, "Unknown debug flag: %s%s", argv[3]->arg, VTY_NEWLINE);
vty_outln (vty, "Unknown debug flag: %s", argv[3]->arg);
return CMD_WARNING;
}
@ -144,7 +144,7 @@ DEFUN (no_debug_bgp_vnc_all,
VNC_STR)
{
term_vnc_debug = 0;
vty_out (vty, "All possible VNC debugging has been turned off%s", VTY_NEWLINE);
vty_outln (vty, "All possible VNC debugging has been turned off");
return CMD_SUCCESS;
}
@ -163,17 +163,17 @@ DEFUN (show_debugging_bgp_vnc,
{
size_t i;
vty_out (vty, "BGP VNC debugging status:%s", VTY_NEWLINE);
vty_outln (vty, "BGP VNC debugging status:");
for (i = 0; i < (sizeof(vncdebug) / sizeof(struct vnc_debug)); ++i)
{
if (term_vnc_debug & vncdebug[i].bit)
{
vty_out (vty, " BGP VNC %s debugging is on%s",
vncdebug[i].name, VTY_NEWLINE);
vty_outln (vty, " BGP VNC %s debugging is on",
vncdebug[i].name);
}
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return CMD_SUCCESS;
}
@ -187,7 +187,7 @@ bgp_vnc_config_write_debug (struct vty *vty)
{
if (conf_vnc_debug & vncdebug[i].bit)
{
vty_out (vty, "debug bgp vnc %s%s", vncdebug[i].name, VTY_NEWLINE);
vty_outln (vty, "debug bgp vnc %s", vncdebug[i].name);
write++;
}
}

View File

@ -49,7 +49,7 @@ DEFUN (rfp_example_config_value,
rfi = rfapi_get_rfp_start_val (VTY_GET_CONTEXT (bgp)); /* BGP_NODE */
assert (rfi != NULL);
VTY_GET_INTEGER ("Example value", value, argv[2]->arg);
value = strtoul(argv[2]->arg, NULL, 10);
if (rfi)
rfi->config_var = value;
return CMD_SUCCESS;
@ -197,7 +197,7 @@ rfp_cfg_write_cb (struct vty *vty, void *rfp_start_val)
if (rfi->config_var != 0)
{
vty_out (vty, " rfp example-config-value %u", rfi->config_var);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}

View File

@ -3,6 +3,17 @@
# tree.
#
AM_V_CLIPPY = $(am__v_CLIPPY_$(V))
am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY))
am__v_CLIPPY_0 = @echo " CLIPPY " $@;
am__v_CLIPPY_1 =
SUFFIXES = _clippy.c
.c_clippy.c:
$(AM_V_at)$(MAKE) -C $(top_builddir)/$(CLIPPYDIR) clippy
$(AM_V_CLIPPY)$(top_builddir)/$(CLIPPYDIR)/clippy $(top_srcdir)/python/clidef.py $< > $@.tmp
@{ test -f $@ && diff $@.tmp $@ >/dev/null 2>/dev/null; } && rm $@.tmp || mv $@.tmp $@
if HAVE_PROTOBUF
# Uncomment to use an non-system version of libprotobuf-c.

View File

@ -23,7 +23,36 @@ dnl Get hostname and other information.
dnl -----------------------------------
AC_CANONICAL_BUILD()
AC_CANONICAL_HOST()
AC_CANONICAL_TARGET()
AS_IF([test "$host" != "$build"], [
if test "$srcdir" = "."; then
AC_MSG_ERROR([cross-compilation is only possible with builddir separate from srcdir. create a separate directory and run as .../path-to-frr/configure.])
fi
test -d hosttools || mkdir hosttools
abssrc="`cd \"${srcdir}\"; pwd`"
AC_MSG_NOTICE([...])
AC_MSG_NOTICE([... cross-compilation: creating hosttools directory and self-configuring for build platform tools])
AC_MSG_NOTICE([... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if neccessary])
AC_MSG_NOTICE([...])
( CPPFLAGS="$HOST_CPPFLAGS"; \
CFLAGS="$HOST_CFLAGS"; \
LDFLAGS="$HOST_LDFLAGS"; \
cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build"; )
AC_MSG_NOTICE([...])
AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
AC_MSG_NOTICE([...])
build_clippy="false"
CLIPPYDIR="hosttools/lib"
], [
build_clippy="true"
CLIPPYDIR="lib"
])
AC_SUBST(CLIPPYDIR)
AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy])
# Disable portability warnings -- our automake code (in particular
# common.am) uses some constructs specific to gmake.
@ -123,6 +152,28 @@ AC_DEFUN([AC_C_FLAG], [{
AC_LANG_POP(C)
}])
AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{
AC_LANG_PUSH(C)
ac_cflags_save="$CFLAGS"
ac_libs_save="$LIBS"
CFLAGS="$CFLAGS $1"
LIBS="$LIBS $2"
AC_LINK_IFELSE(
[$3],
[
AC_MSG_RESULT([yes])
CFLAGS="$ac_cflags_save"
LIBS="$ac_libs_save"
$5
], [
AC_MSG_RESULT([no])
CFLAGS="$ac_cflags_save"
LIBS="$ac_libs_save"
$4
])
AC_LANG_POP(C)
}])
dnl ICC won't bail on unknown options without -diag-error 10006
dnl need to do this first so we get useful results for the other options
AC_C_FLAG([-diag-error 10006])
@ -409,6 +460,77 @@ if test "x${enable_dev_build}" = "xyes"; then
fi
AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
#
# Python for clippy
#
AS_IF([test "$host" = "$build"], [
PYTHONCONFIG=""
# ordering:
# 1. try python3, but respect the user's preference on which minor ver
# 2. try python, which might be py3 or py2 again on the user's preference
# 3. try python2 (can really only be 2.7 but eh)
# 4. try 3.5 > 3.4 > 3.3 > 3.2 > 2.7 through pkg-config (no user pref)
#
# (AX_PYTHON_DEVEL has no clue about py3 vs py2)
# (AX_PYTHON does not do what we need)
AC_CHECK_TOOLS([PYTHONCONFIG], [python3-config python-config python2-config])
if test -n "$PYTHONCONFIG"; then
PYTHON_CFLAGS="`\"${PYTHONCONFIG}\" --includes`"
PYTHON_LIBS="`\"${PYTHONCONFIG}\" --libs`"
AC_MSG_CHECKING([whether we found a working Python version])
AC_LINK_IFELSE_FLAGS([$PYTHON_CFLAGS], [$PYTHON_LIBS], [AC_LANG_PROGRAM([
#include <Python.h>
#if PY_VERSION_HEX < 0x02070000
#error python too old
#endif
int main(void);
],
[
{
Py_Initialize();
return 0;
}
])], [
PYTHONCONFIG=""
unset PYTHON_LIBS
unset PYTHON_CFLAGS
])
fi
if test -z "$PYTHONCONFIG"; then
PKG_CHECK_MODULES([PYTHON], python-3.5, [], [
PKG_CHECK_MODULES([PYTHON], python-3.4, [], [
PKG_CHECK_MODULES([PYTHON], python-3.3, [], [
PKG_CHECK_MODULES([PYTHON], python-3.2, [], [
PKG_CHECK_MODULES([PYTHON], python-2.7, [], [
AC_MSG_FAILURE([could not find python-config or pkg-config python, please install Python development files from libpython-dev or similar])
])])])])])
AC_MSG_CHECKING([whether we found a working Python version])
AC_LINK_IFELSE_FLAGS([$PYTHON_CFLAGS], [$PYTHON_LIBS], [AC_LANG_PROGRAM([
#include <Python.h>
#if PY_VERSION_HEX < 0x02070000
#error python too old
#endif
int main(void);
],
[
{
Py_Initialize();
return 0;
}
])], [
AC_MSG_FAILURE([could not find python-config or pkg-config python, please install Python development files from libpython-dev or similar])
])
fi
])
AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_LIBS)
#
# Logic for protobuf support.
#
@ -1422,7 +1544,9 @@ dnl ------------------
dnl check C-Ares library
dnl ------------------
if test "${NHRPD}" != ""; then
PKG_CHECK_MODULES([CARES], [libcares])
PKG_CHECK_MODULES([CARES], [libcares], , [
AC_MSG_ERROR([trying to build nhrpd, but libcares not found. install c-ares and its -dev headers.])
])
fi
@ -1437,15 +1561,14 @@ if test "${enable_snmp}" != ""; then
SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
AC_MSG_CHECKING([whether we can link to Net-SNMP])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
int main(void);
],
[
{
return 0;
}
])],[AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
])], [
AC_MSG_ERROR([--enable-snmp given but not usable])])
case "${enable_snmp}" in
yes)
@ -1852,6 +1975,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
redhat/Makefile
tools/Makefile
pkgsrc/Makefile
python/Makefile
fpm/Makefile
redhat/frr.spec
snapcraft/Makefile

2
debian/control vendored
View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Christian Hammers <ch@debian.org>
Uploaders: Florian Weimer <fw@debian.org>
Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev, dh-systemd, libsystemd-dev, python-ipaddr, bison, flex, libc-ares-dev
Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev, dh-systemd, libsystemd-dev, python-ipaddr, bison, flex, libc-ares-dev, python3-dev
Standards-Version: 3.9.6
Homepage: http://www.frr.net/
XS-Testsuite: autopkgtest

View File

@ -46,8 +46,7 @@ Install newer version of autoconf and automake (Package versions are too old)
sudo make install
cd ..
Install `Python 2.7` in parallel to default 2.6 (needed for `make check` to
run unittests).
Install `Python 2.7` in parallel to default 2.6
Make sure you've install EPEL (`epel-release` as above). Then install current
`python2.7` and `pytest`

View File

@ -107,6 +107,127 @@ Automatic assignment of variable names works by applying the following rules:
These rules should make it possible to avoid manual varname assignment in 90%
of the cases.
DEFPY
-----
`DEFPY(...)` is an enhanced version of `DEFUN()` which is preprocessed by
` python/clidef.py`. The python script parses the command definition string,
extracts variable names and types, and generates a C wrapper function that
parses the variables and passes them on. This means that in the CLI function
body, you will receive additional parameters with appropriate types.
This is best explained by an example:
```
DEFPY(func, func_cmd, "[no] foo bar A.B.C.D (0-99)$num", "...help...")
=>
func(self, vty, argc, argv, /* standard CLI arguments */
const char *no, /* unparsed "no" */
struct in_addr bar, /* parsed IP address */
const char *bar_str, /* unparsed IP address */
long num, /* parsed num */
const char *num_str) /* unparsed num */
```
Note that as documented in the previous section, "bar" is automatically
applied as variable name for "A.B.C.D". The python code then detects this
is an IP address argument and generates code to parse it into a
`struct in_addr`, passing it in `bar`. The raw value is passed in `bar_str`.
The range/number argument works in the same way with the explicitly given
variable name.
### Type rules
| Token(s) | Type | Value if omitted by user |
|--------------------------|-------------|--------------------------|
| `A.B.C.D` | `struct in_addr` | 0.0.0.0 |
| `X:X::X:X` | `struct in6_addr` | :: |
| `A.B.C.D + X:X::X:X` | `const union sockunion *` | NULL |
| `A.B.C.D/M` | `const struct prefix_ipv4 *` | NULL |
| `X:X::X:X/M` | `const struct prefix_ipv6 *` | NULL |
| `A.B.C.D/M + X:X::X:X/M` | `const struct prefix *` | NULL |
| `(0-9)` | `long` | 0 |
| `VARIABLE` | `const char *` | NULL |
| `word` | `const char *` | NULL |
| _all other_ | `const char *` | NULL |
Note the following details:
* not all parameters are pointers, some are passed as values.
* when the type is not `const char *`, there will be an extra `_str` argument
with type `const char *`.
* you can give a variable name not only to `VARIABLE` tokens but also to
`word` tokens (e.g. constant words). This is useful if some parts of a
command are optional. The type will be `const char *`.
* `[no]` will be passed as `const char *no`.
* pointers will be NULL when the argument is optional and the user did not
use it.
* if a parameter is not a pointer, but is optional and the user didn't use it,
the default value will be passed. Check the `_str` argument if you need to
determine whether the parameter was omitted.
* if the definition contains multiple parameters with the same variable name,
they will be collapsed into a single function parameter. The python code
will detect if the types are compatible (i.e. IPv4 + IPv6 variantes) and
choose a corresponding C type.
* the standard DEFUN parameters (self, vty, argc, argv) are still present and
can be used. A DEFUN can simply be **edited into a DEFPY without further
changes and it will still work**; this allows easy forward migration.
* a file may contain both DEFUN and DEFPY statements.
### Getting a parameter dump
The clidef.py script can be called to get a list of DEFUNs/DEFPYs with
the parameter name/type list:
```
lib/clippy python/clidef.py --all-defun --show lib/plist.c > /dev/null
```
The generated code is printed to stdout, the info dump to stderr. The
`--all-defun` argument will make it process DEFUN blocks as well as DEFPYs,
which is useful prior to converting some DEFUNs. **The dump does not list
the `_str` arguments** to keep the output shorter.
Note that the clidef.py script cannot be run with python directly, it needs
to be run with _clippy_ since the latter makes the CLI parser available.
### Include & Makefile requirements
A source file that uses DEFPY needs to include the `_clippy.c` file **before
all DEFPY statements**:
```
/* GPL header */
#include ...
...
#include "filename_clippy.c"
DEFPY(...)
DEFPY(...)
install_element(...)
```
This dependency needs to be marked in Makefile.am: (there is no ordering
requirement)
```
include ../common.am
# ...
# if linked into a LTLIBRARY (.la/.so):
filename.lo: filename_clippy.c
# if linked into an executable or static library (.a):
filename.o: filename_clippy.c
```
Doc Strings
-----------
Each token in a command definition should be documented with a brief doc

View File

@ -223,6 +223,7 @@ OSPF domain.
@deffnx {OSPF Command} {network @var{a.b.c.d/m} area @var{<0-4294967295>}} {}
@deffnx {OSPF Command} {no network @var{a.b.c.d/m} area @var{a.b.c.d}} {}
@deffnx {OSPF Command} {no network @var{a.b.c.d/m} area @var{<0-4294967295>}} {}
@anchor{OSPF network command}
This command specifies the OSPF enabled interface(s). If the interface has
an address from range 192.168.1.0/24 then the command below enables ospf
on this interface so router can provide network information to the other
@ -246,6 +247,10 @@ Currently, if a peer prefix has been configured,
then we test whether the prefix in the network command contains
the destination prefix. Otherwise, we test whether the network command prefix
contains the local address prefix of the interface.
In some cases it may be more convenient to enable OSPF on a per
interface/subnet basis (@pxref{OSPF ip ospf area command}).
@end deffn
@node OSPF area
@ -413,6 +418,19 @@ settings will override any per-area authentication setting.
@node OSPF interface
@section OSPF interface
@deffn {Interface Command} {ip ospf area @var{AREA} [@var{ADDR}]} {}
@deffnx {Interface Command} {no ip ospf area [@var{ADDR}]} {}
@anchor{OSPF ip ospf area command}
Enable OSPF on the interface, optionally restricted to just the IP address
given by @var{ADDR}, putting it in the @var{AREA} area. Per interface area
settings take precedence to network commands (@pxref{OSPF network command}).
If you have a lot of interfaces, and/or a lot of subnets, then enabling OSPF
via this command may result in a slight performance improvement.
@end deffn
@deffn {Interface Command} {ip ospf authentication-key @var{AUTH_KEY}} {}
@deffnx {Interface Command} {no ip ospf authentication-key} {}
Set OSPF authentication key to a simple password. After setting @var{AUTH_KEY},

View File

@ -84,9 +84,8 @@ config_write_debug (struct vty *vty)
if (conf_debug_eigrp_packet[i] == 0 && term_debug_eigrp_packet[i] == 0 )
continue;
vty_out (vty, "debug eigrp packet %s%s%s",
type_str[i], detail_str[conf_debug_eigrp_packet[i]],
VTY_NEWLINE);
vty_outln (vty, "debug eigrp packet %s%s",
type_str[i],detail_str[conf_debug_eigrp_packet[i]]);
write = 1;
}
@ -211,13 +210,13 @@ void
show_ip_eigrp_interface_header (struct vty *vty, struct eigrp *eigrp)
{
vty_out (vty, "%s%s%d%s%s%s %-10s %-10s %-10s %-6s %-12s %-7s %-14s %-12s %-8s %-8s %-8s%s %-39s %-12s %-7s %-14s %-12s %-8s%s",
VTY_NEWLINE,
"EIGRP interfaces for AS(",eigrp->AS,")",VTY_NEWLINE,VTY_NEWLINE,
vty_outln (vty, "%s%s%d%s%s%s %-10s %-10s %-10s %-6s %-12s %-7s %-14s %-12s %-8s %-8s %-8s%s %-39s %-12s %-7s %-14s %-12s %-8s",
VTYNL,
"EIGRP interfaces for AS(",eigrp->AS,")",VTYNL,VTYNL,
"Interface", "Bandwidth", "Delay", "Peers", "Xmit Queue", "Mean",
"Pacing Time", "Multicast", "Pending", "Hello", "Holdtime",
VTY_NEWLINE,"","Un/Reliable","SRTT","Un/Reliable","Flow Timer","Routes",
VTY_NEWLINE);
VTYNL,"","Un/Reliable","SRTT","Un/Reliable","Flow Timer",
"Routes");
}
void
@ -230,40 +229,40 @@ show_ip_eigrp_interface_sub (struct vty *vty, struct eigrp *eigrp,
vty_out (vty, "%-7u", ei->nbrs->count);
vty_out (vty, "%u %c %-10u",0,'/', eigrp_neighbor_packet_queue_sum (ei));
vty_out (vty, "%-7u %-14u %-12u %-8u", 0, 0, 0, 0);
vty_out (vty, "%-8u %-8u %s",
vty_outln (vty, "%-8u %-8u ",
IF_DEF_PARAMS (ei->ifp)->v_hello,
IF_DEF_PARAMS (ei->ifp)->v_wait,VTY_NEWLINE);
IF_DEF_PARAMS(ei->ifp)->v_wait);
}
void
show_ip_eigrp_interface_detail (struct vty *vty, struct eigrp *eigrp,
struct eigrp_interface *ei)
{
vty_out (vty, "%-2s %s %d %-3s %s","","Hello interval is ", 0, " sec", VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s","", "Next xmit serial","<none>", VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s %d %s %d %s",
vty_outln (vty, "%-2s %s %d %-3s ","","Hello interval is ", 0, " sec");
vty_outln (vty, "%-2s %s %s ","", "Next xmit serial","<none>");
vty_outln (vty, "%-2s %s %d %s %d %s %d %s %d ",
"", "Un/reliable mcasts: ", 0, "/", 0, "Un/reliable ucasts: ",
0, "/", 0, VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s %d %s",
0, "/", 0);
vty_outln (vty, "%-2s %s %d %s %d %s %d ",
"", "Mcast exceptions: ", 0, " CR packets: ",
0, " ACKs supressed: ", 0, VTY_NEWLINE);
vty_out (vty, "%-2s %s %d %s %d %s",
0, " ACKs supressed: ", 0);
vty_outln (vty, "%-2s %s %d %s %d ",
"", "Retransmissions sent: ", 0, "Out-of-sequence rcvd: ",
0 ,VTY_NEWLINE);
vty_out (vty, "%-2s %s %s %s %s",
"", "Authentication mode is ", "not","set", VTY_NEWLINE);
vty_out (vty, "%-2s %s %s", "", "Use multicast", VTY_NEWLINE);
0);
vty_outln (vty, "%-2s %s %s %s ",
"", "Authentication mode is ", "not","set");
vty_outln (vty, "%-2s %s ", "", "Use multicast");
}
void
show_ip_eigrp_neighbor_header (struct vty *vty, struct eigrp *eigrp)
{
vty_out (vty, "%s%s%d%s%s%s%-3s %-17s %-20s %-6s %-8s %-6s %-5s %-5s %-5s%s %-41s %-6s %-8s %-6s %-4s %-6s %-5s %s",
VTY_NEWLINE,
"EIGRP neighbors for AS(",eigrp->AS,")",VTY_NEWLINE,VTY_NEWLINE,
vty_outln (vty, "%s%s%d%s%s%s%-3s %-17s %-20s %-6s %-8s %-6s %-5s %-5s %-5s%s %-41s %-6s %-8s %-6s %-4s %-6s %-5s ",
VTYNL,
"EIGRP neighbors for AS(",eigrp->AS,")",VTYNL,VTYNL,
"H", "Address", "Interface", "Hold", "Uptime",
"SRTT", "RTO", "Q", "Seq", VTY_NEWLINE
,"","(sec)","","(ms)","","Cnt","Num", VTY_NEWLINE);
"SRTT", "RTO", "Q", "Seq", VTYNL
,"","(sec)","","(ms)","","Cnt","Num");
}
void
@ -276,7 +275,7 @@ show_ip_eigrp_neighbor_sub (struct vty *vty, struct eigrp_neighbor *nbr,
vty_out (vty,"%-7lu", thread_timer_remain_second (nbr->t_holddown));
vty_out (vty,"%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME);
vty_out (vty,"%-7lu", nbr->retrans_queue->count);
vty_out (vty,"%u%s", nbr->recv_sequence_number, VTY_NEWLINE);
vty_outln (vty,"%u", nbr->recv_sequence_number);
if (detail)
@ -286,7 +285,7 @@ show_ip_eigrp_neighbor_sub (struct vty *vty, struct eigrp_neighbor *nbr,
nbr->tlv_rel_major, nbr->tlv_rel_minor);
vty_out(vty,", Retrans: %lu, Retries: %lu",
nbr->retrans_queue->count, 0UL);
vty_out(vty,", %s%s", eigrp_nbr_state_str(nbr), VTY_NEWLINE);
vty_outln (vty,", %s", eigrp_nbr_state_str(nbr));
}
}
@ -299,11 +298,11 @@ show_ip_eigrp_topology_header (struct vty *vty, struct eigrp *eigrp)
struct in_addr router_id;
router_id.s_addr = eigrp->router_id;
vty_out (vty, "%sEIGRP Topology Table for AS(%d)/ID(%s)%s%s",
VTY_NEWLINE, eigrp->AS, inet_ntoa(router_id), VTY_NEWLINE, VTY_NEWLINE);
vty_out (vty, "Codes: P - Passive, A - Active, U - Update, Q - Query, "
"R - Reply%s r - reply Status, s - sia Status%s%s",
VTY_NEWLINE, VTY_NEWLINE,VTY_NEWLINE);
vty_outln (vty, "%sEIGRP Topology Table for AS(%d)/ID(%s)%s",
VTYNL, eigrp->AS, inet_ntoa(router_id), VTYNL);
vty_outln (vty, "Codes: P - Passive, A - Active, U - Update, Q - Query, "
"R - Reply%s r - reply Status, s - sia Status%s",
VTYNL, VTYNL);
}
void
@ -316,7 +315,7 @@ show_ip_eigrp_prefix_entry (struct vty *vty, struct eigrp_prefix_entry *tn)
vty_out (vty, "%s/%u, ",
inet_ntoa (tn->destination_ipv4->prefix), tn->destination_ipv4->prefixlen);
vty_out (vty, "%u successors, ", successors->count);
vty_out (vty, "FD is %u, serno: %" PRIu64 " %s", tn->fdistance, tn->serno, VTY_NEWLINE);
vty_outln (vty, "FD is %u, serno: %" PRIu64 " ", tn->fdistance, tn->serno);
list_delete(successors);
}
@ -335,15 +334,15 @@ show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp,
}
if (te->adv_router == eigrp->neighbor_self)
vty_out (vty, "%-7s%s, %s%s", " ", "via Connected",
eigrp_if_name_string (te->ei), VTY_NEWLINE);
else
{
vty_out (vty, "%-7s%s%s (%u/%u), %s%s",
" ", "via ", inet_ntoa (te->adv_router->src),
te->distance, te->reported_distance,
eigrp_if_name_string (te->ei), VTY_NEWLINE);
}
vty_outln (vty, "%-7s%s, %s", " ", "via Connected",
eigrp_if_name_string(te->ei));
else
{
vty_outln (vty, "%-7s%s%s (%u/%u), %s",
" ", "via ", inet_ntoa (te->adv_router->src),
te->distance, te->reported_distance,
eigrp_if_name_string(te->ei));
}
}
@ -356,11 +355,11 @@ DEFUN (show_debugging_eigrp,
{
int i;
vty_out (vty, "EIGRP debugging status:%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP debugging status:");
/* Show debug status for events. */
if (IS_DEBUG_EIGRP(event,EVENT))
vty_out (vty, " EIGRP event debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP event debugging is on");
/* Show debug status for EIGRP Packets. */
for (i = 0; i < 11 ; i++)
@ -370,23 +369,20 @@ DEFUN (show_debugging_eigrp,
if (IS_DEBUG_EIGRP_PACKET (i, SEND) && IS_DEBUG_EIGRP_PACKET (i, RECV))
{
vty_out (vty, " EIGRP packet %s%s debugging is on%s",
lookup_msg(eigrp_packet_type_str, i + 1, NULL),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
VTY_NEWLINE);
vty_outln (vty, " EIGRP packet %s%s debugging is on",
lookup_msg(eigrp_packet_type_str, i + 1, NULL),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "");
}
else
{
if (IS_DEBUG_EIGRP_PACKET (i, SEND))
vty_out (vty, " EIGRP packet %s send%s debugging is on%s",
lookup_msg(eigrp_packet_type_str, i + 1, NULL),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
VTY_NEWLINE);
vty_outln (vty, " EIGRP packet %s send%s debugging is on",
lookup_msg(eigrp_packet_type_str, i + 1, NULL),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "");
if (IS_DEBUG_EIGRP_PACKET (i, RECV))
vty_out (vty, " EIGRP packet %s receive%s debugging is on%s",
lookup_msg(eigrp_packet_type_str, i + 1, NULL),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "",
VTY_NEWLINE);
vty_outln (vty, " EIGRP packet %s receive%s debugging is on",
lookup_msg(eigrp_packet_type_str, i + 1, NULL),
IS_DEBUG_EIGRP_PACKET (i, PACKET_DETAIL) ? " detail" : "");
}
}

View File

@ -366,10 +366,9 @@ void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty)
if(vty != NULL)
{
vty_time_print (vty, 0);
vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
vty_outln (vty, "Neighbor %s (%s) is down: manually cleared",
inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
VTY_NEWLINE);
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
}
/* send Hello with Peer Termination TLV */

View File

@ -262,7 +262,7 @@ static int
eigrp_network_match_iface(const struct connected *co, const struct prefix *net)
{
/* new approach: more elegant and conceptually clean */
return prefix_match(net, CONNECTED_PREFIX (co));
return prefix_match_network_statement(net, CONNECTED_PREFIX (co));
}
static void

View File

@ -154,10 +154,10 @@ eigrp_route_match_add (struct vty *vty, struct route_map_index *index,
switch (ret)
{
case RMAP_RULE_MISSING:
vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
vty_outln (vty, "%% Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
vty_outln (vty, "%% Argument is malformed.");
return CMD_WARNING;
}
}
@ -176,10 +176,10 @@ eigrp_route_match_delete (struct vty *vty, struct route_map_index *index,
switch (ret)
{
case RMAP_RULE_MISSING:
vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
vty_outln (vty, "%% Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
vty_outln (vty, "%% Argument is malformed.");
return CMD_WARNING;
}
}
@ -199,7 +199,7 @@ eigrp_route_set_add (struct vty *vty, struct route_map_index *index,
switch (ret)
{
case RMAP_RULE_MISSING:
vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
vty_outln (vty, "%% Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
/* rip, ripng and other protocols share the set metric command
@ -207,7 +207,7 @@ eigrp_route_set_add (struct vty *vty, struct route_map_index *index,
if metric is out of range for rip and ripng, it is not for
other protocols. Do not return an error */
if (strcmp(command, "metric")) {
vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
vty_outln (vty, "%% Argument is malformed.");
return CMD_WARNING;
}
}
@ -228,10 +228,10 @@ eigrp_route_set_delete (struct vty *vty, struct route_map_index *index,
switch (ret)
{
case RMAP_RULE_MISSING:
vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
vty_outln (vty, "%% Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
vty_outln (vty, "%% Argument is malformed.");
return CMD_WARNING;
}
}
@ -1124,7 +1124,7 @@ DEFUN (set_ip_nexthop,
ret = str2sockunion (argv[0], &su);
if (ret < 0)
{
vty_out (vty, "%% Malformed next-hop address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed next-hop address");
return CMD_WARNING;
}

View File

@ -1047,10 +1047,9 @@ eigrp_update_send_GR (struct eigrp_neighbor *nbr, enum GR_type gr_type, struct v
if(vty != NULL)
{
vty_time_print (vty, 0);
vty_out (vty, "Neighbor %s (%s) is resync: manually cleared%s",
vty_outln (vty, "Neighbor %s (%s) is resync: manually cleared",
inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
VTY_NEWLINE);
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
}
}

View File

@ -65,18 +65,18 @@ config_write_network (struct vty *vty, struct eigrp *eigrp)
if (rn->info)
{
/* Network print. */
vty_out (vty, " network %s/%d %s",
inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, VTY_NEWLINE);
vty_outln (vty, " network %s/%d ",
inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
}
if (eigrp->max_paths != EIGRP_MAX_PATHS_DEFAULT)
vty_out (vty, " maximum-paths %d%s", eigrp->max_paths, VTY_NEWLINE);
vty_outln (vty, " maximum-paths %d", eigrp->max_paths);
if (eigrp->variance != EIGRP_VARIANCE_DEFAULT)
vty_out (vty, " variance %d%s", eigrp->variance, VTY_NEWLINE);
vty_outln (vty, " variance %d", eigrp->variance);
/*Separate EIGRP configuration from the rest of the config*/
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
return 0;
}
@ -89,35 +89,39 @@ config_write_interfaces (struct vty *vty, struct eigrp *eigrp)
for (ALL_LIST_ELEMENTS_RO (eigrp->eiflist, node, ei))
{
vty_out (vty, "interface %s%s", ei->ifp->name, VTY_NEWLINE);
vty_outln (vty, "interface %s", ei->ifp->name);
if ((IF_DEF_PARAMS (ei->ifp)->auth_type) == EIGRP_AUTH_TYPE_MD5)
{
vty_out (vty, " ip authentication mode eigrp %d md5%s", eigrp->AS, VTY_NEWLINE);
vty_outln (vty, " ip authentication mode eigrp %d md5", eigrp->AS);
}
if ((IF_DEF_PARAMS (ei->ifp)->auth_type) == EIGRP_AUTH_TYPE_SHA256)
{
vty_out (vty, " ip authentication mode eigrp %d hmac-sha-256%s", eigrp->AS, VTY_NEWLINE);
vty_outln (vty, " ip authentication mode eigrp %d hmac-sha-256",
eigrp->AS);
}
if(IF_DEF_PARAMS (ei->ifp)->auth_keychain)
{
vty_out (vty, " ip authentication key-chain eigrp %d %s%s",eigrp->AS,IF_DEF_PARAMS (ei->ifp)->auth_keychain, VTY_NEWLINE);
vty_outln (vty, " ip authentication key-chain eigrp %d %s",eigrp->AS,
IF_DEF_PARAMS(ei->ifp)->auth_keychain);
}
if ((IF_DEF_PARAMS (ei->ifp)->v_hello) != EIGRP_HELLO_INTERVAL_DEFAULT)
{
vty_out (vty, " ip hello-interval eigrp %d%s", IF_DEF_PARAMS (ei->ifp)->v_hello, VTY_NEWLINE);
vty_outln (vty, " ip hello-interval eigrp %d",
IF_DEF_PARAMS(ei->ifp)->v_hello);
}
if ((IF_DEF_PARAMS (ei->ifp)->v_wait) != EIGRP_HOLD_INTERVAL_DEFAULT)
{
vty_out (vty, " ip hold-time eigrp %d%s", IF_DEF_PARAMS (ei->ifp)->v_wait, VTY_NEWLINE);
vty_outln (vty, " ip hold-time eigrp %d",
IF_DEF_PARAMS(ei->ifp)->v_wait);
}
/*Separate this EIGRP interface configuration from the others*/
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
}
return 0;
@ -130,26 +134,23 @@ eigrp_write_interface (struct vty *vty)
struct interface *ifp;
for (ALL_LIST_ELEMENTS_RO (vrf_iflist(VRF_DEFAULT), node, ifp)) {
vty_out (vty, "interface %s%s", ifp->name,
VTY_NEWLINE);
vty_outln (vty, "interface %s",ifp->name);
if (ifp->desc)
vty_out (vty, " description %s%s", ifp->desc,
VTY_NEWLINE);
vty_outln (vty, " description %s",ifp->desc);
if (IF_DEF_PARAMS (ifp)->bandwidth != EIGRP_BANDWIDTH_DEFAULT)
vty_out (vty, " bandwidth %u%s", IF_DEF_PARAMS (ifp)->bandwidth,
VTY_NEWLINE);
vty_outln (vty, " bandwidth %u",IF_DEF_PARAMS(ifp)->bandwidth);
if (IF_DEF_PARAMS (ifp)->delay != EIGRP_DELAY_DEFAULT)
vty_out (vty, " delay %u%s", IF_DEF_PARAMS (ifp)->delay, VTY_NEWLINE);
vty_outln (vty, " delay %u", IF_DEF_PARAMS(ifp)->delay);
if (IF_DEF_PARAMS (ifp)->v_hello != EIGRP_HELLO_INTERVAL_DEFAULT)
vty_out (vty, " ip hello-interval eigrp %u%s",
IF_DEF_PARAMS (ifp)->v_hello, VTY_NEWLINE);
vty_outln (vty, " ip hello-interval eigrp %u",
IF_DEF_PARAMS(ifp)->v_hello);
if (IF_DEF_PARAMS (ifp)->v_wait != EIGRP_HOLD_INTERVAL_DEFAULT)
vty_out (vty, " ip hold-time eigrp %u%s",
IF_DEF_PARAMS (ifp)->v_wait, VTY_NEWLINE);
vty_outln (vty, " ip hold-time eigrp %u",
IF_DEF_PARAMS(ifp)->v_wait);
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
}
return 0;
@ -178,7 +179,7 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
int write=0;
/* `router eigrp' print. */
vty_out (vty, "router eigrp %d%s", eigrp->AS, VTY_NEWLINE);
vty_outln (vty, "router eigrp %d", eigrp->AS);
write++;
@ -190,8 +191,8 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
{
struct in_addr router_id_static;
router_id_static.s_addr = htonl(eigrp->router_id_static);
vty_out (vty, " eigrp router-id %s%s",
inet_ntoa (router_id_static), VTY_NEWLINE);
vty_outln (vty, " eigrp router-id %s",
inet_ntoa(router_id_static));
}
/* Network area print. */
@ -201,7 +202,7 @@ config_write_eigrp_router (struct vty *vty, struct eigrp *eigrp)
config_write_eigrp_distribute (vty, eigrp);
/*Separate EIGRP configuration from the rest of the config*/
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
return write;
}
@ -234,8 +235,7 @@ DEFUN (no_router_eigrp,
eigrp = eigrp_lookup ();
if (eigrp->AS != atoi (argv[3]->arg))
{
vty_out (vty, "%% Attempting to deconfigure non-existent AS%s",
VTY_NEWLINE);
vty_outln (vty,"%% Attempting to deconfigure non-existent AS");
return CMD_WARNING;
}
@ -387,13 +387,13 @@ DEFUN (eigrp_network,
struct prefix_ipv4 p;
int ret;
VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg);
str2prefix_ipv4(argv[1]->arg, &p);
ret = eigrp_network_set (eigrp, &p);
if (ret == 0)
{
vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
vty_outln (vty, "There is already same network statement.");
return CMD_WARNING;
}
@ -411,13 +411,13 @@ DEFUN (no_eigrp_network,
struct prefix_ipv4 p;
int ret;
VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg);
str2prefix_ipv4(argv[2]->arg, &p);
ret = eigrp_network_unset (eigrp, &p);
if (ret == 0)
{
vty_out (vty,"Can't find specified network configuration.%s", VTY_NEWLINE);
vty_outln (vty,"Can't find specified network configuration.");
return CMD_WARNING;
}
@ -465,7 +465,7 @@ DEFUN (show_ip_eigrp_topology,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -521,7 +521,7 @@ DEFUN (show_ip_eigrp_interfaces,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -568,7 +568,7 @@ DEFUN (show_ip_eigrp_neighbors,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -607,7 +607,7 @@ DEFUN (eigrp_if_delay,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -633,7 +633,7 @@ DEFUN (no_eigrp_if_delay,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -658,7 +658,7 @@ DEFUN (eigrp_if_bandwidth,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -684,7 +684,7 @@ DEFUN (no_eigrp_if_bandwidth,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -709,7 +709,7 @@ DEFUN (eigrp_if_ip_hellointerval,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -737,7 +737,7 @@ DEFUN (no_eigrp_if_ip_hellointerval,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -771,7 +771,7 @@ DEFUN (eigrp_if_ip_holdinterval,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -798,7 +798,7 @@ DEFUN (eigrp_ip_summary_address,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -826,7 +826,7 @@ DEFUN (no_eigrp_ip_summary_address,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -852,7 +852,7 @@ DEFUN (no_eigrp_if_ip_holdinterval,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -899,7 +899,7 @@ DEFUN (eigrp_authentication_mode,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -929,7 +929,7 @@ DEFUN (no_eigrp_authentication_mode,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -955,7 +955,7 @@ DEFUN (eigrp_authentication_keychain,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -971,7 +971,7 @@ DEFUN (eigrp_authentication_keychain,
IF_DEF_PARAMS (ifp)->auth_keychain = strdup(keychain->name);
}
else
vty_out(vty,"Key chain with specified name not found%s", VTY_NEWLINE);
vty_outln (vty,"Key chain with specified name not found");
return CMD_SUCCESS;
}
@ -993,7 +993,7 @@ DEFUN (no_eigrp_authentication_keychain,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1004,7 +1004,8 @@ DEFUN (no_eigrp_authentication_keychain,
IF_DEF_PARAMS (ifp)->auth_keychain = NULL;
}
else
vty_out(vty,"Key chain with specified name not configured on interface%s", VTY_NEWLINE);
vty_outln (vty,
"Key chain with specified name not configured on interface");
return CMD_SUCCESS;
}
@ -1079,7 +1080,7 @@ DEFUN (eigrp_variance,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
variance = atoi(argv[1]->arg);
@ -1102,7 +1103,7 @@ DEFUN (no_eigrp_variance,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1125,7 +1126,7 @@ DEFUN (eigrp_maximum_paths,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1150,7 +1151,7 @@ DEFUN (no_eigrp_maximum_paths,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, "EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1181,7 +1182,7 @@ DEFUN (clear_ip_eigrp_neighbors,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1200,10 +1201,9 @@ DEFUN (clear_ip_eigrp_neighbors,
inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
vty_time_print (vty, 0);
vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
vty_outln (vty, "Neighbor %s (%s) is down: manually cleared",
inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
VTY_NEWLINE);
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
/* set neighbor to DOWN */
nbr->state = EIGRP_NEIGHBOR_DOWN;
@ -1238,7 +1238,7 @@ DEFUN (clear_ip_eigrp_neighbors_int,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1247,7 +1247,7 @@ DEFUN (clear_ip_eigrp_neighbors_int,
ei = eigrp_if_lookup_by_name(eigrp, argv[idx]->arg);
if(ei == NULL)
{
vty_out (vty, " Interface (%s) doesn't exist%s", argv[idx]->arg, VTY_NEWLINE);
vty_outln (vty, " Interface (%s) doesn't exist", argv[idx]->arg);
return CMD_WARNING;
}
@ -1263,10 +1263,9 @@ DEFUN (clear_ip_eigrp_neighbors_int,
inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT));
vty_time_print (vty, 0);
vty_out (vty, "Neighbor %s (%s) is down: manually cleared%s",
vty_outln (vty, "Neighbor %s (%s) is down: manually cleared",
inet_ntoa (nbr->src),
ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT),
VTY_NEWLINE);
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT));
/* set neighbor to DOWN */
nbr->state = EIGRP_NEIGHBOR_DOWN;
@ -1294,13 +1293,13 @@ DEFUN (clear_ip_eigrp_neighbors_IP,
struct eigrp_neighbor *nbr;
struct in_addr nbr_addr;
VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[4]->arg);
inet_aton(argv[4]->arg, &nbr_addr);
/* Check if eigrp process is enabled */
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1310,7 +1309,7 @@ DEFUN (clear_ip_eigrp_neighbors_IP,
/* if neighbor doesn't exists, notify user and exit */
if(nbr == NULL)
{
vty_out (vty, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE);
vty_outln (vty, "Neighbor with entered address doesn't exists.");
return CMD_WARNING;
}
@ -1338,7 +1337,7 @@ DEFUN (clear_ip_eigrp_neighbors_soft,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1368,7 +1367,7 @@ DEFUN (clear_ip_eigrp_neighbors_int_soft,
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1376,7 +1375,7 @@ DEFUN (clear_ip_eigrp_neighbors_int_soft,
ei = eigrp_if_lookup_by_name(eigrp, argv[4]->arg);
if(ei == NULL)
{
vty_out (vty, " Interface (%s) doesn't exist%s", argv[4]->arg, VTY_NEWLINE);
vty_outln (vty, " Interface (%s) doesn't exist", argv[4]->arg);
return CMD_WARNING;
}
@ -1402,13 +1401,13 @@ DEFUN (clear_ip_eigrp_neighbors_IP_soft,
struct eigrp_neighbor *nbr;
struct in_addr nbr_addr;
VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[4]->arg);
inet_aton(argv[4]->arg, &nbr_addr);
/* Check if eigrp process is enabled */
eigrp = eigrp_lookup ();
if (eigrp == NULL)
{
vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, " EIGRP Routing Process not enabled");
return CMD_SUCCESS;
}
@ -1418,7 +1417,7 @@ DEFUN (clear_ip_eigrp_neighbors_IP_soft,
/* if neighbor doesn't exists, notify user and exit */
if(nbr == NULL)
{
vty_out (vty, "Neighbor with entered address doesn't exists.%s", VTY_NEWLINE);
vty_outln (vty, "Neighbor with entered address doesn't exists.");
return CMD_WARNING;
}

View File

@ -267,8 +267,10 @@ eigrp_finish (struct eigrp *eigrp)
&& (listcount(eigrp_om->eigrp) == 0))
{
if (zclient)
zclient_free (zclient);
{
zclient_stop (zclient);
zclient_free (zclient);
}
exit(0);
}

View File

@ -402,13 +402,13 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail)
else
vty_out (vty, "- ");
vty_out (vty, "%-10s", snpa_print (adj->snpa));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (detail == ISIS_UI_LEVEL_DETAIL)
{
level = adj->level;
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
if (adj->circuit)
vty_out (vty, " Interface: %s", adj->circuit->interface->name);
else
@ -421,18 +421,18 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail)
time2string (adj->last_upd + adj->hold_time - now));
else
vty_out (vty, ", Expires in %s", time2string (adj->hold_time));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " Adjacency flaps: %u", adj->flaps);
vty_out (vty, ", Last: %s ago", time2string (now - adj->last_flap));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " Circuit type: %s", circuit_t2string (adj->circuit_t));
vty_out (vty, ", Speaks: %s", nlpid2string (&adj->nlpids));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
if (adj->mt_count != 1 || adj->mt_set[0] != ISIS_MT_IPV4_UNICAST)
{
vty_out (vty, " Topologies:%s", VTY_NEWLINE);
vty_outln (vty, " Topologies:");
for (unsigned int i = 0; i < adj->mt_count; i++)
vty_out (vty, " %s%s", isis_mtid2str(adj->mt_set[i]), VTY_NEWLINE);
vty_outln (vty, " %s", isis_mtid2str(adj->mt_set[i]));
}
vty_out (vty, " SNPA: %s", snpa_print (adj->snpa));
if (adj->circuit && (adj->circuit->circ_type == CIRCUIT_T_BROADCAST))
@ -445,7 +445,7 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail)
vty_out (vty, ", LAN id: %s.%02x",
sysid_print (adj->lanid), adj->lanid[ISIS_SYS_ID_LEN]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " LAN Priority: %u", adj->prio[adj->level - 1]);
vty_out (vty, ", %s, DIS flaps: %u, Last: %s ago",
@ -455,32 +455,32 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail)
(adj->dis_record[ISIS_LEVELS + level - 1].
last_dis_change)));
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
if (adj->area_addrs && listcount (adj->area_addrs) > 0)
{
struct area_addr *area_addr;
vty_out (vty, " Area Address(es):%s", VTY_NEWLINE);
vty_outln (vty, " Area Address(es):");
for (ALL_LIST_ELEMENTS_RO (adj->area_addrs, node, area_addr))
vty_out (vty, " %s%s", isonet_print (area_addr->area_addr,
area_addr->addr_len), VTY_NEWLINE);
vty_outln (vty, " %s",
isonet_print(area_addr->area_addr, area_addr->addr_len));
}
if (adj->ipv4_addrs && listcount (adj->ipv4_addrs) > 0)
{
vty_out (vty, " IPv4 Address(es):%s", VTY_NEWLINE);
vty_outln (vty, " IPv4 Address(es):");
for (ALL_LIST_ELEMENTS_RO (adj->ipv4_addrs, node, ip_addr))
vty_out (vty, " %s%s", inet_ntoa (*ip_addr), VTY_NEWLINE);
vty_outln (vty, " %s", inet_ntoa(*ip_addr));
}
if (adj->ipv6_addrs && listcount (adj->ipv6_addrs) > 0)
{
vty_out (vty, " IPv6 Address(es):%s", VTY_NEWLINE);
vty_outln (vty, " IPv6 Address(es):");
for (ALL_LIST_ELEMENTS_RO (adj->ipv6_addrs, node, ipv6_addr))
{
inet_ntop (AF_INET6, ipv6_addr, (char *)ip6, INET6_ADDRSTRLEN);
vty_out (vty, " %s%s", ip6, VTY_NEWLINE);
vty_outln (vty, " %s", ip6);
}
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
return;
}

View File

@ -878,7 +878,7 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
vty_out (vty, "%-9s", circuit_state2string (circuit->state));
vty_out (vty, "%-9s", circuit_type2string (circuit->circ_type));
vty_out (vty, "%-9s", circuit_t2string (circuit->is_type));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (detail == ISIS_UI_LEVEL_DETAIL)
@ -894,15 +894,15 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
else
vty_out (vty, ", Active");
vty_out (vty, ", Circuit Id: 0x%x", circuit->circuit_id);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " Type: %s", circuit_type2string (circuit->circ_type));
vty_out (vty, ", Level: %s", circuit_t2string (circuit->is_type));
if (circuit->circ_type == CIRCUIT_T_BROADCAST)
vty_out (vty, ", SNPA: %-10s", snpa_print (circuit->u.bc.snpa));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
if (circuit->is_type & IS_LEVEL_1)
{
vty_out (vty, " Level-1 Information:%s", VTY_NEWLINE);
vty_outln (vty, " Level-1 Information:");
if (circuit->area->newmetric)
vty_out (vty, " Metric: %d", circuit->te_metric[0]);
else
@ -910,32 +910,30 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
circuit->metric[0]);
if (!circuit->is_passive)
{
vty_out (vty, ", Active neighbors: %u%s",
circuit->upadjcount[0], VTY_NEWLINE);
vty_out (vty, " Hello interval: %u, "
"Holddown count: %u %s%s",
vty_outln (vty, ", Active neighbors: %u",
circuit->upadjcount[0]);
vty_outln (vty, " Hello interval: %u, "
"Holddown count: %u %s",
circuit->hello_interval[0],
circuit->hello_multiplier[0],
(circuit->pad_hellos ? "(pad)" : "(no-pad)"),
VTY_NEWLINE);
vty_out (vty, " CNSP interval: %u, "
"PSNP interval: %u%s",
(circuit->pad_hellos ? "(pad)" : "(no-pad)"));
vty_outln (vty, " CNSP interval: %u, "
"PSNP interval: %u",
circuit->csnp_interval[0],
circuit->psnp_interval[0], VTY_NEWLINE);
circuit->psnp_interval[0]);
if (circuit->circ_type == CIRCUIT_T_BROADCAST)
vty_out (vty, " LAN Priority: %u, %s%s",
vty_outln (vty, " LAN Priority: %u, %s",
circuit->priority[0],
(circuit->u.bc.is_dr[0] ? \
"is DIS" : "is not DIS"), VTY_NEWLINE);
(circuit->u.bc.is_dr[0] ? "is DIS" : "is not DIS"));
}
else
{
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
if (circuit->is_type & IS_LEVEL_2)
{
vty_out (vty, " Level-2 Information:%s", VTY_NEWLINE);
vty_outln (vty, " Level-2 Information:");
if (circuit->area->newmetric)
vty_out (vty, " Metric: %d", circuit->te_metric[1]);
else
@ -943,58 +941,56 @@ isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
circuit->metric[1]);
if (!circuit->is_passive)
{
vty_out (vty, ", Active neighbors: %u%s",
circuit->upadjcount[1], VTY_NEWLINE);
vty_out (vty, " Hello interval: %u, "
"Holddown count: %u %s%s",
vty_outln (vty, ", Active neighbors: %u",
circuit->upadjcount[1]);
vty_outln (vty, " Hello interval: %u, "
"Holddown count: %u %s",
circuit->hello_interval[1],
circuit->hello_multiplier[1],
(circuit->pad_hellos ? "(pad)" : "(no-pad)"),
VTY_NEWLINE);
vty_out (vty, " CNSP interval: %u, "
"PSNP interval: %u%s",
(circuit->pad_hellos ? "(pad)" : "(no-pad)"));
vty_outln (vty, " CNSP interval: %u, "
"PSNP interval: %u",
circuit->csnp_interval[1],
circuit->psnp_interval[1], VTY_NEWLINE);
circuit->psnp_interval[1]);
if (circuit->circ_type == CIRCUIT_T_BROADCAST)
vty_out (vty, " LAN Priority: %u, %s%s",
vty_outln (vty, " LAN Priority: %u, %s",
circuit->priority[1],
(circuit->u.bc.is_dr[1] ? \
"is DIS" : "is not DIS"), VTY_NEWLINE);
(circuit->u.bc.is_dr[1] ? "is DIS" : "is not DIS"));
}
else
{
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
if (circuit->ip_addrs && listcount (circuit->ip_addrs) > 0)
{
vty_out (vty, " IP Prefix(es):%s", VTY_NEWLINE);
vty_outln (vty, " IP Prefix(es):");
for (ALL_LIST_ELEMENTS_RO (circuit->ip_addrs, node, ip_addr))
{
prefix2str (ip_addr, buf, sizeof (buf)),
vty_out (vty, " %s%s", buf, VTY_NEWLINE);
vty_outln (vty, " %s", buf);
}
}
if (circuit->ipv6_link && listcount(circuit->ipv6_link) > 0)
{
vty_out(vty, " IPv6 Link-Locals:%s", VTY_NEWLINE);
vty_outln (vty, " IPv6 Link-Locals:");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, ip_addr))
{
prefix2str(ip_addr, (char*)buf, BUFSIZ),
vty_out(vty, " %s%s", buf, VTY_NEWLINE);
vty_outln (vty, " %s", buf);
}
}
if (circuit->ipv6_non_link && listcount(circuit->ipv6_non_link) > 0)
{
vty_out(vty, " IPv6 Prefixes:%s", VTY_NEWLINE);
vty_outln (vty, " IPv6 Prefixes:");
for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, node, ip_addr))
{
prefix2str(ip_addr, (char*)buf, BUFSIZ),
vty_out(vty, " %s%s", buf, VTY_NEWLINE);
vty_outln (vty, " %s", buf);
}
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
return;
}
@ -1015,12 +1011,12 @@ isis_interface_config_write (struct vty *vty)
continue;
/* IF name */
vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
vty_outln (vty, "interface %s", ifp->name);
write++;
/* IF desc */
if (ifp->desc)
{
vty_out (vty, " description %s%s", ifp->desc, VTY_NEWLINE);
vty_outln (vty, " description %s", ifp->desc);
write++;
}
/* ISIS Circuit */
@ -1031,39 +1027,36 @@ isis_interface_config_write (struct vty *vty)
continue;
if (circuit->ip_router)
{
vty_out (vty, " ip router isis %s%s", area->area_tag,
VTY_NEWLINE);
vty_outln (vty, " ip router isis %s",area->area_tag);
write++;
}
if (circuit->is_passive)
{
vty_out (vty, " isis passive%s", VTY_NEWLINE);
vty_outln (vty, " isis passive");
write++;
}
if (circuit->circ_type_config == CIRCUIT_T_P2P)
{
vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE);
vty_outln (vty, " isis network point-to-point");
write++;
}
if (circuit->ipv6_router)
{
vty_out (vty, " ipv6 router isis %s%s", area->area_tag,
VTY_NEWLINE);
vty_outln (vty, " ipv6 router isis %s",area->area_tag);
write++;
}
/* ISIS - circuit type */
if (circuit->is_type == IS_LEVEL_1)
{
vty_out (vty, " isis circuit-type level-1%s", VTY_NEWLINE);
vty_outln (vty, " isis circuit-type level-1");
write++;
}
else
{
if (circuit->is_type == IS_LEVEL_2)
{
vty_out (vty, " isis circuit-type level-2-only%s",
VTY_NEWLINE);
vty_outln (vty," isis circuit-type level-2-only");
write++;
}
}
@ -1073,8 +1066,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->csnp_interval[0] != DEFAULT_CSNP_INTERVAL)
{
vty_out (vty, " isis csnp-interval %d%s",
circuit->csnp_interval[0], VTY_NEWLINE);
vty_outln (vty, " isis csnp-interval %d",
circuit->csnp_interval[0]);
write++;
}
}
@ -1084,8 +1077,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->csnp_interval[i] != DEFAULT_CSNP_INTERVAL)
{
vty_out (vty, " isis csnp-interval %d level-%d%s",
circuit->csnp_interval[i], i + 1, VTY_NEWLINE);
vty_outln (vty, " isis csnp-interval %d level-%d",
circuit->csnp_interval[i], i + 1);
write++;
}
}
@ -1096,8 +1089,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->psnp_interval[0] != DEFAULT_PSNP_INTERVAL)
{
vty_out (vty, " isis psnp-interval %d%s",
circuit->psnp_interval[0], VTY_NEWLINE);
vty_outln (vty, " isis psnp-interval %d",
circuit->psnp_interval[0]);
write++;
}
}
@ -1107,8 +1100,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->psnp_interval[i] != DEFAULT_PSNP_INTERVAL)
{
vty_out (vty, " isis psnp-interval %d level-%d%s",
circuit->psnp_interval[i], i + 1, VTY_NEWLINE);
vty_outln (vty, " isis psnp-interval %d level-%d",
circuit->psnp_interval[i], i + 1);
write++;
}
}
@ -1117,7 +1110,7 @@ isis_interface_config_write (struct vty *vty)
/* ISIS - Hello padding - Defaults to true so only display if false */
if (circuit->pad_hellos == 0)
{
vty_out (vty, " no isis hello padding%s", VTY_NEWLINE);
vty_outln (vty, " no isis hello padding");
write++;
}
@ -1126,8 +1119,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->hello_interval[0] != DEFAULT_HELLO_INTERVAL)
{
vty_out (vty, " isis hello-interval %d%s",
circuit->hello_interval[0], VTY_NEWLINE);
vty_outln (vty, " isis hello-interval %d",
circuit->hello_interval[0]);
write++;
}
}
@ -1137,8 +1130,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->hello_interval[i] != DEFAULT_HELLO_INTERVAL)
{
vty_out (vty, " isis hello-interval %d level-%d%s",
circuit->hello_interval[i], i + 1, VTY_NEWLINE);
vty_outln (vty, " isis hello-interval %d level-%d",
circuit->hello_interval[i], i + 1);
write++;
}
}
@ -1149,8 +1142,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->hello_multiplier[0] != DEFAULT_HELLO_MULTIPLIER)
{
vty_out (vty, " isis hello-multiplier %d%s",
circuit->hello_multiplier[0], VTY_NEWLINE);
vty_outln (vty, " isis hello-multiplier %d",
circuit->hello_multiplier[0]);
write++;
}
}
@ -1160,9 +1153,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->hello_multiplier[i] != DEFAULT_HELLO_MULTIPLIER)
{
vty_out (vty, " isis hello-multiplier %d level-%d%s",
circuit->hello_multiplier[i], i + 1,
VTY_NEWLINE);
vty_outln (vty, " isis hello-multiplier %d level-%d",
circuit->hello_multiplier[i],i + 1);
write++;
}
}
@ -1173,8 +1165,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->priority[0] != DEFAULT_PRIORITY)
{
vty_out (vty, " isis priority %d%s",
circuit->priority[0], VTY_NEWLINE);
vty_outln (vty, " isis priority %d",
circuit->priority[0]);
write++;
}
}
@ -1184,8 +1176,8 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->priority[i] != DEFAULT_PRIORITY)
{
vty_out (vty, " isis priority %d level-%d%s",
circuit->priority[i], i + 1, VTY_NEWLINE);
vty_outln (vty, " isis priority %d level-%d",
circuit->priority[i], i + 1);
write++;
}
}
@ -1196,8 +1188,7 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->te_metric[0] != DEFAULT_CIRCUIT_METRIC)
{
vty_out (vty, " isis metric %d%s", circuit->te_metric[0],
VTY_NEWLINE);
vty_outln (vty, " isis metric %d",circuit->te_metric[0]);
write++;
}
}
@ -1207,27 +1198,27 @@ isis_interface_config_write (struct vty *vty)
{
if (circuit->te_metric[i] != DEFAULT_CIRCUIT_METRIC)
{
vty_out (vty, " isis metric %d level-%d%s",
circuit->te_metric[i], i + 1, VTY_NEWLINE);
vty_outln (vty, " isis metric %d level-%d",
circuit->te_metric[i], i + 1);
write++;
}
}
}
if (circuit->passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
{
vty_out (vty, " isis password md5 %s%s", circuit->passwd.passwd,
VTY_NEWLINE);
vty_outln (vty, " isis password md5 %s",
circuit->passwd.passwd);
write++;
}
else if (circuit->passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
{
vty_out (vty, " isis password clear %s%s", circuit->passwd.passwd,
VTY_NEWLINE);
vty_outln (vty, " isis password clear %s",
circuit->passwd.passwd);
write++;
}
write += circuit_write_mt_settings(circuit, vty);
}
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
}
return write;

View File

@ -159,15 +159,13 @@ dynhn_print_all (struct vty *vty)
struct listnode *node;
struct isis_dynhn *dyn;
vty_out (vty, "Level System ID Dynamic Hostname%s", VTY_NEWLINE);
vty_outln (vty, "Level System ID Dynamic Hostname");
for (ALL_LIST_ELEMENTS_RO (dyn_cache, node, dyn))
{
vty_out (vty, "%-7d", dyn->level);
vty_out (vty, "%-15s%-15s%s", sysid_print (dyn->id), dyn->name.name,
VTY_NEWLINE);
vty_outln (vty, "%-15s%-15s", sysid_print (dyn->id),dyn->name.name);
}
vty_out (vty, " * %s %s%s", sysid_print (isis->sysid), unix_hostname (),
VTY_NEWLINE);
vty_outln (vty, " * %s %s", sysid_print (isis->sysid),unix_hostname());
return;
}

View File

@ -824,8 +824,8 @@ lsp_print (struct isis_lsp *lsp, struct vty *vty, char dynhost)
}
else
vty_out (vty, " %5u ", ntohs (lsp->lsp_header->rem_lifetime));
vty_out (vty, "%s%s",
lsp_bits2string (&lsp->lsp_header->lsp_bits), VTY_NEWLINE);
vty_outln (vty, "%s",
lsp_bits2string(&lsp->lsp_header->lsp_bits));
}
static void
@ -842,14 +842,14 @@ lsp_print_mt_reach(struct list *list, struct vty *vty,
lspid_print(neigh->neigh_id, lspid, dynhost, 0);
if (mtid == ISIS_MT_IPV4_UNICAST)
{
vty_out(vty, " Metric : %-8d IS-Extended : %s%s",
GET_TE_METRIC(neigh), lspid, VTY_NEWLINE);
vty_outln(vty, " Metric : %-8u IS-Extended : %s",
GET_TE_METRIC(neigh), lspid);
}
else
{
vty_out(vty, " Metric : %-8d MT-Reach : %s %s%s",
GET_TE_METRIC(neigh), lspid,
isis_mtid2str(mtid), VTY_NEWLINE);
vty_outln(vty, " Metric : %-8u MT-Reach : %s %s",
GET_TE_METRIC(neigh), lspid,
isis_mtid2str(mtid));
}
if (IS_MPLS_TE(isisMplsTE))
mpls_te_print_detail(vty, neigh);
@ -874,27 +874,27 @@ lsp_print_mt_ipv6_reach(struct list *list, struct vty *vty, uint16_t mtid)
{
if ((ipv6_reach->control_info &
CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL)
vty_out (vty, " Metric : %-8d IPv6-Internal : %s/%d%s",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len, VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu32 " IPv6-Internal : %s/%d",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len);
else
vty_out (vty, " Metric : %-8d IPv6-External : %s/%d%s",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len, VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu32 " IPv6-External : %s/%d",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len);
}
else
{
if ((ipv6_reach->control_info &
CTRL_INFO_DISTRIBUTION) == DISTRIBUTION_INTERNAL)
vty_out (vty, " Metric : %-8d IPv6-MT-Int : %s/%d %s%s",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len,
isis_mtid2str(mtid), VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu32 " IPv6-MT-Int : %s/%d %s",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len,
isis_mtid2str(mtid));
else
vty_out (vty, " Metric : %-8d IPv6-MT-Ext : %s/%d %s%s",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len,
isis_mtid2str(mtid), VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu32 " IPv6-MT-Ext : %s/%d %s",
ntohl (ipv6_reach->metric),
buff, ipv6_reach->prefix_len,
isis_mtid2str(mtid));
}
}
}
@ -910,21 +910,21 @@ lsp_print_mt_ipv4_reach(struct list *list, struct vty *vty, uint16_t mtid)
if (mtid == ISIS_MT_IPV4_UNICAST)
{
/* FIXME: There should be better way to output this stuff. */
vty_out (vty, " Metric : %-8d IPv4-Extended : %s/%d%s",
ntohl (te_ipv4_reach->te_metric),
inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start,
te_ipv4_reach->control)),
te_ipv4_reach->control & 0x3F, VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu32 " IPv4-Extended : %s/%d",
ntohl (te_ipv4_reach->te_metric),
inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start,
te_ipv4_reach->control)),
te_ipv4_reach->control & 0x3F);
}
else
{
/* FIXME: There should be better way to output this stuff. */
vty_out (vty, " Metric : %-8d IPv4-MT : %s/%d %s%s",
ntohl (te_ipv4_reach->te_metric),
inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start,
te_ipv4_reach->control)),
te_ipv4_reach->control & 0x3F,
isis_mtid2str(mtid), VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu32 " IPv4-MT : %s/%d %s",
ntohl (te_ipv4_reach->te_metric),
inet_ntoa (newprefix2inaddr (&te_ipv4_reach->prefix_start,
te_ipv4_reach->control)),
te_ipv4_reach->control & 0x3F,
isis_mtid2str(mtid));
}
}
}
@ -955,9 +955,8 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
if (lsp->tlv_data.area_addrs)
for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.area_addrs, lnode, area_addr))
{
vty_out (vty, " Area Address: %s%s",
isonet_print (area_addr->area_addr, area_addr->addr_len),
VTY_NEWLINE);
vty_outln (vty, " Area Address: %s",
isonet_print(area_addr->area_addr, area_addr->addr_len));
}
/* for the nlpid tlv */
@ -969,11 +968,11 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
{
case NLPID_IP:
case NLPID_IPV6:
vty_out (vty, " NLPID : 0x%X%s",
lsp->tlv_data.nlpids->nlpids[i], VTY_NEWLINE);
vty_outln (vty, " NLPID : 0x%X",
lsp->tlv_data.nlpids->nlpids[i]);
break;
default:
vty_out (vty, " NLPID : %s%s", "unknown", VTY_NEWLINE);
vty_outln (vty, " NLPID : %s", "unknown");
break;
}
}
@ -981,10 +980,9 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
for (ALL_LIST_ELEMENTS_RO(lsp->tlv_data.mt_router_info, lnode, mt_router_info))
{
vty_out (vty, " MT : %s%s%s",
vty_outln (vty, " MT : %s%s",
isis_mtid2str(mt_router_info->mtid),
mt_router_info->overload ? " (overload)" : "",
VTY_NEWLINE);
mt_router_info->overload ? " (overload)" : "");
}
/* for the hostname tlv */
@ -993,16 +991,16 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
bzero (hostname, sizeof (hostname));
memcpy (hostname, lsp->tlv_data.hostname->name,
lsp->tlv_data.hostname->namelen);
vty_out (vty, " Hostname : %s%s", hostname, VTY_NEWLINE);
vty_outln (vty, " Hostname : %s", hostname);
}
/* authentication tlv */
if (lsp->tlv_data.auth_info.type != ISIS_PASSWD_TYPE_UNUSED)
{
if (lsp->tlv_data.auth_info.type == ISIS_PASSWD_TYPE_HMAC_MD5)
vty_out (vty, " Auth type : md5%s", VTY_NEWLINE);
vty_outln (vty, " Auth type : md5");
else if (lsp->tlv_data.auth_info.type == ISIS_PASSWD_TYPE_CLEARTXT)
vty_out (vty, " Auth type : clear text%s", VTY_NEWLINE);
vty_outln (vty, " Auth type : clear text");
}
/* TE router id */
@ -1010,14 +1008,14 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
{
memcpy (ipv4_address, inet_ntoa (lsp->tlv_data.router_id->id),
sizeof (ipv4_address));
vty_out (vty, " Router ID : %s%s", ipv4_address, VTY_NEWLINE);
vty_outln (vty, " Router ID : %s", ipv4_address);
}
if (lsp->tlv_data.ipv4_addrs)
for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv4_addrs, lnode, ipv4_addr))
{
memcpy (ipv4_address, inet_ntoa (*ipv4_addr), sizeof (ipv4_address));
vty_out (vty, " IPv4 Address: %s%s", ipv4_address, VTY_NEWLINE);
vty_outln (vty, " IPv4 Address: %s", ipv4_address);
}
/* for the IS neighbor tlv */
@ -1025,8 +1023,8 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.is_neighs, lnode, is_neigh))
{
lspid_print (is_neigh->neigh_id, LSPid, dynhost, 0);
vty_out (vty, " Metric : %-8d IS : %s%s",
is_neigh->metrics.metric_default, LSPid, VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu8 " IS : %s",
is_neigh->metrics.metric_default, LSPid);
}
/* for the internal reachable tlv */
@ -1038,9 +1036,9 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
sizeof (ipv4_reach_prefix));
memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask),
sizeof (ipv4_reach_mask));
vty_out (vty, " Metric : %-8d IPv4-Internal : %s %s%s",
ipv4_reach->metrics.metric_default, ipv4_reach_prefix,
ipv4_reach_mask, VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu8 " IPv4-Internal : %s %s",
ipv4_reach->metrics.metric_default, ipv4_reach_prefix,
ipv4_reach_mask);
}
/* for the external reachable tlv */
@ -1052,9 +1050,9 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
sizeof (ipv4_reach_prefix));
memcpy (ipv4_reach_mask, inet_ntoa (ipv4_reach->mask),
sizeof (ipv4_reach_mask));
vty_out (vty, " Metric : %-8d IPv4-External : %s %s%s",
ipv4_reach->metrics.metric_default, ipv4_reach_prefix,
ipv4_reach_mask, VTY_NEWLINE);
vty_outln (vty, " Metric : %-8" PRIu8 " IPv4-External : %s %s",
ipv4_reach->metrics.metric_default, ipv4_reach_prefix,
ipv4_reach_mask);
}
/* IPv6 tlv */
@ -1081,7 +1079,7 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost)
for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.mt_ipv4_reachs, lnode, mt_ipv4_reachs))
lsp_print_mt_ipv4_reach(mt_ipv4_reachs->list, vty, mt_ipv4_reachs->mtid);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return;
}

View File

@ -101,6 +101,7 @@ void sigusr1(void);
static __attribute__((__noreturn__)) void
terminate (int i)
{
isis_zebra_stop ();
exit (i);
}

View File

@ -193,9 +193,8 @@ area_write_mt_settings(struct isis_area *area, struct vty *vty)
{
if (setting->mtid == ISIS_MT_IPV4_UNICAST)
continue; /* always enabled, no need to write out config */
vty_out (vty, " topology %s%s%s", name,
setting->overload ? " overload" : "",
VTY_NEWLINE);
vty_outln (vty, " topology %s%s", name,
setting->overload ? " overload" : "");
written++;
}
}
@ -326,7 +325,7 @@ circuit_write_mt_settings(struct isis_circuit *circuit, struct vty *vty)
const char *name = isis_mtid2str(setting->mtid);
if (name && !setting->enabled)
{
vty_out (vty, " no isis topology %s%s", name, VTY_NEWLINE);
vty_outln (vty, " no isis topology %s", name);
written++;
}
}

View File

@ -55,6 +55,18 @@ redist_protocol(int family)
return 0;
}
static afi_t
afi_for_redist_protocol(int protocol)
{
if (protocol == 0)
return AFI_IP;
if (protocol == 1)
return AFI_IP6;
assert(!"Unknown redist protocol!");
return AFI_IP;
}
static int
is_default(struct prefix *p)
{
@ -177,7 +189,7 @@ isis_redist_uninstall(struct isis_area *area, int level, struct prefix *p)
if (!er_node->info)
return;
XFREE(MTYPE_ISIS, er_node->info);
XFREE(MTYPE_ISIS_EXT_INFO, er_node->info);
route_unlock_node(er_node);
lsp_regenerate_schedule(area, level, 0);
}
@ -360,7 +372,7 @@ isis_redist_delete(int type, struct prefix *p)
isis_redist_uninstall(area, level, p);
}
XFREE(MTYPE_ISIS, ei_node->info);
XFREE(MTYPE_ISIS_EXT_INFO, ei_node->info);
route_unlock_node(ei_node);
}
@ -387,7 +399,7 @@ isis_redist_update_zebra_subscriptions(struct isis *isis)
int level;
int protocol;
char do_subscribe[ZEBRA_ROUTE_MAX + 1];
char do_subscribe[REDIST_PROTOCOL_COUNT][ZEBRA_ROUTE_MAX + 1];
memset(do_subscribe, 0, sizeof(do_subscribe));
@ -396,20 +408,23 @@ isis_redist_update_zebra_subscriptions(struct isis *isis)
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
for (level = 0; level < ISIS_LEVELS; level++)
if (area->redist_settings[protocol][type][level].redist)
do_subscribe[type] = 1;
do_subscribe[protocol][type] = 1;
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
{
/* This field is actually controlling transmission of the IS-IS
* routes to Zebra and has nothing to do with redistribution,
* so skip it. */
if (type == ZEBRA_ROUTE_ISIS)
continue;
for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++)
for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++)
{
/* This field is actually controlling transmission of the IS-IS
* routes to Zebra and has nothing to do with redistribution,
* so skip it. */
if (type == ZEBRA_ROUTE_ISIS)
continue;
if (do_subscribe[type])
isis_zebra_redistribute_set(type);
else
isis_zebra_redistribute_unset(type);
afi_t afi = afi_for_redist_protocol(protocol);
if (do_subscribe[protocol][type])
isis_zebra_redistribute_set(afi, type);
else
isis_zebra_redistribute_unset(afi, type);
}
}
@ -505,7 +520,7 @@ isis_redist_unset(struct isis_area *area, int level,
continue;
}
XFREE(MTYPE_ISIS, rn->info);
XFREE(MTYPE_ISIS_EXT_INFO, rn->info);
route_unlock_node(rn);
}
@ -540,7 +555,7 @@ isis_redist_area_finish(struct isis_area *area)
DEFUN (isis_redistribute,
isis_redistribute_cmd,
"redistribute " FRR_REDIST_STR_ISISD " <level-1|level-2> [<metric (0-16777215)|route-map WORD>]",
"redistribute <ipv4|ipv6> " FRR_REDIST_STR_ISISD " <level-1|level-2> [<metric (0-16777215)|route-map WORD>]",
REDIST_STR
"Redistribute IPv4 routes\n"
"Redistribute IPv6 routes\n"
@ -585,23 +600,30 @@ DEFUN (isis_redistribute,
if ((area->is_type & level) != level)
{
vty_out(vty, "Node is not a level-%d IS%s", level, VTY_NEWLINE);
vty_outln (vty, "Node is not a level-%d IS", level);
return CMD_WARNING;
}
if (strmatch(argv[idx_metric_rmap]->text, "metric"))
{
char *endp;
metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10);
routemap = NULL;
metric = 0xffffffff;
routemap = NULL;
if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0')
return CMD_WARNING;
}
else
if (argc > idx_metric_rmap + 1)
{
routemap = argv[idx_metric_rmap + 1]->arg;
metric = 0xffffffff;
if (argv[idx_metric_rmap + 1]->arg[0] == '\0')
return CMD_WARNING;
if (strmatch(argv[idx_metric_rmap]->text, "metric"))
{
char *endp;
metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10);
if (*endp != '\0')
return CMD_WARNING;
}
else
{
routemap = argv[idx_metric_rmap + 1]->arg;
}
}
isis_redist_set(area, level, family, type, metric, routemap, 0);
@ -610,7 +632,7 @@ DEFUN (isis_redistribute,
DEFUN (no_isis_redistribute,
no_isis_redistribute_cmd,
"no redistribute " FRR_REDIST_STR_ISISD " <level-1|level-2>",
"no redistribute <ipv4|ipv6> " FRR_REDIST_STR_ISISD " <level-1|level-2>",
NO_STR
REDIST_STR
"Redistribute IPv4 routes\n"
@ -648,7 +670,7 @@ DEFUN (no_isis_redistribute,
DEFUN (isis_default_originate,
isis_default_originate_cmd,
"default-information originate <ipv4|ipv6> <level-1|level-2> [<always|metric (0-16777215)|route-map WORD>]",
"default-information originate <ipv4|ipv6> <level-1|level-2> [always] [<metric (0-16777215)|route-map WORD>]",
"Control distribution of default information\n"
"Distribute a default route\n"
"Distribute default route for IPv4\n"
@ -663,6 +685,7 @@ DEFUN (isis_default_originate,
{
int idx_afi = 2;
int idx_level = 3;
int idx_always = 4;
int idx_metric_rmap = 4;
VTY_DECLVAR_CONTEXT (isis_area, area);
int family;
@ -679,24 +702,29 @@ DEFUN (isis_default_originate,
if ((area->is_type & level) != level)
{
vty_out(vty, "Node is not a level-%d IS%s", level, VTY_NEWLINE);
vty_outln (vty, "Node is not a level-%d IS", level);
return CMD_WARNING;
}
if (argc > 4)
{
if (strmatch (argv[idx_metric_rmap]->text, "always"))
if (argc > idx_always && strmatch (argv[idx_always]->text, "always"))
{
originate_type = DEFAULT_ORIGINATE_ALWAYS;
else if (strmatch(argv[idx_metric_rmap]->text, "metric"))
metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10);
else
routemap = argv[idx_metric_rmap + 1]->arg;
}
idx_metric_rmap++;
}
if (argc > idx_metric_rmap)
{
if (strmatch(argv[idx_metric_rmap]->text, "metric"))
metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10);
else
routemap = argv[idx_metric_rmap + 1]->arg;
}
if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS)
{
vty_out(vty, "Zebra doesn't implement default-originate for IPv6 yet%s", VTY_NEWLINE);
vty_out(vty, "so use with care or use default-originate always.%s", VTY_NEWLINE);
vty_outln (vty,
"Zebra doesn't implement default-originate for IPv6 yet");
vty_outln (vty, "so use with care or use default-originate always.");
}
isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, originate_type);
@ -768,7 +796,7 @@ isis_redist_config_write(struct vty *vty, struct isis_area *area,
vty_out(vty, " metric %u", redist->metric);
if (redist->map_name)
vty_out(vty, " route-map %s", redist->map_name);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}
}
@ -786,7 +814,7 @@ isis_redist_config_write(struct vty *vty, struct isis_area *area,
vty_out(vty, " metric %u", redist->metric);
if (redist->map_name)
vty_out(vty, " route-map %s", redist->map_name);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}

View File

@ -1321,8 +1321,8 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
struct isis_adjacency *adj;
char buff[PREFIX2STR_BUFFER];
vty_out (vty, "Vertex Type Metric "
"Next-Hop Interface Parent%s", VTY_NEWLINE);
vty_outln (vty,
"Vertex Type Metric " "Next-Hop Interface Parent");
for (ALL_LIST_ELEMENTS_RO (paths, node, vertex)) {
if (memcmp (vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) {
@ -1336,7 +1336,7 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
for (ALL_LIST_ELEMENTS_RO (vertex->Adj_N, anode, adj)) {
if (adj) {
if (rows) {
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, "%-20s %-12s %-6s ", "", "", "");
}
vty_out (vty, "%-20s %-9s ",
@ -1356,7 +1356,7 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
int rows = 0;
for (ALL_LIST_ELEMENTS_RO (vertex->parents, pnode, pvertex)) {
if (rows) {
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, "%-72s", "");
}
vty_out (vty, "%s(%d)",
@ -1367,7 +1367,7 @@ isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid)
vty_out (vty, " NULL ");
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
@ -1386,7 +1386,7 @@ DEFUN (show_isis_topology,
if (argc < 4)
levels = ISIS_LEVEL1|ISIS_LEVEL2;
else if (!strcmp(argv[3]->arg, "level-1"))
else if (strmatch(argv[3]->text, "level-1"))
levels = ISIS_LEVEL1;
else
levels = ISIS_LEVEL2;
@ -1396,8 +1396,7 @@ DEFUN (show_isis_topology,
for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
VTY_NEWLINE);
vty_outln (vty, "Area %s:",area->area_tag ? area->area_tag : "null");
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
{
@ -1407,23 +1406,23 @@ DEFUN (show_isis_topology,
if (area->ip_circuits > 0 && area->spftree[level-1]
&& area->spftree[level-1]->paths->count > 0)
{
vty_out (vty, "IS-IS paths to level-%d routers that speak IP%s",
level, VTY_NEWLINE);
vty_outln (vty, "IS-IS paths to level-%d routers that speak IP",
level);
isis_print_paths (vty, area->spftree[level-1]->paths, isis->sysid);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (area->ipv6_circuits > 0 && area->spftree6[level-1]
&& area->spftree6[level-1]->paths->count > 0)
{
vty_out (vty,
"IS-IS paths to level-%d routers that speak IPv6%s",
level, VTY_NEWLINE);
vty_outln (vty,
"IS-IS paths to level-%d routers that speak IPv6",
level);
isis_print_paths (vty, area->spftree6[level-1]->paths, isis->sysid);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
return CMD_SUCCESS;

View File

@ -685,11 +685,11 @@ show_vty_subtlv_admin_grp (struct vty *vty, struct te_subtlv_admin_grp *tlv)
{
if (vty != NULL)
vty_out (vty, " Administrative Group: 0x%x%s",
(u_int32_t) ntohl (tlv->value), VTY_NEWLINE);
else
zlog_debug (" Administrative Group: 0x%x",
(u_int32_t) ntohl (tlv->value));
vty_outln (vty, " Administrative Group: 0x%x",
(u_int32_t)ntohl(tlv->value));
else
zlog_debug (" Administrative Group: 0x%x",
(u_int32_t) ntohl (tlv->value));
return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE);
}
@ -699,10 +699,9 @@ show_vty_subtlv_llri (struct vty *vty, struct te_subtlv_llri *tlv)
{
if (vty != NULL)
{
vty_out (vty, " Link Local ID: %d%s", (u_int32_t) ntohl (tlv->local),
VTY_NEWLINE);
vty_out (vty, " Link Remote ID: %d%s", (u_int32_t) ntohl (tlv->remote),
VTY_NEWLINE);
vty_outln (vty, " Link Local ID: %d",(u_int32_t)ntohl(tlv->local));
vty_outln (vty, " Link Remote ID: %d",
(u_int32_t)ntohl(tlv->remote));
}
else
{
@ -717,9 +716,10 @@ static u_char
show_vty_subtlv_local_ipaddr (struct vty *vty, struct te_subtlv_local_ipaddr *tlv)
{
if (vty != NULL)
vty_out (vty, " Local Interface IP Address(es): %s%s", inet_ntoa (tlv->value), VTY_NEWLINE);
else
zlog_debug (" Local Interface IP Address(es): %s", inet_ntoa (tlv->value));
vty_outln (vty, " Local Interface IP Address(es): %s",
inet_ntoa(tlv->value));
else
zlog_debug (" Local Interface IP Address(es): %s", inet_ntoa (tlv->value));
return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE);
}
@ -728,9 +728,10 @@ static u_char
show_vty_subtlv_rmt_ipaddr (struct vty *vty, struct te_subtlv_rmt_ipaddr *tlv)
{
if (vty != NULL)
vty_out (vty, " Remote Interface IP Address(es): %s%s", inet_ntoa (tlv->value), VTY_NEWLINE);
else
zlog_debug (" Remote Interface IP Address(es): %s", inet_ntoa (tlv->value));
vty_outln (vty, " Remote Interface IP Address(es): %s",
inet_ntoa(tlv->value));
else
zlog_debug (" Remote Interface IP Address(es): %s", inet_ntoa (tlv->value));
return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE);
}
@ -743,7 +744,7 @@ show_vty_subtlv_max_bw (struct vty *vty, struct te_subtlv_max_bw *tlv)
fval = ntohf (tlv->value);
if (vty != NULL)
vty_out (vty, " Maximum Bandwidth: %g (Bytes/sec)%s", fval, VTY_NEWLINE);
vty_outln (vty, " Maximum Bandwidth: %g (Bytes/sec)", fval);
else
zlog_debug (" Maximum Bandwidth: %g (Bytes/sec)", fval);
@ -758,8 +759,7 @@ show_vty_subtlv_max_rsv_bw (struct vty *vty, struct te_subtlv_max_rsv_bw *tlv)
fval = ntohf (tlv->value);
if (vty != NULL)
vty_out (vty, " Maximum Reservable Bandwidth: %g (Bytes/sec)%s", fval,
VTY_NEWLINE);
vty_outln (vty, " Maximum Reservable Bandwidth: %g (Bytes/sec)",fval);
else
zlog_debug (" Maximum Reservable Bandwidth: %g (Bytes/sec)", fval);
@ -773,7 +773,7 @@ show_vty_subtlv_unrsv_bw (struct vty *vty, struct te_subtlv_unrsv_bw *tlv)
int i;
if (vty != NULL)
vty_out (vty, " Unreserved Bandwidth:%s",VTY_NEWLINE);
vty_outln (vty, " Unreserved Bandwidth:");
else
zlog_debug (" Unreserved Bandwidth:");
@ -782,7 +782,8 @@ show_vty_subtlv_unrsv_bw (struct vty *vty, struct te_subtlv_unrsv_bw *tlv)
fval1 = ntohf (tlv->value[i]);
fval2 = ntohf (tlv->value[i+1]);
if (vty != NULL)
vty_out (vty, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)%s", i, fval1, i+1, fval2, VTY_NEWLINE);
vty_outln (vty, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)", i, fval1, i+1,
fval2);
else
zlog_debug (" [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)", i, fval1, i+1, fval2);
}
@ -797,7 +798,7 @@ show_vty_subtlv_te_metric (struct vty *vty, struct te_subtlv_te_metric *tlv)
te_metric = tlv->value[2] | tlv->value[1] << 8 | tlv->value[0] << 16;
if (vty != NULL)
vty_out (vty, " Traffic Engineering Metric: %u%s", te_metric, VTY_NEWLINE);
vty_outln (vty, " Traffic Engineering Metric: %u", te_metric);
else
zlog_debug (" Traffic Engineering Metric: %u", te_metric);
@ -808,9 +809,10 @@ static u_char
show_vty_subtlv_ras (struct vty *vty, struct te_subtlv_ras *tlv)
{
if (vty != NULL)
vty_out (vty, " Inter-AS TE Remote AS number: %u%s", ntohl (tlv->value), VTY_NEWLINE);
else
zlog_debug (" Inter-AS TE Remote AS number: %u", ntohl (tlv->value));
vty_outln (vty, " Inter-AS TE Remote AS number: %u",
ntohl(tlv->value));
else
zlog_debug (" Inter-AS TE Remote AS number: %u", ntohl (tlv->value));
return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE);
}
@ -819,9 +821,10 @@ static u_char
show_vty_subtlv_rip (struct vty *vty, struct te_subtlv_rip *tlv)
{
if (vty != NULL)
vty_out (vty, " Inter-AS TE Remote ASBR IP address: %s%s", inet_ntoa (tlv->value), VTY_NEWLINE);
else
zlog_debug (" Inter-AS TE Remote ASBR IP address: %s", inet_ntoa (tlv->value));
vty_outln (vty, " Inter-AS TE Remote ASBR IP address: %s",
inet_ntoa(tlv->value));
else
zlog_debug (" Inter-AS TE Remote ASBR IP address: %s", inet_ntoa (tlv->value));
return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE);
}
@ -836,7 +839,8 @@ show_vty_subtlv_av_delay (struct vty *vty, struct te_subtlv_av_delay *tlv)
A = (u_int32_t) ntohl (tlv->value) & TE_EXT_ANORMAL;
if (vty != NULL)
vty_out (vty, " %s Average Link Delay: %d (micro-sec)%s", A ? "Anomalous" : "Normal", delay, VTY_NEWLINE);
vty_outln (vty, " %s Average Link Delay: %d (micro-sec)", A ? "Anomalous" : "Normal",
delay);
else
zlog_debug (" %s Average Link Delay: %d (micro-sec)", A ? "Anomalous" : "Normal", delay);
@ -854,7 +858,8 @@ show_vty_subtlv_mm_delay (struct vty *vty, struct te_subtlv_mm_delay *tlv)
high = (u_int32_t) ntohl (tlv->high) & TE_EXT_MASK;
if (vty != NULL)
vty_out (vty, " %s Min/Max Link Delay: %d / %d (micro-sec)%s", A ? "Anomalous" : "Normal", low, high, VTY_NEWLINE);
vty_outln (vty, " %s Min/Max Link Delay: %d / %d (micro-sec)", A ? "Anomalous" : "Normal", low,
high);
else
zlog_debug (" %s Min/Max Link Delay: %d / %d (micro-sec)", A ? "Anomalous" : "Normal", low, high);
@ -869,7 +874,7 @@ show_vty_subtlv_delay_var (struct vty *vty, struct te_subtlv_delay_var *tlv)
jitter = (u_int32_t) ntohl (tlv->value) & TE_EXT_MASK;
if (vty != NULL)
vty_out (vty, " Delay Variation: %d (micro-sec)%s", jitter, VTY_NEWLINE);
vty_outln (vty, " Delay Variation: %d (micro-sec)", jitter);
else
zlog_debug (" Delay Variation: %d (micro-sec)", jitter);
@ -888,7 +893,8 @@ show_vty_subtlv_pkt_loss (struct vty *vty, struct te_subtlv_pkt_loss *tlv)
A = (u_int32_t) ntohl (tlv->value) & TE_EXT_ANORMAL;
if (vty != NULL)
vty_out (vty, " %s Link Packet Loss: %g (%%)%s", A ? "Anomalous" : "Normal", fval, VTY_NEWLINE);
vty_outln (vty, " %s Link Packet Loss: %g (%%)", A ? "Anomalous" : "Normal",
fval);
else
zlog_debug (" %s Link Packet Loss: %g (%%)", A ? "Anomalous" : "Normal", fval);
@ -903,7 +909,8 @@ show_vty_subtlv_res_bw (struct vty *vty, struct te_subtlv_res_bw *tlv)
fval = ntohf(tlv->value);
if (vty != NULL)
vty_out (vty, " Unidirectional Residual Bandwidth: %g (Bytes/sec)%s", fval, VTY_NEWLINE);
vty_outln (vty, " Unidirectional Residual Bandwidth: %g (Bytes/sec)",
fval);
else
zlog_debug (" Unidirectional Residual Bandwidth: %g (Bytes/sec)", fval);
@ -918,7 +925,8 @@ show_vty_subtlv_ava_bw (struct vty *vty, struct te_subtlv_ava_bw *tlv)
fval = ntohf (tlv->value);
if (vty != NULL)
vty_out (vty, " Unidirectional Available Bandwidth: %g (Bytes/sec)%s", fval, VTY_NEWLINE);
vty_outln (vty, " Unidirectional Available Bandwidth: %g (Bytes/sec)",
fval);
else
zlog_debug (" Unidirectional Available Bandwidth: %g (Bytes/sec)", fval);
@ -933,7 +941,8 @@ show_vty_subtlv_use_bw (struct vty *vty, struct te_subtlv_use_bw *tlv)
fval = ntohf (tlv->value);
if (vty != NULL)
vty_out (vty, " Unidirectional Utilized Bandwidth: %g (Bytes/sec)%s", fval, VTY_NEWLINE);
vty_outln (vty, " Unidirectional Utilized Bandwidth: %g (Bytes/sec)",
fval);
else
zlog_debug (" Unidirectional Utilized Bandwidth: %g (Bytes/sec)", fval);
@ -950,8 +959,8 @@ show_vty_unknown_tlv (struct vty *vty, struct subtlv_header *tlvh)
{
if (tlvh->length != 0)
{
vty_out (vty, " Unknown TLV: [type(%#.2x), length(%#.2x)]%s",
tlvh->type, tlvh->length, VTY_NEWLINE);
vty_outln (vty, " Unknown TLV: [type(%#.2x), length(%#.2x)]",
tlvh->type, tlvh->length);
vty_out(vty, " Dump: [00]");
rtn = 1; /* initialize end of line counter */
for (i = 0; i < tlvh->length; i++)
@ -959,17 +968,17 @@ show_vty_unknown_tlv (struct vty *vty, struct subtlv_header *tlvh)
vty_out (vty, " %#.2x", v[i]);
if (rtn == 8)
{
vty_out (vty, "%s [%.2x]", VTY_NEWLINE, i + 1);
vty_out (vty, "%s [%.2x]", VTYNL, i + 1);
rtn = 1;
}
else
rtn++;
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
else
vty_out (vty, " Unknown TLV: [type(%#.2x), length(%#.2x)]%s",
tlvh->type, tlvh->length, VTY_NEWLINE);
vty_outln (vty, " Unknown TLV: [type(%#.2x), length(%#.2x)]",
tlvh->type, tlvh->length);
}
else
{
@ -1060,9 +1069,9 @@ isis_mpls_te_config_write_router (struct vty *vty)
{
if (IS_MPLS_TE(isisMplsTE))
{
vty_out (vty, " mpls-te on%s", VTY_NEWLINE);
vty_out (vty, " mpls-te router-address %s%s",
inet_ntoa (isisMplsTE.router_id), VTY_NEWLINE);
vty_outln (vty, " mpls-te on");
vty_outln (vty, " mpls-te router-address %s",
inet_ntoa(isisMplsTE.router_id));
}
return;
@ -1164,7 +1173,7 @@ DEFUN (isis_mpls_te_router_addr,
if (! inet_aton (argv[idx_ipv4]->arg, &value))
{
vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE);
vty_outln (vty, "Please specify Router-Addr by A.B.C.D");
return CMD_WARNING;
}
@ -1192,7 +1201,7 @@ DEFUN (isis_mpls_te_inter_as,
"AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope)\n"
"AS native mode self originate INTER-AS LSP with L2 only flooding scope\n")
{
vty_out (vty, "Not yet supported%s", VTY_NEWLINE);
vty_outln (vty, "Not yet supported");
return CMD_SUCCESS;
}
@ -1204,7 +1213,7 @@ DEFUN (no_isis_mpls_te_inter_as,
"Disable MPLS-TE Inter-AS support\n")
{
vty_out (vty, "Not yet supported%s", VTY_NEWLINE);
vty_outln (vty, "Not yet supported");
return CMD_SUCCESS;
}
@ -1218,15 +1227,16 @@ DEFUN (show_isis_mpls_te_router,
{
if (IS_MPLS_TE(isisMplsTE))
{
vty_out (vty, "--- MPLS-TE router parameters ---%s", VTY_NEWLINE);
vty_outln (vty, "--- MPLS-TE router parameters ---");
if (ntohs (isisMplsTE.router_id.s_addr) != 0)
vty_out (vty, " Router-Address: %s%s", inet_ntoa (isisMplsTE.router_id), VTY_NEWLINE);
else
vty_out (vty, " N/A%s", VTY_NEWLINE);
vty_outln (vty, " Router-Address: %s",
inet_ntoa(isisMplsTE.router_id));
else
vty_outln (vty, " N/A");
}
else
vty_out (vty, " MPLS-TE is disable on this router%s", VTY_NEWLINE);
vty_outln (vty, " MPLS-TE is disable on this router");
return CMD_SUCCESS;
}
@ -1244,22 +1254,22 @@ show_mpls_te_sub (struct vty *vty, struct interface *ifp)
{
if (IS_INTER_AS(mtc->type))
{
vty_out (vty, "-- Inter-AS TEv2 link parameters for %s --%s",
ifp->name, VTY_NEWLINE);
vty_outln (vty, "-- Inter-AS TEv2 link parameters for %s --",
ifp->name);
}
else
{
/* MPLS-TE is not activate on this interface */
/* or this interface is passive and Inter-AS TEv2 is not activate */
vty_out (vty, " %s: MPLS-TE is disabled on this interface%s",
ifp->name, VTY_NEWLINE);
vty_outln (vty, " %s: MPLS-TE is disabled on this interface",
ifp->name);
return;
}
}
else
{
vty_out (vty, "-- MPLS-TE link parameters for %s --%s",
ifp->name, VTY_NEWLINE);
vty_outln (vty, "-- MPLS-TE link parameters for %s --",
ifp->name);
}
show_vty_subtlv_admin_grp (vty, &mtc->admin_grp);
@ -1289,12 +1299,12 @@ show_mpls_te_sub (struct vty *vty, struct interface *ifp)
show_vty_subtlv_res_bw (vty, &mtc->res_bw);
show_vty_subtlv_ava_bw (vty, &mtc->ava_bw);
show_vty_subtlv_use_bw (vty, &mtc->use_bw);
vty_out (vty, "---------------%s%s", VTY_NEWLINE, VTY_NEWLINE);
vty_outln (vty, "---------------%s", VTYNL);
}
else
{
vty_out (vty, " %s: MPLS-TE is disabled on this interface%s",
ifp->name, VTY_NEWLINE);
vty_outln (vty, " %s: MPLS-TE is disabled on this interface",
ifp->name);
}
return;
@ -1323,7 +1333,7 @@ DEFUN (show_isis_mpls_te_interface,
else
{
if ((ifp = if_lookup_by_name (argv[idx_interface]->arg, VRF_DEFAULT)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE);
vty_outln (vty, "No such interface name");
else
show_mpls_te_sub (vty, ifp);
}

View File

@ -40,15 +40,15 @@ isis_circuit_lookup (struct vty *vty)
if (!ifp)
{
vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
vty_outln (vty, "Invalid interface ");
return NULL;
}
circuit = circuit_scan_by_ifp (ifp);
if (!circuit)
{
vty_out (vty, "ISIS is not enabled on circuit %s%s",
ifp->name, VTY_NEWLINE);
vty_outln (vty, "ISIS is not enabled on circuit %s",
ifp->name);
return NULL;
}
@ -77,8 +77,8 @@ DEFUN (ip_router_isis,
{
if (strcmp (circuit->area->area_tag, area_tag))
{
vty_out (vty, "ISIS circuit is already defined on %s%s",
circuit->area->area_tag, VTY_NEWLINE);
vty_outln (vty, "ISIS circuit is already defined on %s",
circuit->area->area_tag);
return CMD_ERR_NOTHING_TODO;
}
}
@ -92,7 +92,7 @@ DEFUN (ip_router_isis,
if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
{
vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
vty_outln (vty, "Couldn't bring up interface, please check log.");
return CMD_WARNING;
}
}
@ -139,16 +139,16 @@ DEFUN (no_ip_router_isis,
area = isis_area_lookup (area_tag);
if (!area)
{
vty_out (vty, "Can't find ISIS instance %s%s",
argv[idx_afi]->arg, VTY_NEWLINE);
vty_outln (vty, "Can't find ISIS instance %s",
argv[idx_afi]->arg);
return CMD_ERR_NO_MATCH;
}
circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
if (!circuit)
{
vty_out (vty, "ISIS is not enabled on circuit %s%s",
ifp->name, VTY_NEWLINE);
vty_outln (vty, "ISIS is not enabled on circuit %s",
ifp->name);
return CMD_ERR_NO_MATCH;
}
@ -189,8 +189,7 @@ DEFUN (no_isis_passive,
if (if_is_loopback (circuit->interface))
{
vty_out (vty, "Can't set no passive for loopback interface%s",
VTY_NEWLINE);
vty_outln (vty,"Can't set no passive for loopback interface");
return CMD_ERR_AMBIGUOUS;
}
@ -216,7 +215,7 @@ DEFUN (isis_circuit_type,
is_type = string2circuit_t (argv[idx_level]->arg);
if (!is_type)
{
vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
vty_outln (vty, "Unknown circuit-type ");
return CMD_ERR_AMBIGUOUS;
}
@ -224,8 +223,8 @@ DEFUN (isis_circuit_type,
circuit->area->is_type != IS_LEVEL_1_AND_2 &&
circuit->area->is_type != is_type)
{
vty_out (vty, "Invalid circuit level for area %s.%s",
circuit->area->area_tag, VTY_NEWLINE);
vty_outln (vty, "Invalid circuit level for area %s.",
circuit->area->area_tag);
return CMD_ERR_AMBIGUOUS;
}
isis_circuit_is_type_set (circuit, is_type);
@ -273,9 +272,8 @@ DEFUN (isis_network,
if (isis_circuit_circ_type_set(circuit, CIRCUIT_T_P2P))
{
vty_out (vty, "isis network point-to-point "
"is valid only on broadcast interfaces%s",
VTY_NEWLINE);
vty_outln (vty,
"isis network point-to-point " "is valid only on broadcast interfaces");
return CMD_ERR_AMBIGUOUS;
}
@ -296,9 +294,8 @@ DEFUN (no_isis_network,
if (isis_circuit_circ_type_set(circuit, CIRCUIT_T_BROADCAST))
{
vty_out (vty, "isis network point-to-point "
"is valid only on broadcast interfaces%s",
VTY_NEWLINE);
vty_outln (vty,
"isis network point-to-point " "is valid only on broadcast interfaces");
return CMD_ERR_AMBIGUOUS;
}
@ -327,7 +324,7 @@ DEFUN (isis_passwd,
rv = isis_circuit_passwd_cleartext_set(circuit, argv[idx_word]->arg);
if (rv)
{
vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
vty_outln (vty, "Too long circuit password (>254)");
return CMD_ERR_AMBIGUOUS;
}
@ -370,8 +367,8 @@ DEFUN (isis_priority,
prio = atoi (argv[idx_number]->arg);
if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
{
vty_out (vty, "Invalid priority %d - should be <0-127>%s",
prio, VTY_NEWLINE);
vty_outln (vty, "Invalid priority %d - should be <0-127>",
prio);
return CMD_ERR_AMBIGUOUS;
}
@ -417,8 +414,8 @@ DEFUN (isis_priority_l1,
prio = atoi (argv[idx_number]->arg);
if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
{
vty_out (vty, "Invalid priority %d - should be <0-127>%s",
prio, VTY_NEWLINE);
vty_outln (vty, "Invalid priority %d - should be <0-127>",
prio);
return CMD_ERR_AMBIGUOUS;
}
@ -463,8 +460,8 @@ DEFUN (isis_priority_l2,
prio = atoi (argv[idx_number]->arg);
if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
{
vty_out (vty, "Invalid priority %d - should be <0-127>%s",
prio, VTY_NEWLINE);
vty_outln (vty, "Invalid priority %d - should be <0-127>",
prio);
return CMD_ERR_AMBIGUOUS;
}
@ -512,9 +509,9 @@ DEFUN (isis_metric,
if (circuit->area && circuit->area->oldmetric == 1 &&
met > MAX_NARROW_LINK_METRIC)
{
vty_out (vty, "Invalid metric %d - should be <0-63> "
"when narrow metric type enabled%s",
met, VTY_NEWLINE);
vty_outln (vty, "Invalid metric %d - should be <0-63> "
"when narrow metric type enabled",
met);
return CMD_ERR_AMBIGUOUS;
}
@ -522,9 +519,9 @@ DEFUN (isis_metric,
if (circuit->area && circuit->area->newmetric == 1 &&
met > MAX_WIDE_LINK_METRIC)
{
vty_out (vty, "Invalid metric %d - should be <0-16777215> "
"when wide metric type enabled%s",
met, VTY_NEWLINE);
vty_outln (vty, "Invalid metric %d - should be <0-16777215> "
"when wide metric type enabled",
met);
return CMD_ERR_AMBIGUOUS;
}
@ -572,9 +569,9 @@ DEFUN (isis_metric_l1,
if (circuit->area && circuit->area->oldmetric == 1 &&
met > MAX_NARROW_LINK_METRIC)
{
vty_out (vty, "Invalid metric %d - should be <0-63> "
"when narrow metric type enabled%s",
met, VTY_NEWLINE);
vty_outln (vty, "Invalid metric %d - should be <0-63> "
"when narrow metric type enabled",
met);
return CMD_ERR_AMBIGUOUS;
}
@ -582,9 +579,9 @@ DEFUN (isis_metric_l1,
if (circuit->area && circuit->area->newmetric == 1 &&
met > MAX_WIDE_LINK_METRIC)
{
vty_out (vty, "Invalid metric %d - should be <0-16777215> "
"when wide metric type enabled%s",
met, VTY_NEWLINE);
vty_outln (vty, "Invalid metric %d - should be <0-16777215> "
"when wide metric type enabled",
met);
return CMD_ERR_AMBIGUOUS;
}
@ -631,9 +628,9 @@ DEFUN (isis_metric_l2,
if (circuit->area && circuit->area->oldmetric == 1 &&
met > MAX_NARROW_LINK_METRIC)
{
vty_out (vty, "Invalid metric %d - should be <0-63> "
"when narrow metric type enabled%s",
met, VTY_NEWLINE);
vty_outln (vty, "Invalid metric %d - should be <0-63> "
"when narrow metric type enabled",
met);
return CMD_ERR_AMBIGUOUS;
}
@ -641,9 +638,9 @@ DEFUN (isis_metric_l2,
if (circuit->area && circuit->area->newmetric == 1 &&
met > MAX_WIDE_LINK_METRIC)
{
vty_out (vty, "Invalid metric %d - should be <0-16777215> "
"when wide metric type enabled%s",
met, VTY_NEWLINE);
vty_outln (vty, "Invalid metric %d - should be <0-16777215> "
"when wide metric type enabled",
met);
return CMD_ERR_AMBIGUOUS;
}
@ -688,8 +685,8 @@ DEFUN (isis_hello_interval,
interval = atoi (argv[idx_number]->arg);
if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
{
vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid hello-interval %d - should be <1-600>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -737,8 +734,8 @@ DEFUN (isis_hello_interval_l1,
interval = atoi (argv[idx_number]->arg);
if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
{
vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid hello-interval %ld - should be <1-600>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -785,8 +782,8 @@ DEFUN (isis_hello_interval_l2,
interval = atoi (argv[idx_number]->arg);
if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
{
vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid hello-interval %ld - should be <1-600>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -831,8 +828,8 @@ DEFUN (isis_hello_multiplier,
mult = atoi (argv[idx_number]->arg);
if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
{
vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
mult, VTY_NEWLINE);
vty_outln (vty, "Invalid hello-multiplier %d - should be <2-100>",
mult);
return CMD_ERR_AMBIGUOUS;
}
@ -879,8 +876,8 @@ DEFUN (isis_hello_multiplier_l1,
mult = atoi (argv[idx_number]->arg);
if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
{
vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
mult, VTY_NEWLINE);
vty_outln (vty, "Invalid hello-multiplier %d - should be <2-100>",
mult);
return CMD_ERR_AMBIGUOUS;
}
@ -926,8 +923,8 @@ DEFUN (isis_hello_multiplier_l2,
mult = atoi (argv[idx_number]->arg);
if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
{
vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
mult, VTY_NEWLINE);
vty_outln (vty, "Invalid hello-multiplier %d - should be <2-100>",
mult);
return CMD_ERR_AMBIGUOUS;
}
@ -1007,8 +1004,8 @@ DEFUN (csnp_interval,
interval = atol (argv[idx_number]->arg);
if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
{
vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid csnp-interval %lu - should be <1-600>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -1055,8 +1052,8 @@ DEFUN (csnp_interval_l1,
interval = atol (argv[idx_number]->arg);
if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
{
vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid csnp-interval %lu - should be <1-600>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -1102,8 +1099,8 @@ DEFUN (csnp_interval_l2,
interval = atol (argv[idx_number]->arg);
if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
{
vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid csnp-interval %lu - should be <1-600>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -1148,8 +1145,8 @@ DEFUN (psnp_interval,
interval = atol (argv[idx_number]->arg);
if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
{
vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid psnp-interval %lu - should be <1-120>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -1196,8 +1193,8 @@ DEFUN (psnp_interval_l1,
interval = atol (argv[idx_number]->arg);
if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
{
vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid psnp-interval %lu - should be <1-120>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -1243,8 +1240,8 @@ DEFUN (psnp_interval_l2,
interval = atol (argv[idx_number]->arg);
if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
{
vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
interval, VTY_NEWLINE);
vty_outln (vty, "Invalid psnp-interval %lu - should be <1-120>",
interval);
return CMD_ERR_AMBIGUOUS;
}
@ -1287,13 +1284,14 @@ DEFUN (circuit_topology,
if (circuit->area && circuit->area->oldmetric)
{
vty_out (vty, "Multi topology IS-IS can only be used with wide metrics%s", VTY_NEWLINE);
vty_outln (vty,
"Multi topology IS-IS can only be used with wide metrics");
return CMD_ERR_AMBIGUOUS;
}
if (mtid == (uint16_t)-1)
{
vty_out (vty, "Don't know topology '%s'%s", arg, VTY_NEWLINE);
vty_outln (vty, "Don't know topology '%s'", arg);
return CMD_ERR_AMBIGUOUS;
}
@ -1316,13 +1314,14 @@ DEFUN (no_circuit_topology,
if (circuit->area && circuit->area->oldmetric)
{
vty_out (vty, "Multi topology IS-IS can only be used with wide metrics%s", VTY_NEWLINE);
vty_outln (vty,
"Multi topology IS-IS can only be used with wide metrics");
return CMD_ERR_AMBIGUOUS;
}
if (mtid == (uint16_t)-1)
{
vty_out (vty, "Don't know topology '%s'%s", arg, VTY_NEWLINE);
vty_outln (vty, "Don't know topology '%s'", arg);
return CMD_ERR_AMBIGUOUS;
}
@ -1340,7 +1339,7 @@ validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
if (! area)
{
vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
vty_outln (vty, "ISIS area is invalid");
return CMD_ERR_AMBIGUOUS;
}
@ -1350,16 +1349,16 @@ validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
(circuit->is_type & IS_LEVEL_1) &&
(circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
{
vty_out (vty, "ISIS circuit %s metric is invalid%s",
circuit->interface->name, VTY_NEWLINE);
vty_outln (vty, "ISIS circuit %s metric is invalid",
circuit->interface->name);
return CMD_ERR_AMBIGUOUS;
}
if ((area->is_type & IS_LEVEL_2) &&
(circuit->is_type & IS_LEVEL_2) &&
(circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
{
vty_out (vty, "ISIS circuit %s metric is invalid%s",
circuit->interface->name, VTY_NEWLINE);
vty_outln (vty, "ISIS circuit %s metric is invalid",
circuit->interface->name);
return CMD_ERR_AMBIGUOUS;
}
}
@ -1387,7 +1386,8 @@ DEFUN (metric_style,
if (area_is_mt(area))
{
vty_out (vty, "Narrow metrics cannot be used while multi topology IS-IS is active%s", VTY_NEWLINE);
vty_outln (vty,
"Narrow metrics cannot be used while multi topology IS-IS is active");
return CMD_ERR_AMBIGUOUS;
}
@ -1415,7 +1415,8 @@ DEFUN (no_metric_style,
if (area_is_mt(area))
{
vty_out (vty, "Narrow metrics cannot be used while multi topology IS-IS is active%s", VTY_NEWLINE);
vty_outln (vty,
"Narrow metrics cannot be used while multi topology IS-IS is active");
return CMD_ERR_AMBIGUOUS;
}
@ -1512,9 +1513,8 @@ static int area_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
continue;
if(lsp_mtu > isis_circuit_pdu_size(circuit))
{
vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
circuit->interface->name, isis_circuit_pdu_size(circuit),
VTY_NEWLINE);
vty_outln (vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.",
circuit->interface->name,isis_circuit_pdu_size(circuit));
return CMD_ERR_AMBIGUOUS;
}
}
@ -1532,7 +1532,7 @@ DEFUN (area_lsp_mtu,
int idx_number = 1;
unsigned int lsp_mtu;
VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[idx_number]->arg, 128, 4352);
lsp_mtu = strtoul(argv[idx_number]->arg, NULL, 10);
return area_lsp_mtu_set(vty, lsp_mtu);
}
@ -1564,7 +1564,7 @@ DEFUN (is_type,
type = string2circuit_t (argv[idx_level]->arg);
if (!type)
{
vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
vty_outln (vty, "Unknown IS level ");
return CMD_SUCCESS;
}
@ -1613,9 +1613,9 @@ set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
if (interval >= area->lsp_refresh[lvl-1])
{
vty_out (vty, "LSP gen interval %us must be less than "
"the LSP refresh interval %us%s",
interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
vty_outln (vty, "LSP gen interval %us must be less than "
"the LSP refresh interval %us",
interval, area->lsp_refresh[lvl - 1]);
return CMD_ERR_AMBIGUOUS;
}
}
@ -1852,19 +1852,18 @@ area_max_lsp_lifetime_set(struct vty *vty, int level,
if (refresh_interval < area->lsp_refresh[lvl-1])
{
vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
"the configured LSP refresh interval %us%s",
lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
vty_out (vty, "Automatically reducing level %d LSP refresh interval "
"to %us%s", lvl, refresh_interval, VTY_NEWLINE);
vty_outln (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
"the configured LSP refresh interval %us",
lvl, interval, area->lsp_refresh[lvl - 1]);
vty_outln (vty, "Automatically reducing level %d LSP refresh interval "
"to %us", lvl, refresh_interval);
set_refresh_interval[lvl-1] = 1;
if (refresh_interval <= area->lsp_gen_interval[lvl-1])
{
vty_out (vty, "LSP refresh interval %us must be greater than "
"the configured LSP gen interval %us%s",
refresh_interval, area->lsp_gen_interval[lvl-1],
VTY_NEWLINE);
vty_outln (vty, "LSP refresh interval %us must be greater than "
"the configured LSP gen interval %us",
refresh_interval,area->lsp_gen_interval[lvl - 1]);
return CMD_ERR_AMBIGUOUS;
}
}
@ -1937,18 +1936,16 @@ area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval)
continue;
if (interval <= area->lsp_gen_interval[lvl-1])
{
vty_out (vty, "LSP refresh interval %us must be greater than "
"the configured LSP gen interval %us%s",
interval, area->lsp_gen_interval[lvl-1],
VTY_NEWLINE);
vty_outln (vty, "LSP refresh interval %us must be greater than "
"the configured LSP gen interval %us",
interval,area->lsp_gen_interval[lvl - 1]);
return CMD_ERR_AMBIGUOUS;
}
if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
{
vty_out (vty, "LSP refresh interval %us must be less than "
"the configured LSP lifetime %us less 300%s",
interval, area->max_lsp_lifetime[lvl-1],
VTY_NEWLINE);
vty_outln (vty, "LSP refresh interval %us must be less than "
"the configured LSP lifetime %us less 300",
interval,area->max_lsp_lifetime[lvl - 1]);
return CMD_ERR_AMBIGUOUS;
}
}
@ -2014,7 +2011,7 @@ area_passwd_set(struct vty *vty, int level,
if (passwd && strlen(passwd) > 254)
{
vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
vty_outln (vty, "Too long area password (>254)");
return CMD_ERR_AMBIGUOUS;
}

View File

@ -603,6 +603,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
struct stream *stream;
struct zapi_ipv6 api;
struct prefix_ipv6 p;
struct prefix src_p;
struct prefix *p_generic = (struct prefix*)&p;
struct in6_addr nexthop;
unsigned long ifindex __attribute__((unused));
@ -614,6 +615,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
ifindex = 0;
api.type = stream_getc(stream);
api.instance = stream_getw(stream);
api.flags = stream_getl(stream);
api.message = stream_getc(stream);
@ -621,6 +623,18 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
p.prefixlen = stream_getc(stream);
stream_get(&p.prefix, stream, PSIZE(p.prefixlen));
memset(&src_p, 0, sizeof (struct prefix));
src_p.family = AF_INET6;
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
{
src_p.prefixlen = stream_getc(stream);
stream_get(&src_p.u.prefix6, stream, PSIZE (src_p.prefixlen));
}
if (src_p.prefixlen)
/* we completely ignore srcdest routes for now. */
return 0;
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP))
{
api.nexthop_num = stream_getc(stream); /* this is always 1 */
@ -635,6 +649,8 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
api.distance = stream_getc(stream);
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_METRIC))
api.metric = stream_getl(stream);
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
api.tag = stream_getl(stream);
/*
* Avoid advertising a false default reachability. (A default
@ -645,7 +661,7 @@ isis_zebra_read_ipv6 (int command, struct zclient *zclient,
if (p.prefixlen == 0 && api.type == ZEBRA_ROUTE_ISIS)
command = ZEBRA_IPV6_ROUTE_DELETE;
if (command == ZEBRA_IPV6_ROUTE_ADD)
if (command == ZEBRA_REDISTRIBUTE_IPV6_ADD)
isis_redist_add(api.type, p_generic, api.distance, api.metric);
else
isis_redist_delete(api.type, p_generic);
@ -660,21 +676,21 @@ isis_distribute_list_update (int routetype)
}
void
isis_zebra_redistribute_set(int type)
isis_zebra_redistribute_set(afi_t afi, int type)
{
if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, VRF_DEFAULT);
else
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type, 0, VRF_DEFAULT);
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, 0, VRF_DEFAULT);
}
void
isis_zebra_redistribute_unset(int type)
isis_zebra_redistribute_unset(afi_t afi, int type)
{
if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, VRF_DEFAULT);
else
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type, 0, VRF_DEFAULT);
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, type, 0, VRF_DEFAULT);
}
static void
@ -704,3 +720,10 @@ isis_zebra_init (struct thread_master *master)
return;
}
void
isis_zebra_stop (void)
{
zclient_stop (zclient);
zclient_free (zclient);
}

View File

@ -25,10 +25,12 @@
extern struct zclient *zclient;
void isis_zebra_init(struct thread_master *);
void isis_zebra_stop(void);
void isis_zebra_route_update (struct prefix *prefix,
struct isis_route_info *route_info);
int isis_distribute_list_update (int routetype);
void isis_zebra_redistribute_set(int type);
void isis_zebra_redistribute_unset(int type);
void isis_zebra_redistribute_set(afi_t afi, int type);
void isis_zebra_redistribute_unset(afi_t afi, int type);
#endif /* _ZEBRA_ISIS_ZEBRA_H */

View File

@ -218,7 +218,7 @@ isis_area_destroy (struct vty *vty, const char *area_tag)
if (area == NULL)
{
vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
vty_outln (vty, "Can't find ISIS instance ");
return CMD_ERR_NO_MATCH;
}
@ -352,8 +352,8 @@ area_net_title (struct vty *vty, const char *net_title)
/* We check that we are not over the maximal number of addresses */
if (listcount (area->area_addrs) >= isis->max_area_addrs)
{
vty_out (vty, "Maximum of area addresses (%d) already reached %s",
isis->max_area_addrs, VTY_NEWLINE);
vty_outln (vty, "Maximum of area addresses (%d) already reached ",
isis->max_area_addrs);
return CMD_ERR_NOTHING_TODO;
}
@ -366,16 +366,15 @@ area_net_title (struct vty *vty, const char *net_title)
#endif /* EXTREME_DEBUG */
if (addr->addr_len < 8 || addr->addr_len > 20)
{
vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
addr->addr_len, VTY_NEWLINE);
vty_outln (vty, "area address must be at least 8..20 octets long (%d)",
addr->addr_len);
XFREE (MTYPE_ISIS_AREA_ADDR, addr);
return CMD_ERR_AMBIGUOUS;
}
if (addr->area_addr[addr->addr_len-1] != 0)
{
vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
VTY_NEWLINE);
vty_outln (vty,"nsel byte (last byte) in area address must be 0");
XFREE (MTYPE_ISIS_AREA_ADDR, addr);
return CMD_ERR_AMBIGUOUS;
}
@ -397,9 +396,8 @@ area_net_title (struct vty *vty, const char *net_title)
*/
if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
{
vty_out (vty,
"System ID must not change when defining additional area"
" addresses%s", VTY_NEWLINE);
vty_outln (vty,
"System ID must not change when defining additional area" " addresses");
XFREE (MTYPE_ISIS_AREA_ADDR, addr);
return CMD_ERR_AMBIGUOUS;
}
@ -446,8 +444,8 @@ area_clear_net_title (struct vty *vty, const char *net_title)
addr.addr_len = dotformat2buff (buff, net_title);
if (addr.addr_len < 8 || addr.addr_len > 20)
{
vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
addr.addr_len, VTY_NEWLINE);
vty_outln (vty, "Unsupported area address length %d, should be 8...20 ",
addr.addr_len);
return CMD_ERR_AMBIGUOUS;
}
@ -460,8 +458,8 @@ area_clear_net_title (struct vty *vty, const char *net_title)
if (!addrp)
{
vty_out (vty, "No area address %s for area %s %s", net_title,
area->area_tag, VTY_NEWLINE);
vty_outln (vty, "No area address %s for area %s ", net_title,
area->area_tag);
return CMD_ERR_NO_MATCH;
}
@ -495,17 +493,16 @@ show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
if (!isis)
{
vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "IS-IS Routing Process not enabled");
return CMD_SUCCESS;
}
for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
{
vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
vty_outln (vty, "Area %s:", area->area_tag);
if (detail == ISIS_UI_LEVEL_BRIEF)
vty_out (vty, " Interface CircId State Type Level%s",
VTY_NEWLINE);
vty_outln (vty," Interface CircId State Type Level");
for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
if (!ifname)
@ -568,7 +565,7 @@ show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
if (!isis)
{
vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "IS-IS Routing Process not enabled");
return CMD_SUCCESS;
}
@ -580,7 +577,7 @@ show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
dynhn = dynhn_find_by_name (id);
if (dynhn == NULL)
{
vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
vty_outln (vty, "Invalid system id %s", id);
return CMD_SUCCESS;
}
memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
@ -589,11 +586,11 @@ show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
{
vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
vty_outln (vty, "Area %s:", area->area_tag);
if (detail == ISIS_UI_LEVEL_BRIEF)
vty_out (vty, " System Id Interface L State"
" Holdtime SNPA%s", VTY_NEWLINE);
vty_outln (vty,
" System Id Interface L State" " Holdtime SNPA");
for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
{
@ -641,7 +638,7 @@ clear_isis_neighbor_common (struct vty *vty, const char *id)
if (!isis)
{
vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
vty_outln (vty, "IS-IS Routing Process not enabled");
return CMD_SUCCESS;
}
@ -653,7 +650,7 @@ clear_isis_neighbor_common (struct vty *vty, const char *id)
dynhn = dynhn_find_by_name (id);
if (dynhn == NULL)
{
vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
vty_outln (vty, "Invalid system id %s", id);
return CMD_SUCCESS;
}
memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
@ -760,42 +757,35 @@ print_debug (struct vty *vty, int flags, int onoff)
strcpy (onoffs, "off");
if (flags & DEBUG_ADJ_PACKETS)
vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS Adjacency related packets debugging is %s",
onoffs);
if (flags & DEBUG_CHECKSUM_ERRORS)
vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS checksum errors debugging is %s",onoffs);
if (flags & DEBUG_LOCAL_UPDATES)
vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS local updates debugging is %s",onoffs);
if (flags & DEBUG_PROTOCOL_ERRORS)
vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS protocol errors debugging is %s",onoffs);
if (flags & DEBUG_SNP_PACKETS)
vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS CSNP/PSNP packets debugging is %s",onoffs);
if (flags & DEBUG_SPF_EVENTS)
vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
vty_outln (vty, "IS-IS SPF events debugging is %s", onoffs);
if (flags & DEBUG_SPF_STATS)
vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
onoffs, VTY_NEWLINE);
vty_outln (vty, "IS-IS SPF Timing and Statistics Data debugging is %s",
onoffs);
if (flags & DEBUG_SPF_TRIGGERS)
vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS SPF triggering events debugging is %s",onoffs);
if (flags & DEBUG_UPDATE_PACKETS)
vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS Update related packet debugging is %s",onoffs);
if (flags & DEBUG_RTE_EVENTS)
vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
VTY_NEWLINE);
vty_outln (vty, "IS-IS Route related debuggin is %s",onoffs);
if (flags & DEBUG_EVENTS)
vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
vty_outln (vty, "IS-IS Event debugging is %s", onoffs);
if (flags & DEBUG_PACKET_DUMP)
vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
vty_outln (vty, "IS-IS Packet dump debugging is %s", onoffs);
if (flags & DEBUG_LSP_GEN)
vty_out (vty, "IS-IS LSP generation debugging is %s%s", onoffs, VTY_NEWLINE);
vty_outln (vty, "IS-IS LSP generation debugging is %s", onoffs);
if (flags & DEBUG_LSP_SCHED)
vty_out (vty, "IS-IS LSP scheduling debugging is %s%s", onoffs, VTY_NEWLINE);
vty_outln (vty, "IS-IS LSP scheduling debugging is %s", onoffs);
}
DEFUN (show_debugging,
@ -806,7 +796,7 @@ DEFUN (show_debugging,
ISIS_STR)
{
if (isis->debugs) {
vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
vty_outln (vty, "IS-IS:");
print_debug (vty, isis->debugs, 1);
}
return CMD_SUCCESS;
@ -827,72 +817,72 @@ config_write_debug (struct vty *vty)
if (flags & DEBUG_ADJ_PACKETS)
{
vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
vty_outln (vty, "debug isis adj-packets");
write++;
}
if (flags & DEBUG_CHECKSUM_ERRORS)
{
vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
vty_outln (vty, "debug isis checksum-errors");
write++;
}
if (flags & DEBUG_LOCAL_UPDATES)
{
vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
vty_outln (vty, "debug isis local-updates");
write++;
}
if (flags & DEBUG_PROTOCOL_ERRORS)
{
vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
vty_outln (vty, "debug isis protocol-errors");
write++;
}
if (flags & DEBUG_SNP_PACKETS)
{
vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
vty_outln (vty, "debug isis snp-packets");
write++;
}
if (flags & DEBUG_SPF_EVENTS)
{
vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
vty_outln (vty, "debug isis spf-events");
write++;
}
if (flags & DEBUG_SPF_STATS)
{
vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
vty_outln (vty, "debug isis spf-statistics");
write++;
}
if (flags & DEBUG_SPF_TRIGGERS)
{
vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
vty_outln (vty, "debug isis spf-triggers");
write++;
}
if (flags & DEBUG_UPDATE_PACKETS)
{
vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
vty_outln (vty, "debug isis update-packets");
write++;
}
if (flags & DEBUG_RTE_EVENTS)
{
vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
vty_outln (vty, "debug isis route-events");
write++;
}
if (flags & DEBUG_EVENTS)
{
vty_out (vty, "debug isis events%s", VTY_NEWLINE);
vty_outln (vty, "debug isis events");
write++;
}
if (flags & DEBUG_PACKET_DUMP)
{
vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
vty_outln (vty, "debug isis packet-dump");
write++;
}
if (flags & DEBUG_LSP_GEN)
{
vty_out (vty, "debug isis lsp-gen%s", VTY_NEWLINE);
vty_outln (vty, "debug isis lsp-gen");
write++;
}
if (flags & DEBUG_LSP_SCHED)
{
vty_out (vty, "debug isis lsp-sched%s", VTY_NEWLINE);
vty_outln (vty, "debug isis lsp-sched");
write++;
}
write += spf_backoff_write_config(vty);
@ -1322,7 +1312,7 @@ DEFUN (show_isis_spf_ietf,
{
if (!isis)
{
vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
vty_outln (vty, "ISIS is not running");
return CMD_SUCCESS;
}
@ -1331,33 +1321,31 @@ DEFUN (show_isis_spf_ietf,
for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
VTY_NEWLINE);
vty_outln (vty, "Area %s:",area->area_tag ? area->area_tag : "null");
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
{
if ((area->is_type & level) == 0)
continue;
vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
vty_outln (vty, " Level-%d:", level);
vty_out (vty, " SPF delay status: ");
if (area->spf_timer[level -1])
{
struct timeval remain = thread_timer_remain(area->spf_timer[level - 1]);
vty_out(vty, "Pending, due in %ld msec%s",
remain.tv_sec * 1000 + remain.tv_usec / 1000,
VTY_NEWLINE);
vty_outln (vty, "Pending, due in %ld msec",
remain.tv_sec * 1000 + remain.tv_usec / 1000);
}
else
{
vty_out(vty, "Not scheduled%s", VTY_NEWLINE);
vty_outln (vty, "Not scheduled");
}
if (area->spf_delay_ietf[level - 1]) {
vty_out(vty, " Using draft-ietf-rtgwg-backoff-algo-04%s", VTY_NEWLINE);
vty_outln (vty, " Using draft-ietf-rtgwg-backoff-algo-04");
spf_backoff_show(area->spf_delay_ietf[level - 1], vty, " ");
} else {
vty_out(vty, " Using legacy backoff algo%s", VTY_NEWLINE);
vty_outln (vty, " Using legacy backoff algo");
}
}
}
@ -1376,38 +1364,32 @@ DEFUN (show_isis_summary,
if (isis == NULL)
{
vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
vty_outln (vty, "ISIS is not running");
return CMD_SUCCESS;
}
vty_out (vty, "Process Id : %ld%s", isis->process_id,
VTY_NEWLINE);
vty_outln (vty, "Process Id : %ld",isis->process_id);
if (isis->sysid_set)
vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid),
VTY_NEWLINE);
vty_outln (vty, "System Id : %s",sysid_print(isis->sysid));
vty_out (vty, "Up time : ");
vty_out_timestr(vty, isis->uptime);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
if (isis->area_list)
vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
VTY_NEWLINE);
vty_outln (vty, "Number of areas : %d",isis->area_list->count);
for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
VTY_NEWLINE);
vty_outln (vty, "Area %s:",area->area_tag ? area->area_tag : "null");
if (listcount (area->area_addrs) > 0)
{
struct area_addr *area_addr;
for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
{
vty_out (vty, " Net: %s%s",
isonet_print (area_addr->area_addr,
area_addr->addr_len + ISIS_SYS_ID_LEN +
1), VTY_NEWLINE);
vty_outln (vty, " Net: %s",
isonet_print(area_addr->area_addr, area_addr->addr_len + ISIS_SYS_ID_LEN + 1));
}
}
@ -1416,45 +1398,45 @@ DEFUN (show_isis_summary,
if ((area->is_type & level) == 0)
continue;
vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
vty_outln (vty, " Level-%d:", level);
spftree = area->spftree[level - 1];
if (area->spf_timer[level - 1])
vty_out (vty, " SPF: (pending)%s", VTY_NEWLINE);
vty_outln (vty, " SPF: (pending)");
else
vty_out (vty, " SPF:%s", VTY_NEWLINE);
vty_outln (vty, " SPF:");
vty_out (vty, " minimum interval : %d",
area->min_spf_interval[level - 1]);
if (area->spf_delay_ietf[level - 1])
vty_out (vty, " (not used, IETF SPF delay activated)");
vty_out (vty, VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " IPv4 route computation:%s", VTY_NEWLINE);
vty_outln (vty, " IPv4 route computation:");
vty_out (vty, " last run elapsed : ");
vty_out_timestr(vty, spftree->last_run_timestamp);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " last run duration : %u usec%s",
(u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
vty_outln (vty, " last run duration : %u usec",
(u_int32_t)spftree->last_run_duration);
vty_out (vty, " run count : %d%s",
spftree->runcount, VTY_NEWLINE);
vty_outln (vty, " run count : %d",
spftree->runcount);
spftree = area->spftree6[level - 1];
vty_out (vty, " IPv6 route computation:%s", VTY_NEWLINE);
vty_outln (vty, " IPv6 route computation:");
vty_out (vty, " last run elapsed : ");
vty_out_timestr(vty, spftree->last_run_timestamp);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, " last run duration : %llu msec%s",
(unsigned long long)spftree->last_run_duration, VTY_NEWLINE);
vty_outln (vty, " last run duration : %llu msec",
(unsigned long long)spftree->last_run_duration);
vty_out (vty, " run count : %d%s",
spftree->runcount, VTY_NEWLINE);
vty_outln (vty, " run count : %d",
spftree->runcount);
}
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return CMD_SUCCESS;
}
@ -1526,8 +1508,7 @@ show_isis_database (struct vty *vty, const char *argv, int ui_level)
for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
VTY_NEWLINE);
vty_outln (vty, "Area %s:",area->area_tag ? area->area_tag : "null");
for (level = 0; level < ISIS_LEVELS; level++)
{
@ -1558,13 +1539,12 @@ show_isis_database (struct vty *vty, const char *argv, int ui_level)
if (lsp != NULL || argv == NULL)
{
vty_out (vty, "IS-IS Level-%d link-state database:%s",
level + 1, VTY_NEWLINE);
vty_outln (vty, "IS-IS Level-%d link-state database:",
level + 1);
/* print the title in all cases */
vty_out (vty, "LSP ID PduLen "
"SeqNumber Chksum Holdtime ATT/P/OL%s",
VTY_NEWLINE);
vty_outln (vty,
"LSP ID PduLen " "SeqNumber Chksum Holdtime ATT/P/OL");
}
if (lsp)
@ -1580,8 +1560,8 @@ show_isis_database (struct vty *vty, const char *argv, int ui_level)
ui_level,
area->dynhostname);
vty_out (vty, " %u LSPs%s%s",
lsp_count, VTY_NEWLINE, VTY_NEWLINE);
vty_outln (vty, " %u LSPs%s",
lsp_count, VTYNL);
}
}
}
@ -1672,18 +1652,19 @@ DEFUN (isis_topology,
if (area->oldmetric)
{
vty_out (vty, "Multi topology IS-IS can only be used with wide metrics%s", VTY_NEWLINE);
vty_outln (vty,
"Multi topology IS-IS can only be used with wide metrics");
return CMD_ERR_AMBIGUOUS;
}
if (mtid == (uint16_t)-1)
{
vty_out (vty, "Don't know topology '%s'%s", arg, VTY_NEWLINE);
vty_outln (vty, "Don't know topology '%s'", arg);
return CMD_ERR_AMBIGUOUS;
}
if (mtid == ISIS_MT_IPV4_UNICAST)
{
vty_out (vty, "Cannot configure IPv4 unicast topology%s", VTY_NEWLINE);
vty_outln (vty, "Cannot configure IPv4 unicast topology");
return CMD_ERR_AMBIGUOUS;
}
@ -1707,18 +1688,19 @@ DEFUN (no_isis_topology,
if (area->oldmetric)
{
vty_out (vty, "Multi topology IS-IS can only be used with wide metrics%s", VTY_NEWLINE);
vty_outln (vty,
"Multi topology IS-IS can only be used with wide metrics");
return CMD_ERR_AMBIGUOUS;
}
if (mtid == (uint16_t)-1)
{
vty_out (vty, "Don't know topology '%s'%s", arg, VTY_NEWLINE);
vty_outln (vty, "Don't know topology '%s'", arg);
return CMD_ERR_AMBIGUOUS;
}
if (mtid == ISIS_MT_IPV4_UNICAST)
{
vty_out (vty, "Cannot configure IPv4 unicast topology%s", VTY_NEWLINE);
vty_outln (vty, "Cannot configure IPv4 unicast topology");
return CMD_ERR_AMBIGUOUS;
}
@ -2008,7 +1990,7 @@ isis_config_write (struct vty *vty)
for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
{
/* ISIS - Area name */
vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
vty_outln (vty, "router isis %s", area->area_tag);
write++;
/* ISIS - Net */
if (listcount (area->area_addrs) > 0)
@ -2016,10 +1998,8 @@ isis_config_write (struct vty *vty)
struct area_addr *area_addr;
for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
{
vty_out (vty, " net %s%s",
isonet_print (area_addr->area_addr,
area_addr->addr_len + ISIS_SYS_ID_LEN +
1), VTY_NEWLINE);
vty_outln (vty, " net %s",
isonet_print(area_addr->area_addr, area_addr->addr_len + ISIS_SYS_ID_LEN + 1));
write++;
}
}
@ -2027,38 +2007,38 @@ isis_config_write (struct vty *vty)
* false. */
if (!area->dynhostname)
{
vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
vty_outln (vty, " no hostname dynamic");
write++;
}
/* ISIS - Metric-Style - when true displays wide */
if (area->newmetric)
{
if (!area->oldmetric)
vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
vty_outln (vty, " metric-style wide");
else
vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
vty_outln (vty, " metric-style transition");
write++;
}
else
{
vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
vty_outln (vty, " metric-style narrow");
write++;
}
/* ISIS - overload-bit */
if (area->overload_bit)
{
vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
vty_outln (vty, " set-overload-bit");
write++;
}
/* ISIS - Area is-type (level-1-2 is default) */
if (area->is_type == IS_LEVEL_1)
{
vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
vty_outln (vty, " is-type level-1");
write++;
}
else if (area->is_type == IS_LEVEL_2)
{
vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
vty_outln (vty, " is-type level-2-only");
write++;
}
write += isis_redist_config_write(vty, area, AF_INET);
@ -2068,8 +2048,8 @@ isis_config_write (struct vty *vty)
{
if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
{
vty_out (vty, " lsp-gen-interval %d%s",
area->lsp_gen_interval[0], VTY_NEWLINE);
vty_outln (vty, " lsp-gen-interval %d",
area->lsp_gen_interval[0]);
write++;
}
}
@ -2077,14 +2057,14 @@ isis_config_write (struct vty *vty)
{
if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
{
vty_out (vty, " lsp-gen-interval level-1 %d%s",
area->lsp_gen_interval[0], VTY_NEWLINE);
vty_outln (vty, " lsp-gen-interval level-1 %d",
area->lsp_gen_interval[0]);
write++;
}
if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
{
vty_out (vty, " lsp-gen-interval level-2 %d%s",
area->lsp_gen_interval[1], VTY_NEWLINE);
vty_outln (vty, " lsp-gen-interval level-2 %d",
area->lsp_gen_interval[1]);
write++;
}
}
@ -2093,8 +2073,8 @@ isis_config_write (struct vty *vty)
{
if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
{
vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
VTY_NEWLINE);
vty_outln (vty, " max-lsp-lifetime %u",
area->max_lsp_lifetime[0]);
write++;
}
}
@ -2102,14 +2082,14 @@ isis_config_write (struct vty *vty)
{
if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
{
vty_out (vty, " max-lsp-lifetime level-1 %u%s",
area->max_lsp_lifetime[0], VTY_NEWLINE);
vty_outln (vty, " max-lsp-lifetime level-1 %u",
area->max_lsp_lifetime[0]);
write++;
}
if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
{
vty_out (vty, " max-lsp-lifetime level-2 %u%s",
area->max_lsp_lifetime[1], VTY_NEWLINE);
vty_outln (vty, " max-lsp-lifetime level-2 %u",
area->max_lsp_lifetime[1]);
write++;
}
}
@ -2118,8 +2098,8 @@ isis_config_write (struct vty *vty)
{
if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
{
vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
VTY_NEWLINE);
vty_outln (vty, " lsp-refresh-interval %u",
area->lsp_refresh[0]);
write++;
}
}
@ -2127,20 +2107,20 @@ isis_config_write (struct vty *vty)
{
if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
{
vty_out (vty, " lsp-refresh-interval level-1 %u%s",
area->lsp_refresh[0], VTY_NEWLINE);
vty_outln (vty, " lsp-refresh-interval level-1 %u",
area->lsp_refresh[0]);
write++;
}
if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
{
vty_out (vty, " lsp-refresh-interval level-2 %u%s",
area->lsp_refresh[1], VTY_NEWLINE);
vty_outln (vty, " lsp-refresh-interval level-2 %u",
area->lsp_refresh[1]);
write++;
}
}
if (area->lsp_mtu != DEFAULT_LSP_MTU)
{
vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE);
vty_outln (vty, " lsp-mtu %u", area->lsp_mtu);
write++;
}
@ -2149,8 +2129,8 @@ isis_config_write (struct vty *vty)
{
if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
{
vty_out (vty, " spf-interval %d%s",
area->min_spf_interval[0], VTY_NEWLINE);
vty_outln (vty, " spf-interval %d",
area->min_spf_interval[0]);
write++;
}
}
@ -2158,14 +2138,14 @@ isis_config_write (struct vty *vty)
{
if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
{
vty_out (vty, " spf-interval level-1 %d%s",
area->min_spf_interval[0], VTY_NEWLINE);
vty_outln (vty, " spf-interval level-1 %d",
area->min_spf_interval[0]);
write++;
}
if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
{
vty_out (vty, " spf-interval level-2 %d%s",
area->min_spf_interval[1], VTY_NEWLINE);
vty_outln (vty, " spf-interval level-2 %d",
area->min_spf_interval[1]);
write++;
}
}
@ -2173,13 +2153,12 @@ isis_config_write (struct vty *vty)
/* IETF SPF interval */
if (area->spf_delay_ietf[0])
{
vty_out (vty, " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld%s",
vty_outln (vty, " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld",
spf_backoff_init_delay(area->spf_delay_ietf[0]),
spf_backoff_short_delay(area->spf_delay_ietf[0]),
spf_backoff_long_delay(area->spf_delay_ietf[0]),
spf_backoff_holddown(area->spf_delay_ietf[0]),
spf_backoff_timetolearn(area->spf_delay_ietf[0]),
VTY_NEWLINE);
spf_backoff_timetolearn(area->spf_delay_ietf[0]));
write++;
}
@ -2195,7 +2174,7 @@ isis_config_write (struct vty *vty)
else
vty_out(vty, "send-only");
}
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}
else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
@ -2209,7 +2188,7 @@ isis_config_write (struct vty *vty)
else
vty_out(vty, "send-only");
}
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}
if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
@ -2224,7 +2203,7 @@ isis_config_write (struct vty *vty)
else
vty_out(vty, "send-only");
}
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}
else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
@ -2239,13 +2218,13 @@ isis_config_write (struct vty *vty)
else
vty_out(vty, "send-only");
}
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
write++;
}
if (area->log_adj_changes)
{
vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
vty_outln (vty, " log-adjacency-changes");
write++;
}

View File

@ -109,17 +109,19 @@ adj_new(struct in_addr lsr_id, struct hello_source *source,
return (adj);
}
static void
adj_del_single(struct adj *adj)
void
adj_del(struct adj *adj, uint32_t notif_status)
{
struct nbr *nbr = adj->nbr;
log_debug("%s: lsr-id %s, %s (%s)", __func__, inet_ntoa(adj->lsr_id),
log_hello_src(&adj->source), af_name(adj_get_af(adj)));
adj_stop_itimer(adj);
RB_REMOVE(global_adj_head, &global.adj_tree, adj);
if (adj->nbr)
RB_REMOVE(nbr_adj_head, &adj->nbr->adj_tree, adj);
if (nbr)
RB_REMOVE(nbr_adj_head, &nbr->adj_tree, adj);
switch (adj->source.type) {
case HELLO_LINK:
RB_REMOVE(ia_adj_head, &adj->source.link.ia->adj_tree, adj);
@ -130,15 +132,6 @@ adj_del_single(struct adj *adj)
}
free(adj);
}
void
adj_del(struct adj *adj, uint32_t notif_status)
{
struct nbr *nbr = adj->nbr;
struct adj *atmp;
adj_del_single(adj);
/*
* If the neighbor still exists but none of its remaining
@ -146,8 +139,6 @@ adj_del(struct adj *adj, uint32_t notif_status)
* then delete it.
*/
if (nbr && nbr_adj_count(nbr, nbr->af) == 0) {
RB_FOREACH_SAFE(adj, nbr_adj_head, &nbr->adj_tree, atmp)
adj_del_single(adj);
session_shutdown(nbr, notif_status, 0, 0);
nbr_del(nbr);
}
@ -194,7 +185,6 @@ adj_itimer(struct thread *thread)
tnbr_del(leconf, adj->source.target);
return (0);
}
adj->source.target->adj = NULL;
}
adj_del(adj, S_HOLDTIME_EXP);

View File

@ -214,6 +214,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
__func__, inet_ntoa(lsr_id));
return;
}
ds_tlv = (tlvs_rcvd & F_HELLO_TLV_RCVD_DS) ? 1 : 0;
/* implicit transport address */
if (!(tlvs_rcvd & F_HELLO_TLV_RCVD_ADDR))
@ -291,11 +292,21 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
source.link.src_addr = *src;
}
debug_hello_recv("%s lsr-id %s transport-address %s holdtime %u%s",
log_hello_src(&source), inet_ntoa(lsr_id), log_addr(af, &trans_addr),
holdtime, (ds_tlv) ? " (dual stack TLV present)" : "");
adj = adj_find(lsr_id, &source);
if (adj && adj->ds_tlv != ds_tlv) {
/*
* Transient condition, ignore packet and wait until adjacency
* times out.
*/
return;
}
nbr = nbr_find_ldpid(lsr_id.s_addr);
/* check dual-stack tlv */
ds_tlv = (tlvs_rcvd & F_HELLO_TLV_RCVD_DS) ? 1 : 0;
if (ds_tlv && trans_pref != leconf->trans_pref) {
/*
* RFC 7552 - Section 6.1.1:
@ -420,10 +431,6 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
else
adj_stop_itimer(adj);
debug_hello_recv("%s lsr-id %s transport-address %s holdtime %u%s",
log_hello_src(&source), inet_ntoa(lsr_id), log_addr(af, &trans_addr),
holdtime, (ds_tlv) ? " (dual stack TLV present)" : "");
if (nbr && nbr->state == NBR_STA_PRESENT && !nbr_pending_idtimer(nbr) &&
nbr_session_active_role(nbr) && !nbr_pending_connect(nbr))
nbr_establish_connection(nbr);

View File

@ -131,7 +131,7 @@ lde(void)
ldpd_process = PROC_LDE_ENGINE;
log_procname = log_procnames[PROC_LDE_ENGINE];
master = thread_master_create();
master = thread_master_create(NULL);
/* setup signal handler */
signal_init(master, array_size(lde_signals), lde_signals);

View File

@ -105,33 +105,29 @@ ldp_vty_debug(struct vty *vty, int disable, const char *type_str,
int
ldp_vty_show_debugging(struct vty *vty)
{
vty_out(vty, "LDP debugging status:%s", VTY_NEWLINE);
vty_outln (vty, "LDP debugging status:");
if (LDP_DEBUG(hello, HELLO_RECV))
vty_out(vty, " LDP discovery debugging is on (inbound)%s",
VTY_NEWLINE);
vty_outln (vty," LDP discovery debugging is on (inbound)");
if (LDP_DEBUG(hello, HELLO_SEND))
vty_out(vty, " LDP discovery debugging is on (outbound)%s",
VTY_NEWLINE);
vty_outln (vty," LDP discovery debugging is on (outbound)");
if (LDP_DEBUG(errors, ERRORS))
vty_out(vty, " LDP errors debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " LDP errors debugging is on");
if (LDP_DEBUG(event, EVENT))
vty_out(vty, " LDP events debugging is on%s", VTY_NEWLINE);
vty_outln (vty, " LDP events debugging is on");
if (LDP_DEBUG(msg, MSG_RECV_ALL))
vty_out(vty, " LDP detailed messages debugging is on "
"(inbound)%s", VTY_NEWLINE);
vty_outln (vty,
" LDP detailed messages debugging is on " "(inbound)");
else if (LDP_DEBUG(msg, MSG_RECV))
vty_out(vty, " LDP messages debugging is on (inbound)%s",
VTY_NEWLINE);
vty_outln (vty," LDP messages debugging is on (inbound)");
if (LDP_DEBUG(msg, MSG_SEND_ALL))
vty_out(vty, " LDP detailed messages debugging is on "
"(outbound)%s", VTY_NEWLINE);
vty_outln (vty,
" LDP detailed messages debugging is on " "(outbound)");
else if (LDP_DEBUG(msg, MSG_SEND))
vty_out(vty, " LDP messages debugging is on (outbound)%s",
VTY_NEWLINE);
vty_outln (vty," LDP messages debugging is on (outbound)");
if (LDP_DEBUG(zebra, ZEBRA))
vty_out(vty, " LDP zebra debugging is on%s", VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE);
vty_outln (vty, " LDP zebra debugging is on");
vty_out (vty, VTYNL);
return (CMD_SUCCESS);
}
@ -142,45 +138,43 @@ ldp_debug_config_write(struct vty *vty)
int write = 0;
if (CONF_LDP_DEBUG(hello, HELLO_RECV)) {
vty_out(vty, "debug mpls ldp discovery hello recv%s",
VTY_NEWLINE);
vty_outln (vty,"debug mpls ldp discovery hello recv");
write = 1;
}
if (CONF_LDP_DEBUG(hello, HELLO_SEND)) {
vty_out(vty, "debug mpls ldp discovery hello sent%s",
VTY_NEWLINE);
vty_outln (vty,"debug mpls ldp discovery hello sent");
write = 1;
}
if (CONF_LDP_DEBUG(errors, ERRORS)) {
vty_out(vty, "debug mpls ldp errors%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp errors");
write = 1;
}
if (CONF_LDP_DEBUG(event, EVENT)) {
vty_out(vty, "debug mpls ldp event%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp event");
write = 1;
}
if (CONF_LDP_DEBUG(msg, MSG_RECV_ALL)) {
vty_out(vty, "debug mpls ldp messages recv all%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp messages recv all");
write = 1;
} else if (CONF_LDP_DEBUG(msg, MSG_RECV)) {
vty_out(vty, "debug mpls ldp messages recv%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp messages recv");
write = 1;
}
if (CONF_LDP_DEBUG(msg, MSG_SEND_ALL)) {
vty_out(vty, "debug mpls ldp messages sent all%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp messages sent all");
write = 1;
} else if (CONF_LDP_DEBUG(msg, MSG_SEND)) {
vty_out(vty, "debug mpls ldp messages sent%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp messages sent");
write = 1;
}
if (CONF_LDP_DEBUG(zebra, ZEBRA)) {
vty_out(vty, "debug mpls ldp zebra%s", VTY_NEWLINE);
vty_outln (vty, "debug mpls ldp zebra");
write = 1;
}

View File

@ -115,17 +115,17 @@ ldp_af_iface_config_write(struct vty *vty, int af)
if (!ia->enabled)
continue;
vty_out(vty, " !%s", VTY_NEWLINE);
vty_out(vty, " interface %s%s", iface->name, VTY_NEWLINE);
vty_outln (vty, " !");
vty_outln (vty, " interface %s", iface->name);
if (ia->hello_holdtime != LINK_DFLT_HOLDTIME &&
ia->hello_holdtime != 0)
vty_out(vty, " discovery hello holdtime %u%s",
ia->hello_holdtime, VTY_NEWLINE);
vty_outln (vty, " discovery hello holdtime %u",
ia->hello_holdtime);
if (ia->hello_interval != DEFAULT_HELLO_INTERVAL &&
ia->hello_interval != 0)
vty_out(vty, " discovery hello interval %u%s",
ia->hello_interval, VTY_NEWLINE);
vty_outln (vty, " discovery hello interval %u",
ia->hello_interval);
}
}
@ -138,41 +138,41 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf,
if (!(af_conf->flags & F_LDPD_AF_ENABLED))
return;
vty_out(vty, " !%s", VTY_NEWLINE);
vty_out(vty, " address-family %s%s", af_name(af), VTY_NEWLINE);
vty_outln (vty, " !");
vty_outln (vty, " address-family %s", af_name(af));
if (af_conf->lhello_holdtime != LINK_DFLT_HOLDTIME &&
af_conf->lhello_holdtime != 0 )
vty_out(vty, " discovery hello holdtime %u%s",
af_conf->lhello_holdtime, VTY_NEWLINE);
vty_outln (vty, " discovery hello holdtime %u",
af_conf->lhello_holdtime);
if (af_conf->lhello_interval != DEFAULT_HELLO_INTERVAL &&
af_conf->lhello_interval != 0)
vty_out(vty, " discovery hello interval %u%s",
af_conf->lhello_interval, VTY_NEWLINE);
vty_outln (vty, " discovery hello interval %u",
af_conf->lhello_interval);
if (af_conf->flags & F_LDPD_AF_THELLO_ACCEPT) {
vty_out(vty, " discovery targeted-hello accept");
if (af_conf->acl_thello_accept_from[0] != '\0')
vty_out(vty, " from %s",
af_conf->acl_thello_accept_from);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (af_conf->thello_holdtime != TARGETED_DFLT_HOLDTIME &&
af_conf->thello_holdtime != 0)
vty_out(vty, " discovery targeted-hello holdtime %u%s",
af_conf->thello_holdtime, VTY_NEWLINE);
vty_outln (vty, " discovery targeted-hello holdtime %u",
af_conf->thello_holdtime);
if (af_conf->thello_interval != DEFAULT_HELLO_INTERVAL &&
af_conf->thello_interval != 0)
vty_out(vty, " discovery targeted-hello interval %u%s",
af_conf->thello_interval, VTY_NEWLINE);
vty_outln (vty, " discovery targeted-hello interval %u",
af_conf->thello_interval);
if (ldp_addrisset(af, &af_conf->trans_addr))
vty_out(vty, " discovery transport-address %s%s",
log_addr(af, &af_conf->trans_addr), VTY_NEWLINE);
else
vty_out(vty, " ! Incomplete config, specify a discovery "
"transport-address%s", VTY_NEWLINE);
vty_outln (vty, " discovery transport-address %s",
log_addr(af, &af_conf->trans_addr));
else
vty_outln (vty,
" ! Incomplete config, specify a discovery " "transport-address");
if ((af_conf->flags & F_LDPD_AF_ALLOCHOSTONLY) ||
af_conf->acl_label_allocate_for[0] != '\0') {
@ -182,7 +182,7 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf,
else
vty_out(vty, " for %s",
af_conf->acl_label_allocate_for);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (af_conf->acl_label_advertise_for[0] != '\0' ||
@ -194,7 +194,7 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf,
if (af_conf->acl_label_advertise_for[0] != '\0')
vty_out(vty, " for %s",
af_conf->acl_label_advertise_for);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (af_conf->flags & F_LDPD_AF_EXPNULL) {
@ -202,7 +202,7 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf,
if (af_conf->acl_label_expnull_for[0] != '\0')
vty_out(vty, " for %s",
af_conf->acl_label_expnull_for);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (af_conf->acl_label_accept_for[0] != '\0' ||
@ -214,27 +214,26 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf,
if (af_conf->acl_label_accept_for[0] != '\0')
vty_out(vty, " for %s",
af_conf->acl_label_accept_for);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (af_conf->flags & F_LDPD_AF_NO_GTSM)
vty_out(vty, " ttl-security disable%s", VTY_NEWLINE);
vty_outln (vty, " ttl-security disable");
if (af_conf->keepalive != DEFAULT_KEEPALIVE)
vty_out(vty, " session holdtime %u%s", af_conf->keepalive,
VTY_NEWLINE);
vty_outln (vty, " session holdtime %u",af_conf->keepalive);
RB_FOREACH(tnbr, tnbr_head, &ldpd_conf->tnbr_tree) {
if (tnbr->af == af) {
vty_out(vty, " !%s", VTY_NEWLINE);
vty_out(vty, " neighbor %s targeted%s",
log_addr(tnbr->af, &tnbr->addr), VTY_NEWLINE);
vty_outln (vty, " !");
vty_outln (vty, " neighbor %s targeted",
log_addr(tnbr->af, &tnbr->addr));
}
}
ldp_af_iface_config_write(vty, af);
vty_out(vty, " !%s", VTY_NEWLINE);
vty_outln (vty, " !");
}
int
@ -245,64 +244,61 @@ ldp_config_write(struct vty *vty)
if (!(ldpd_conf->flags & F_LDPD_ENABLED))
return (0);
vty_out(vty, "mpls ldp%s", VTY_NEWLINE);
vty_outln (vty, "mpls ldp");
if (ldpd_conf->rtr_id.s_addr != 0)
vty_out(vty, " router-id %s%s",
inet_ntoa(ldpd_conf->rtr_id), VTY_NEWLINE);
vty_outln (vty, " router-id %s",
inet_ntoa(ldpd_conf->rtr_id));
if (ldpd_conf->lhello_holdtime != LINK_DFLT_HOLDTIME &&
ldpd_conf->lhello_holdtime != 0)
vty_out(vty, " discovery hello holdtime %u%s",
ldpd_conf->lhello_holdtime, VTY_NEWLINE);
vty_outln (vty, " discovery hello holdtime %u",
ldpd_conf->lhello_holdtime);
if (ldpd_conf->lhello_interval != DEFAULT_HELLO_INTERVAL &&
ldpd_conf->lhello_interval != 0)
vty_out(vty, " discovery hello interval %u%s",
ldpd_conf->lhello_interval, VTY_NEWLINE);
vty_outln (vty, " discovery hello interval %u",
ldpd_conf->lhello_interval);
if (ldpd_conf->thello_holdtime != TARGETED_DFLT_HOLDTIME &&
ldpd_conf->thello_holdtime != 0)
vty_out(vty, " discovery targeted-hello holdtime %u%s",
ldpd_conf->thello_holdtime, VTY_NEWLINE);
vty_outln (vty, " discovery targeted-hello holdtime %u",
ldpd_conf->thello_holdtime);
if (ldpd_conf->thello_interval != DEFAULT_HELLO_INTERVAL &&
ldpd_conf->thello_interval != 0)
vty_out(vty, " discovery targeted-hello interval %u%s",
ldpd_conf->thello_interval, VTY_NEWLINE);
vty_outln (vty, " discovery targeted-hello interval %u",
ldpd_conf->thello_interval);
if (ldpd_conf->trans_pref == DUAL_STACK_LDPOV4)
vty_out(vty, " dual-stack transport-connection prefer ipv4%s",
VTY_NEWLINE);
vty_outln (vty,
" dual-stack transport-connection prefer ipv4");
if (ldpd_conf->flags & F_LDPD_DS_CISCO_INTEROP)
vty_out(vty, " dual-stack cisco-interop%s", VTY_NEWLINE);
vty_outln (vty, " dual-stack cisco-interop");
RB_FOREACH(nbrp, nbrp_head, &ldpd_conf->nbrp_tree) {
if (nbrp->flags & F_NBRP_KEEPALIVE)
vty_out(vty, " neighbor %s session holdtime %u%s",
inet_ntoa(nbrp->lsr_id), nbrp->keepalive,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s session holdtime %u",
inet_ntoa(nbrp->lsr_id),nbrp->keepalive);
if (nbrp->flags & F_NBRP_GTSM) {
if (nbrp->gtsm_enabled)
vty_out(vty, " neighbor %s ttl-security hops "
"%u%s", inet_ntoa(nbrp->lsr_id),
nbrp->gtsm_hops, VTY_NEWLINE);
vty_outln (vty, " neighbor %s ttl-security hops "
"%u", inet_ntoa(nbrp->lsr_id),
nbrp->gtsm_hops);
else
vty_out(vty, " neighbor %s ttl-security "
"disable%s", inet_ntoa(nbrp->lsr_id),
VTY_NEWLINE);
vty_outln (vty, " neighbor %s ttl-security "
"disable",inet_ntoa(nbrp->lsr_id));
}
if (nbrp->auth.method == AUTH_MD5SIG)
vty_out(vty, " neighbor %s password %s%s",
inet_ntoa(nbrp->lsr_id), nbrp->auth.md5key,
VTY_NEWLINE);
vty_outln (vty, " neighbor %s password %s",
inet_ntoa(nbrp->lsr_id),nbrp->auth.md5key);
}
ldp_af_config_write(vty, AF_INET, ldpd_conf, &ldpd_conf->ipv4);
ldp_af_config_write(vty, AF_INET6, ldpd_conf, &ldpd_conf->ipv6);
vty_out(vty, " !%s", VTY_NEWLINE);
vty_out(vty, "!%s", VTY_NEWLINE);
vty_outln (vty, " !");
vty_outln (vty, "!");
return (1);
}
@ -313,36 +309,34 @@ ldp_l2vpn_pw_config_write(struct vty *vty, struct l2vpn_pw *pw)
int missing_lsrid = 0;
int missing_pwid = 0;
vty_out(vty, " !%s", VTY_NEWLINE);
vty_out(vty, " member pseudowire %s%s", pw->ifname, VTY_NEWLINE);
vty_outln (vty, " !");
vty_outln (vty, " member pseudowire %s", pw->ifname);
if (pw->lsr_id.s_addr != INADDR_ANY)
vty_out(vty, " neighbor lsr-id %s%s", inet_ntoa(pw->lsr_id),
VTY_NEWLINE);
else
missing_lsrid = 1;
vty_outln (vty, " neighbor lsr-id %s",inet_ntoa(pw->lsr_id));
else
missing_lsrid = 1;
if (pw->flags & F_PW_STATIC_NBR_ADDR)
vty_out(vty, " neighbor address %s%s", log_addr(pw->af,
&pw->addr), VTY_NEWLINE);
vty_outln (vty, " neighbor address %s",
log_addr(pw->af, &pw->addr));
if (pw->pwid != 0)
vty_out(vty, " pw-id %u%s", pw->pwid, VTY_NEWLINE);
vty_outln (vty, " pw-id %u", pw->pwid);
else
missing_pwid = 1;
if (!(pw->flags & F_PW_CWORD_CONF))
vty_out(vty, " control-word exclude%s", VTY_NEWLINE);
vty_outln (vty, " control-word exclude");
if (!(pw->flags & F_PW_STATUSTLV_CONF))
vty_out(vty, " pw-status disable%s", VTY_NEWLINE);
vty_outln (vty, " pw-status disable");
if (missing_lsrid)
vty_out(vty, " ! Incomplete config, specify a neighbor "
"lsr-id%s", VTY_NEWLINE);
vty_outln (vty,
" ! Incomplete config, specify a neighbor " "lsr-id");
if (missing_pwid)
vty_out(vty, " ! Incomplete config, specify a pw-id%s",
VTY_NEWLINE);
vty_outln (vty," ! Incomplete config, specify a pw-id");
}
int
@ -353,29 +347,27 @@ ldp_l2vpn_config_write(struct vty *vty)
struct l2vpn_pw *pw;
RB_FOREACH(l2vpn, l2vpn_head, &ldpd_conf->l2vpn_tree) {
vty_out(vty, "l2vpn %s type vpls%s", l2vpn->name, VTY_NEWLINE);
vty_outln (vty, "l2vpn %s type vpls", l2vpn->name);
if (l2vpn->pw_type != DEFAULT_PW_TYPE)
vty_out(vty, " vc type ethernet-tagged%s", VTY_NEWLINE);
vty_outln (vty, " vc type ethernet-tagged");
if (l2vpn->mtu != DEFAULT_L2VPN_MTU)
vty_out(vty, " mtu %u%s", l2vpn->mtu, VTY_NEWLINE);
vty_outln (vty, " mtu %u", l2vpn->mtu);
if (l2vpn->br_ifname[0] != '\0')
vty_out(vty, " bridge %s%s", l2vpn->br_ifname,
VTY_NEWLINE);
vty_outln (vty, " bridge %s",l2vpn->br_ifname);
RB_FOREACH(lif, l2vpn_if_head, &l2vpn->if_tree)
vty_out(vty, " member interface %s%s", lif->ifname,
VTY_NEWLINE);
vty_outln (vty, " member interface %s",lif->ifname);
RB_FOREACH(pw, l2vpn_pw_head, &l2vpn->pw_tree)
ldp_l2vpn_pw_config_write(vty, pw);
RB_FOREACH(pw, l2vpn_pw_head, &l2vpn->pw_inactive_tree)
ldp_l2vpn_pw_config_write(vty, pw);
vty_out(vty, " !%s", VTY_NEWLINE);
vty_out(vty, "!%s", VTY_NEWLINE);
vty_outln (vty, " !");
vty_outln (vty, "!");
}
return (0);
@ -481,7 +473,7 @@ ldp_vty_disc_holdtime(struct vty *vty, int disable, const char *hello_type_str,
secs = strtol(seconds_str, &ep, 10);
if (*ep != '\0' || secs < MIN_HOLDTIME || secs > MAX_HOLDTIME) {
vty_out(vty, "%% Invalid holdtime%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid holdtime");
return (CMD_WARNING);
}
@ -576,7 +568,7 @@ ldp_vty_disc_interval(struct vty *vty, int disable, const char *hello_type_str,
secs = strtol(seconds_str, &ep, 10);
if (*ep != '\0' || secs < MIN_HELLO_INTERVAL ||
secs > MAX_HELLO_INTERVAL) {
vty_out(vty, "%% Invalid interval%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid interval");
return (CMD_WARNING);
}
@ -694,13 +686,13 @@ ldp_vty_nbr_session_holdtime(struct vty *vty, int disable,
if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
bad_addr_v4(lsr_id)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}
secs = strtol(seconds_str, &ep, 10);
if (*ep != '\0' || secs < MIN_KEEPALIVE || secs > MAX_KEEPALIVE) {
vty_out(vty, "%% Invalid holdtime%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid holdtime");
return (CMD_SUCCESS);
}
@ -740,7 +732,7 @@ ldp_vty_af_session_holdtime(struct vty *vty, int disable,
secs = strtol(seconds_str, &ep, 10);
if (*ep != '\0' || secs < MIN_KEEPALIVE || secs > MAX_KEEPALIVE) {
vty_out(vty, "%% Invalid holdtime%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid holdtime");
return (CMD_SUCCESS);
}
@ -786,8 +778,7 @@ ldp_vty_interface(struct vty *vty, int disable, const char *ifname)
if (iface == NULL) {
if (ldp_iface_is_configured(vty_conf, ifname)) {
vty_out(vty, "%% Interface is already in use%s",
VTY_NEWLINE);
vty_outln (vty,"%% Interface is already in use");
return (CMD_SUCCESS);
}
@ -834,7 +825,7 @@ ldp_vty_trans_addr(struct vty *vty, int disable, const char *addr_str)
else {
if (inet_pton(af, addr_str, &af_conf->trans_addr) != 1 ||
bad_addr(af, &af_conf->trans_addr)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_SUCCESS);
}
}
@ -855,11 +846,11 @@ ldp_vty_neighbor_targeted(struct vty *vty, int disable, const char *addr_str)
if (inet_pton(af, addr_str, &addr) != 1 ||
bad_addr(af, &addr)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}
if (af == AF_INET6 && IN6_IS_SCOPE_EMBED(&addr.v6)) {
vty_out(vty, "%% Address can not be link-local%s", VTY_NEWLINE);
vty_outln (vty, "%% Address can not be link-local");
return (CMD_WARNING);
}
@ -1031,7 +1022,7 @@ ldp_vty_router_id(struct vty *vty, int disable, const char *addr_str)
else {
if (inet_pton(AF_INET, addr_str, &vty_conf->rtr_id) != 1 ||
bad_addr_v4(vty_conf->rtr_id)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_SUCCESS);
}
}
@ -1077,7 +1068,7 @@ ldp_vty_neighbor_password(struct vty *vty, int disable, const char *lsr_id_str,
if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
bad_addr_v4(lsr_id)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}
@ -1123,14 +1114,14 @@ ldp_vty_neighbor_ttl_security(struct vty *vty, int disable,
if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
bad_addr_v4(lsr_id)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}
if (hops_str) {
hops = strtol(hops_str, &ep, 10);
if (*ep != '\0' || hops < 1 || hops > 254) {
vty_out(vty, "%% Invalid hop count%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid hop count");
return (CMD_SUCCESS);
}
}
@ -1235,7 +1226,7 @@ ldp_vty_l2vpn_mtu(struct vty *vty, int disable, const char *mtu_str)
mtu = strtol(mtu_str, &ep, 10);
if (*ep != '\0' || mtu < MIN_L2VPN_MTU || mtu > MAX_L2VPN_MTU) {
vty_out(vty, "%% Invalid MTU%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid MTU");
return (CMD_WARNING);
}
@ -1295,7 +1286,7 @@ ldp_vty_l2vpn_interface(struct vty *vty, int disable, const char *ifname)
return (CMD_SUCCESS);
if (ldp_iface_is_configured(vty_conf, ifname)) {
vty_out(vty, "%% Interface is already in use%s", VTY_NEWLINE);
vty_outln (vty, "%% Interface is already in use");
return (CMD_SUCCESS);
}
@ -1338,7 +1329,7 @@ ldp_vty_l2vpn_pseudowire(struct vty *vty, int disable, const char *ifname)
}
if (ldp_iface_is_configured(vty_conf, ifname)) {
vty_out(vty, "%% Interface is already in use%s", VTY_NEWLINE);
vty_outln (vty, "%% Interface is already in use");
return (CMD_SUCCESS);
}
@ -1382,7 +1373,7 @@ ldp_vty_l2vpn_pw_nbr_addr(struct vty *vty, int disable, const char *addr_str)
if (ldp_get_address(addr_str, &af, &addr) == -1 ||
bad_addr(af, &addr)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}
@ -1409,7 +1400,7 @@ ldp_vty_l2vpn_pw_nbr_id(struct vty *vty, int disable, const char *lsr_id_str)
if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
bad_addr_v4(lsr_id)) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}
@ -1432,7 +1423,7 @@ ldp_vty_l2vpn_pw_pwid(struct vty *vty, int disable, const char *pwid_str)
pwid = strtol(pwid_str, &ep, 10);
if (*ep != '\0' || pwid < MIN_PWID_ID || pwid > MAX_PWID_ID) {
vty_out(vty, "%% Invalid pw-id%s", VTY_NEWLINE);
vty_outln (vty, "%% Invalid pw-id");
return (CMD_WARNING);
}

View File

@ -128,14 +128,14 @@ show_interface_msg(struct vty *vty, struct imsg *imsg,
snprintf(timers, sizeof(timers), "%u/%u",
iface->hello_interval, iface->hello_holdtime);
vty_out(vty, "%-4s %-11s %-6s %-8s %-12s %3u%s",
vty_outln (vty, "%-4s %-11s %-6s %-8s %-12s %3u",
af_name(iface->af), iface->name,
if_state_name(iface->state), iface->uptime == 0 ?
"00:00:00" : log_time(iface->uptime), timers,
iface->adj_cnt, VTY_NEWLINE);
iface->adj_cnt);
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -211,13 +211,13 @@ show_discovery_msg(struct vty *vty, struct imsg *imsg,
vty_out(vty, "%-8s %-15s ", "Targeted", addr);
if (strlen(addr) > 15)
vty_out(vty, "%s%46s", VTY_NEWLINE, " ");
vty_out(vty, "%s%46s", VTYNL, " ");
break;
}
vty_out(vty, "%9u%s", adj->holdtime, VTY_NEWLINE);
vty_outln (vty, "%9u", adj->holdtime);
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -232,23 +232,23 @@ show_discovery_detail_adj(struct vty *vty, char *buffer, struct ctl_adj *adj)
size_t buflen = strlen(buffer);
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" LSR Id: %s:0%s", inet_ntoa(adj->id), VTY_NEWLINE);
" LSR Id: %s:0%s", inet_ntoa(adj->id), VTYNL);
buflen = strlen(buffer);
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" Source address: %s%s",
log_addr(adj->af, &adj->src_addr), VTY_NEWLINE);
log_addr(adj->af, &adj->src_addr), VTYNL);
buflen = strlen(buffer);
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" Transport address: %s%s",
log_addr(adj->af, &adj->trans_addr), VTY_NEWLINE);
log_addr(adj->af, &adj->trans_addr), VTYNL);
buflen = strlen(buffer);
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" Hello hold time: %u secs (due in %u secs)%s",
adj->holdtime, adj->holdtime_remaining, VTY_NEWLINE);
adj->holdtime, adj->holdtime_remaining, VTYNL);
buflen = strlen(buffer);
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" Dual-stack capability TLV: %s%s",
(adj->ds_tlv) ? "yes" : "no", VTY_NEWLINE);
(adj->ds_tlv) ? "yes" : "no", VTYNL);
}
static int
@ -280,7 +280,7 @@ show_discovery_detail_msg(struct vty *vty, struct imsg *imsg,
buflen = strlen(ifaces_buffer);
snprintf(ifaces_buffer + buflen, LDPBUFSIZ - buflen,
" %s: %s%s", iface->name, (iface->no_adj) ?
"(no adjacencies)" : "", VTY_NEWLINE);
"(no adjacencies)" : "", VTYNL);
break;
case IMSG_CTL_SHOW_DISC_TNBR:
tnbr = imsg->data;
@ -294,7 +294,7 @@ show_discovery_detail_msg(struct vty *vty, struct imsg *imsg,
snprintf(tnbrs_buffer + buflen, LDPBUFSIZ - buflen,
" %s -> %s: %s%s", log_addr(tnbr->af, trans_addr),
log_addr(tnbr->af, &tnbr->addr), (tnbr->no_adj) ?
"(no adjacencies)" : "", VTY_NEWLINE);
"(no adjacencies)" : "", VTYNL);
break;
case IMSG_CTL_SHOW_DISC_ADJ:
adj = imsg->data;
@ -313,23 +313,20 @@ show_discovery_detail_msg(struct vty *vty, struct imsg *imsg,
break;
case IMSG_CTL_END:
rtr_id.s_addr = ldp_rtr_id_get(ldpd_conf);
vty_out(vty, "Local:%s", VTY_NEWLINE);
vty_out(vty, " LSR Id: %s:0%s", inet_ntoa(rtr_id),
VTY_NEWLINE);
vty_outln (vty, "Local:");
vty_outln (vty, " LSR Id: %s:0",inet_ntoa(rtr_id));
if (ldpd_conf->ipv4.flags & F_LDPD_AF_ENABLED)
vty_out(vty, " Transport Address (IPv4): %s%s",
log_addr(AF_INET, &ldpd_conf->ipv4.trans_addr),
VTY_NEWLINE);
vty_outln (vty, " Transport Address (IPv4): %s",
log_addr(AF_INET, &ldpd_conf->ipv4.trans_addr));
if (ldpd_conf->ipv6.flags & F_LDPD_AF_ENABLED)
vty_out(vty, " Transport Address (IPv6): %s%s",
log_addr(AF_INET6, &ldpd_conf->ipv6.trans_addr),
VTY_NEWLINE);
vty_out(vty, "Discovery Sources:%s", VTY_NEWLINE);
vty_out(vty, " Interfaces:%s", VTY_NEWLINE);
vty_outln (vty, " Transport Address (IPv6): %s",
log_addr(AF_INET6, &ldpd_conf->ipv6.trans_addr));
vty_outln (vty, "Discovery Sources:");
vty_outln (vty, " Interfaces:");
vty_out(vty, "%s", ifaces_buffer);
vty_out(vty, " Targeted Hellos:%s", VTY_NEWLINE);
vty_outln (vty, " Targeted Hellos:");
vty_out(vty, "%s", tnbrs_buffer);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -514,8 +511,8 @@ show_nbr_msg(struct vty *vty, struct imsg *imsg, struct show_params *params)
af_name(nbr->af), inet_ntoa(nbr->id),
nbr_state_name(nbr->nbr_state), addr);
if (strlen(addr) > 15)
vty_out(vty, "%s%48s", VTY_NEWLINE, " ");
vty_out(vty, " %8s%s", log_time(nbr->uptime), VTY_NEWLINE);
vty_out(vty, "%s%48s", VTYNL, " ");
vty_outln (vty, " %8s", log_time(nbr->uptime));
break;
case IMSG_CTL_END:
return (1);
@ -534,12 +531,12 @@ show_nbr_detail_adj(struct vty *vty, char *buffer, struct ctl_adj *adj)
switch (adj->type) {
case HELLO_LINK:
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" Interface: %s%s", adj->ifname, VTY_NEWLINE);
" Interface: %s%s", adj->ifname, VTYNL);
break;
case HELLO_TARGETED:
snprintf(buffer + buflen, LDPBUFSIZ - buflen,
" Targeted Hello: %s%s", log_addr(adj->af,
&adj->src_addr), VTY_NEWLINE);
&adj->src_addr), VTYNL);
break;
}
}
@ -560,45 +557,42 @@ show_nbr_detail_msg(struct vty *vty, struct imsg *imsg,
v4adjs_buffer[0] = '\0';
v6adjs_buffer[0] = '\0';
vty_out(vty, "Peer LDP Identifier: %s:0%s", inet_ntoa(nbr->id),
VTY_NEWLINE);
vty_out(vty, " TCP connection: %s:%u - %s:%u%s",
vty_outln (vty, "Peer LDP Identifier: %s:0",
inet_ntoa(nbr->id));
vty_outln (vty, " TCP connection: %s:%u - %s:%u",
log_addr(nbr->af, &nbr->laddr), ntohs(nbr->lport),
log_addr(nbr->af, &nbr->raddr), ntohs(nbr->rport),
VTY_NEWLINE);
vty_out(vty, " Authentication: %s%s",
(nbr->auth_method == AUTH_MD5SIG) ? "TCP MD5 Signature" :
"none", VTY_NEWLINE);
vty_out(vty, " Session Holdtime: %u secs; "
"KeepAlive interval: %u secs%s", nbr->holdtime,
nbr->holdtime / KEEPALIVE_PER_PERIOD, VTY_NEWLINE);
vty_out(vty, " State: %s; Downstream-Unsolicited%s",
nbr_state_name(nbr->nbr_state), VTY_NEWLINE);
vty_out(vty, " Up time: %s%s", log_time(nbr->uptime),
VTY_NEWLINE);
log_addr(nbr->af, &nbr->raddr),ntohs(nbr->rport));
vty_outln (vty, " Authentication: %s",
(nbr->auth_method == AUTH_MD5SIG) ? "TCP MD5 Signature" : "none");
vty_outln(vty, " Session Holdtime: %u secs; "
"KeepAlive interval: %u secs", nbr->holdtime,
nbr->holdtime / KEEPALIVE_PER_PERIOD);
vty_outln(vty, " State: %s; Downstream-Unsolicited",
nbr_state_name(nbr->nbr_state));
vty_outln (vty, " Up time: %s",log_time(nbr->uptime));
stats = &nbr->stats;
vty_out(vty, " Messages sent/rcvd:%s", VTY_NEWLINE);
vty_out(vty, " - Keepalive Messages: %u/%u%s",
stats->kalive_sent, stats->kalive_rcvd, VTY_NEWLINE);
vty_out(vty, " - Address Messages: %u/%u%s",
stats->addr_sent, stats->addr_rcvd, VTY_NEWLINE);
vty_out(vty, " - Address Withdraw Messages: %u/%u%s",
stats->addrwdraw_sent, stats->addrwdraw_rcvd, VTY_NEWLINE);
vty_out(vty, " - Notification Messages: %u/%u%s",
stats->notif_sent, stats->notif_rcvd, VTY_NEWLINE);
vty_out(vty, " - Capability Messages: %u/%u%s",
stats->capability_sent, stats->capability_rcvd, VTY_NEWLINE);
vty_out(vty, " - Label Mapping Messages: %u/%u%s",
stats->labelmap_sent, stats->labelmap_rcvd, VTY_NEWLINE);
vty_out(vty, " - Label Request Messages: %u/%u%s",
stats->labelreq_sent, stats->labelreq_rcvd, VTY_NEWLINE);
vty_out(vty, " - Label Withdraw Messages: %u/%u%s",
stats->labelwdraw_sent, stats->labelwdraw_rcvd, VTY_NEWLINE);
vty_out(vty, " - Label Release Messages: %u/%u%s",
stats->labelrel_sent, stats->labelrel_rcvd, VTY_NEWLINE);
vty_out(vty, " - Label Abort Request Messages: %u/%u%s",
stats->labelabreq_sent, stats->labelabreq_rcvd, VTY_NEWLINE);
vty_outln (vty, " Messages sent/rcvd:");
vty_outln (vty, " - Keepalive Messages: %u/%u",
stats->kalive_sent, stats->kalive_rcvd);
vty_outln (vty, " - Address Messages: %u/%u",
stats->addr_sent, stats->addr_rcvd);
vty_outln (vty, " - Address Withdraw Messages: %u/%u",
stats->addrwdraw_sent, stats->addrwdraw_rcvd);
vty_outln (vty, " - Notification Messages: %u/%u",
stats->notif_sent, stats->notif_rcvd);
vty_outln (vty, " - Capability Messages: %u/%u",
stats->capability_sent, stats->capability_rcvd);
vty_outln (vty, " - Label Mapping Messages: %u/%u",
stats->labelmap_sent, stats->labelmap_rcvd);
vty_outln (vty, " - Label Request Messages: %u/%u",
stats->labelreq_sent, stats->labelreq_rcvd);
vty_outln (vty, " - Label Withdraw Messages: %u/%u",
stats->labelwdraw_sent, stats->labelwdraw_rcvd);
vty_outln (vty, " - Label Release Messages: %u/%u",
stats->labelrel_sent, stats->labelrel_rcvd);
vty_outln (vty, " - Label Abort Request Messages: %u/%u",
stats->labelabreq_sent, stats->labelabreq_rcvd);
show_nbr_capabilities(vty, nbr);
break;
@ -617,16 +611,16 @@ show_nbr_detail_msg(struct vty *vty, struct imsg *imsg,
}
break;
case IMSG_CTL_SHOW_NBR_END:
vty_out(vty, " LDP Discovery Sources:%s", VTY_NEWLINE);
vty_outln (vty, " LDP Discovery Sources:");
if (v4adjs_buffer[0] != '\0') {
vty_out(vty, " IPv4:%s", VTY_NEWLINE);
vty_outln (vty, " IPv4:");
vty_out(vty, "%s", v4adjs_buffer);
}
if (v6adjs_buffer[0] != '\0') {
vty_out(vty, " IPv6:%s", VTY_NEWLINE);
vty_outln (vty, " IPv6:");
vty_out(vty, "%s", v6adjs_buffer);
}
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
break;
case IMSG_CTL_END:
return (1);
@ -875,20 +869,18 @@ show_nbr_detail_msg_json(struct imsg *imsg, struct show_params *params,
void
show_nbr_capabilities(struct vty *vty, struct ctl_nbr *nbr)
{
vty_out(vty, " Capabilities Sent:%s"
vty_outln (vty, " Capabilities Sent:%s"
" - Dynamic Announcement (0x0506)%s"
" - Typed Wildcard (0x050B)%s"
" - Unrecognized Notification (0x0603)%s",
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
vty_out(vty, " Capabilities Received:%s", VTY_NEWLINE);
" - Unrecognized Notification (0x0603)",
VTYNL, VTYNL, VTYNL);
vty_outln (vty, " Capabilities Received:");
if (nbr->flags & F_NBR_CAP_DYNAMIC)
vty_out(vty, " - Dynamic Announcement (0x0506)%s",
VTY_NEWLINE);
vty_outln (vty," - Dynamic Announcement (0x0506)");
if (nbr->flags & F_NBR_CAP_TWCARD)
vty_out(vty, " - Typed Wildcard (0x050B)%s", VTY_NEWLINE);
vty_outln (vty, " - Typed Wildcard (0x050B)");
if (nbr->flags & F_NBR_CAP_UNOTIF)
vty_out(vty, " - Unrecognized Notification (0x0603)%s",
VTY_NEWLINE);
vty_outln (vty," - Unrecognized Notification (0x0603)");
}
static int
@ -903,13 +895,13 @@ show_nbr_capabilities_msg(struct vty *vty, struct imsg *imsg, struct show_params
if (nbr->nbr_state != NBR_STA_OPER)
break;
vty_out(vty, "Peer LDP Identifier: %s:0%s", inet_ntoa(nbr->id),
VTY_NEWLINE);
vty_outln (vty, "Peer LDP Identifier: %s:0",
inet_ntoa(nbr->id));
show_nbr_capabilities(vty, nbr);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -1029,13 +1021,13 @@ show_lib_msg(struct vty *vty, struct imsg *imsg, struct show_params *params)
vty_out(vty, "%-4s %-20s", af_name(rt->af), dstnet);
if (strlen(dstnet) > 20)
vty_out(vty, "%s%25s", VTY_NEWLINE, " ");
vty_out(vty, " %-15s %-11s %-13s %6s%s", inet_ntoa(rt->nexthop),
vty_out(vty, "%s%25s", VTYNL, " ");
vty_outln (vty, " %-15s %-11s %-13s %6s", inet_ntoa(rt->nexthop),
log_label(rt->local_label), log_label(rt->remote_label),
rt->in_use ? "yes" : "no", VTY_NEWLINE);
rt->in_use ? "yes" : "no");
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -1077,15 +1069,15 @@ show_lib_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *para
snprintf(dstnet, sizeof(dstnet), "%s/%d",
log_addr(rt->af, &rt->prefix), rt->prefixlen);
vty_out(vty, "%s%s", dstnet, VTY_NEWLINE);
vty_out(vty, "%-8sLocal binding: label: %s%s", "",
log_label(rt->local_label), VTY_NEWLINE);
vty_outln (vty, "%s", dstnet);
vty_outln (vty, "%-8sLocal binding: label: %s", "",
log_label(rt->local_label));
break;
case IMSG_CTL_SHOW_LIB_SENT:
upstream = 1;
buflen = strlen(sent_buffer);
snprintf(sent_buffer + buflen, LDPBUFSIZ - buflen,
"%12s%s:0%s", "", inet_ntoa(rt->nexthop), VTY_NEWLINE);
"%12s%s:0%s", "", inet_ntoa(rt->nexthop), VTYNL);
break;
case IMSG_CTL_SHOW_LIB_RCVD:
downstream = 1;
@ -1093,22 +1085,21 @@ show_lib_detail_msg(struct vty *vty, struct imsg *imsg, struct show_params *para
snprintf(rcvd_buffer + buflen, LDPBUFSIZ - buflen,
"%12s%s:0, label %s%s%s", "", inet_ntoa(rt->nexthop),
log_label(rt->remote_label),
rt->in_use ? " (in use)" : "", VTY_NEWLINE);
rt->in_use ? " (in use)" : "", VTYNL);
break;
case IMSG_CTL_SHOW_LIB_END:
if (upstream) {
vty_out(vty, "%-8sAdvertised to:%s", "", VTY_NEWLINE);
vty_outln (vty, "%-8sAdvertised to:", "");
vty_out(vty, "%s", sent_buffer);
}
if (downstream) {
vty_out(vty, "%-8sRemote bindings:%s", "", VTY_NEWLINE);
vty_outln (vty, "%-8sRemote bindings:", "");
vty_out(vty, "%s", rcvd_buffer);
} else
vty_out(vty, "%-8sNo remote bindings%s", "",
VTY_NEWLINE);
vty_outln (vty, "%-8sNo remote bindings","");
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -1244,39 +1235,33 @@ show_l2vpn_binding_msg(struct vty *vty, struct imsg *imsg,
case IMSG_CTL_SHOW_L2VPN_BINDING:
pw = imsg->data;
vty_out(vty, " Destination Address: %s, VC ID: %u%s",
inet_ntoa(pw->lsr_id), pw->pwid, VTY_NEWLINE);
vty_outln (vty, " Destination Address: %s, VC ID: %u",
inet_ntoa(pw->lsr_id), pw->pwid);
/* local binding */
if (pw->local_label != NO_LABEL) {
vty_out(vty, " Local Label: %u%s", pw->local_label,
VTY_NEWLINE);
vty_out(vty, "%-8sCbit: %u, VC Type: %s, "
"GroupID: %u%s", "", pw->local_cword,
pw_type_name(pw->type), pw->local_gid,
VTY_NEWLINE);
vty_out(vty, "%-8sMTU: %u%s", "", pw->local_ifmtu,
VTY_NEWLINE);
vty_outln (vty, " Local Label: %u",
pw->local_label);
vty_outln (vty, "%-8sCbit: %u, VC Type: %s, "
"GroupID: %u", "", pw->local_cword,
pw_type_name(pw->type),pw->local_gid);
vty_outln (vty, "%-8sMTU: %u", "",pw->local_ifmtu);
} else
vty_out(vty, " Local Label: unassigned%s",
VTY_NEWLINE);
vty_outln (vty," Local Label: unassigned");
/* remote binding */
if (pw->remote_label != NO_LABEL) {
vty_out(vty, " Remote Label: %u%s",
pw->remote_label, VTY_NEWLINE);
vty_out(vty, "%-8sCbit: %u, VC Type: %s, "
"GroupID: %u%s", "", pw->remote_cword,
pw_type_name(pw->type), pw->remote_gid,
VTY_NEWLINE);
vty_out(vty, "%-8sMTU: %u%s", "", pw->remote_ifmtu,
VTY_NEWLINE);
vty_outln (vty, " Remote Label: %u",
pw->remote_label);
vty_outln (vty, "%-8sCbit: %u, VC Type: %s, "
"GroupID: %u", "", pw->remote_cword,
pw_type_name(pw->type),pw->remote_gid);
vty_outln (vty, "%-8sMTU: %u", "",pw->remote_ifmtu);
} else
vty_out(vty, " Remote Label: unassigned%s",
VTY_NEWLINE);
vty_outln (vty," Remote Label: unassigned");
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -1355,12 +1340,12 @@ show_l2vpn_pw_msg(struct vty *vty, struct imsg *imsg, struct show_params *params
case IMSG_CTL_SHOW_L2VPN_PW:
pw = imsg->data;
vty_out(vty, "%-9s %-15s %-10u %-16s %-10s%s", pw->ifname,
vty_outln (vty, "%-9s %-15s %-10u %-16s %-10s", pw->ifname,
inet_ntoa(pw->lsr_id), pw->pwid, pw->l2vpn_name,
(pw->status ? "UP" : "DOWN"), VTY_NEWLINE);
(pw->status ? "UP" : "DOWN"));
break;
case IMSG_CTL_END:
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
return (1);
default:
break;
@ -1555,8 +1540,8 @@ ldp_vty_dispatch(struct vty *vty, struct imsgbuf *ibuf, enum show_command cmd,
done:
close(ibuf->fd);
if (json) {
vty_out(vty, "%s%s", json_object_to_json_string_ext(json,
JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
@ -1599,9 +1584,9 @@ ldp_vty_show_binding(struct vty *vty, const char *af_str, int detail, int json)
params.json = json;
if (!params.detail && !params.json)
vty_out(vty, "%-4s %-20s %-15s %-11s %-13s %6s%s", "AF",
vty_outln (vty, "%-4s %-20s %-15s %-11s %-13s %6s", "AF",
"Destination", "Nexthop", "Local Label", "Remote Label",
"In Use", VTY_NEWLINE);
"In Use");
imsg_compose(&ibuf, IMSG_CTL_SHOW_LIB, 0, 0, -1, NULL, 0);
return (ldp_vty_dispatch(vty, &ibuf, SHOW_LIB, &params));
@ -1627,8 +1612,8 @@ ldp_vty_show_discovery(struct vty *vty, const char *af_str, int detail,
params.json = json;
if (!params.detail && !params.json)
vty_out(vty, "%-4s %-15s %-8s %-15s %9s%s",
"AF", "ID", "Type", "Source", "Holdtime", VTY_NEWLINE);
vty_outln (vty, "%-4s %-15s %-8s %-15s %9s",
"AF", "ID", "Type", "Source", "Holdtime");
if (params.detail)
imsg_compose(&ibuf, IMSG_CTL_SHOW_DISCOVERY_DTL, 0, 0, -1,
@ -1658,9 +1643,8 @@ ldp_vty_show_interface(struct vty *vty, const char *af_str, int json)
/* header */
if (!params.json) {
vty_out(vty, "%-4s %-11s %-6s %-8s %-12s %3s%s", "AF",
"Interface", "State", "Uptime", "Hello Timers", "ac",
VTY_NEWLINE);
vty_outln (vty, "%-4s %-11s %-6s %-8s %-12s %3s", "AF",
"Interface", "State", "Uptime", "Hello Timers","ac");
}
imsg_compose(&ibuf, IMSG_CTL_SHOW_INTERFACE, 0, 0, -1, &ifidx,
@ -1704,18 +1688,18 @@ ldp_vty_show_capabilities(struct vty *vty, int json)
"0x0603");
json_object_array_add(json_array, json_cap);
vty_out(vty, "%s%s", json_object_to_json_string_ext(json,
JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
vty_outln (vty, "%s",
json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
return (0);
}
vty_out(vty,
vty_outln (vty,
"Supported LDP Capabilities%s"
" * Dynamic Announcement (0x0506)%s"
" * Typed Wildcard (0x050B)%s"
" * Unrecognized Notification (0x0603)%s%s", VTY_NEWLINE,
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
" * Unrecognized Notification (0x0603)%s", VTYNL,
VTYNL, VTYNL, VTYNL);
return (0);
}
@ -1738,9 +1722,8 @@ ldp_vty_show_neighbor(struct vty *vty, int capabilities, int detail, int json)
params.detail = 1;
if (!params.detail && !params.json)
vty_out(vty, "%-4s %-15s %-11s %-15s %8s%s",
"AF", "ID", "State", "Remote Address", "Uptime",
VTY_NEWLINE);
vty_outln (vty, "%-4s %-15s %-11s %-15s %8s",
"AF", "ID", "State", "Remote Address","Uptime");
imsg_compose(&ibuf, IMSG_CTL_SHOW_NBR, 0, 0, -1, NULL, 0);
return (ldp_vty_dispatch(vty, &ibuf, SHOW_NBR, &params));
@ -1776,12 +1759,11 @@ ldp_vty_show_atom_vc(struct vty *vty, int json)
if (!params.json) {
/* header */
vty_out(vty, "%-9s %-15s %-10s %-16s %-10s%s",
"Interface", "Peer ID", "VC ID", "Name", "Status",
VTY_NEWLINE);
vty_out(vty, "%-9s %-15s %-10s %-16s %-10s%s",
vty_outln (vty, "%-9s %-15s %-10s %-16s %-10s",
"Interface", "Peer ID", "VC ID", "Name","Status");
vty_outln (vty, "%-9s %-15s %-10s %-16s %-10s",
"---------", "---------------", "----------",
"----------------", "----------", VTY_NEWLINE);
"----------------", "----------");
}
imsg_compose(&ibuf, IMSG_CTL_SHOW_L2VPN_PW, 0, 0, -1, NULL, 0);
@ -1798,7 +1780,7 @@ ldp_vty_clear_nbr(struct vty *vty, const char *addr_str)
if (addr_str &&
(ldp_get_address(addr_str, &nbr.af, &nbr.raddr) == -1 ||
bad_addr(nbr.af, &nbr.raddr))) {
vty_out(vty, "%% Malformed address%s", VTY_NEWLINE);
vty_outln (vty, "%% Malformed address");
return (CMD_WARNING);
}

View File

@ -109,7 +109,7 @@ ldpe(void)
ldpd_process = PROC_LDP_ENGINE;
log_procname = log_procnames[ldpd_process];
master = thread_master_create();
master = thread_master_create(NULL);
/* setup signal handler */
signal_init(master, array_size(ldpe_signals), ldpe_signals);

3
lib/.gitignore vendored
View File

@ -22,3 +22,6 @@ command_parse.c
command_parse.h
refix
grammar_sandbox
clippy
defun_lex.c
plist_clippy.c

View File

@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in.
include ../common.am
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
AM_CFLAGS = $(WERROR)
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
@ -9,6 +11,7 @@ command_lex.h: command_lex.c
@if test ! -f $@; then rm -f command_lex.c; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) command_lex.c; else :; fi
command_parse.lo: command_lex.h
clippy-command_parse.$(OBJEXT): command_lex.h
lib_LTLIBRARIES = libfrr.la
libfrr_la_LDFLAGS = -version-info 0:0:0
@ -87,13 +90,36 @@ pkginclude_HEADERS = \
noinst_HEADERS = \
plist_int.h \
log_int.h
log_int.h \
clippy.h \
# end
noinst_PROGRAMS = grammar_sandbox
if BUILD_CLIPPY
noinst_PROGRAMS += clippy
endif
grammar_sandbox_SOURCES = grammar_sandbox_main.c
grammar_sandbox_LDADD = libfrr.la
clippy_SOURCES = \
defun_lex.l \
command_parse.y \
command_lex.l \
command_graph.c \
command_py.c \
memory.c \
graph.c \
vector.c \
clippy.c \
# end
clippy_CPPFLAGS = -D_GNU_SOURCE
clippy_CFLAGS = $(PYTHON_CFLAGS)
clippy_LDADD = $(PYTHON_LIBS)
clippy-command_graph.$(OBJEXT): route_types.h
plist.lo: plist_clippy.c
EXTRA_DIST = \
queue.h \
command_lex.h \

View File

@ -168,7 +168,7 @@ static int
config_write_agentx (struct vty *vty)
{
if (agentx_enabled)
vty_out (vty, "agentx%s", VTY_NEWLINE);
vty_outln (vty, "agentx");
return 1;
}
@ -186,7 +186,7 @@ DEFUN (agentx_enable,
agentx_enabled = 1;
return CMD_SUCCESS;
}
vty_out (vty, "SNMP AgentX already enabled%s", VTY_NEWLINE);
vty_outln (vty, "SNMP AgentX already enabled");
return CMD_SUCCESS;
}
@ -198,7 +198,7 @@ DEFUN (no_agentx,
"SNMP AgentX settings\n")
{
if (!agentx_enabled) return CMD_SUCCESS;
vty_out (vty, "SNMP AgentX support cannot be disabled once enabled%s", VTY_NEWLINE);
vty_outln (vty, "SNMP AgentX support cannot be disabled once enabled");
return CMD_WARNING;
}

View File

@ -93,12 +93,9 @@ bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str,
const char *tx_str, u_int8_t *dm_val, u_int32_t *rx_val,
u_int32_t *tx_val)
{
VTY_GET_INTEGER_RANGE ("detect-mul", *dm_val, dm_str,
BFD_MIN_DETECT_MULT, BFD_MAX_DETECT_MULT);
VTY_GET_INTEGER_RANGE ("min-rx", *rx_val, rx_str,
BFD_MIN_MIN_RX, BFD_MAX_MIN_RX);
VTY_GET_INTEGER_RANGE ("min-tx", *tx_val, tx_str,
BFD_MIN_MIN_TX, BFD_MAX_MIN_TX);
*dm_val = strtoul(dm_str, NULL, 10);
*rx_val = strtoul(rx_str, NULL, 10);
*tx_val = strtoul(tx_str, NULL, 10);
return CMD_SUCCESS;
}
@ -397,11 +394,11 @@ bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag,
}
else
{
vty_out (vty, " %s%sDetect Mul: %d, Min Rx interval: %d,"
" Min Tx interval: %d%s",
vty_outln (vty, " %s%sDetect Mul: %d, Min Rx interval: %d,"
" Min Tx interval: %d",
(extra_space) ? " ": "", (bfd_tag) ? "BFD: " : " ",
bfd_info->detect_mult, bfd_info->required_min_rx,
bfd_info->desired_min_tx, VTY_NEWLINE);
bfd_info->desired_min_tx);
}
}
@ -426,9 +423,9 @@ bfd_show_status(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag,
}
else
{
vty_out (vty, " %s%sStatus: %s, Last update: %s%s",
vty_outln (vty, " %s%sStatus: %s, Last update: %s",
(extra_space) ? " ": "", (bfd_tag) ? "BFD: " : " ",
bfd_get_status_str(bfd_info->status), time_buf, VTY_NEWLINE);
bfd_get_status_str(bfd_info->status), time_buf);
}
}
@ -454,8 +451,8 @@ bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop,
}
else
{
vty_out (vty, " %sBFD: Type: %s%s", (extra_space) ? " " : "",
(multihop) ? "multi hop" : "single hop", VTY_NEWLINE);
vty_outln (vty, " %sBFD: Type: %s", (extra_space) ? " " : "",
(multihop) ? "multi hop" : "single hop");
}
bfd_show_param(vty, bfd_info, 0, extra_space, use_json, json_bfd);
@ -464,7 +461,7 @@ bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop,
if (use_json)
json_object_object_add(json_obj, "peerBfdInfo", json_bfd);
else
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
/*

137
lib/clippy.c Normal file
View File

@ -0,0 +1,137 @@
/*
* clippy (CLI preparator in python) main executable
* Copyright (C) 2016-2017 David Lamparter for NetDEF, Inc.
*
* This program 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 of the License, or (at your option)
* any later version.
*
* This program 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.
*
* 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
*/
#include "config.h"
#include <Python.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "getopt.h"
#include "command_graph.h"
#include "clippy.h"
#if PY_MAJOR_VERSION >= 3
#define pychar wchar_t
static wchar_t *wconv(const char *s)
{
size_t outlen = mbstowcs(NULL, s, 0);
wchar_t *out = malloc((outlen + 1) * sizeof(wchar_t));
mbstowcs(out, s, outlen + 1);
out[outlen] = 0;
return out;
}
#else
#define pychar char
#define wconv(x) x
#endif
int main(int argc, char **argv)
{
pychar **wargv;
#if PY_VERSION_HEX >= 0x03040000 /* 3.4 */
Py_SetStandardStreamEncoding("UTF-8", NULL);
#endif
Py_SetProgramName(wconv(argv[0]));
PyImport_AppendInittab("_clippy", command_py_init);
Py_Initialize();
wargv = malloc(argc * sizeof(pychar *));
for (int i = 1; i < argc; i++)
wargv[i - 1] = wconv(argv[i]);
PySys_SetArgv(argc - 1, wargv);
const char *pyfile = argc > 1 ? argv[1] : NULL;
FILE *fp;
if (pyfile) {
fp = fopen(pyfile, "r");
if (!fp) {
fprintf(stderr, "%s: %s\n", pyfile, strerror(errno));
return 1;
}
} else {
fp = stdin;
char *ver = strdup(Py_GetVersion());
char *cr = strchr(ver, '\n');
if (cr)
*cr = ' ';
fprintf(stderr, "clippy interactive shell\n(Python %s)\n", ver);
free(ver);
PyRun_SimpleString("import rlcompleter, readline\n"
"readline.parse_and_bind('tab: complete')");
}
if (PyRun_AnyFile(fp, pyfile)) {
if (PyErr_Occurred())
PyErr_Print();
else
printf("unknown python failure (?)\n");
return 1;
}
Py_Finalize();
#if PY_MAJOR_VERSION >= 3
for (int i = 1; i < argc; i++)
free(wargv[i - 1]);
#endif
free(wargv);
return 0;
}
/* and now for the ugly part... provide simplified logging functions so we
* don't need to link libzebra (which would be a circular build dep) */
#ifdef __ASSERT_FUNCTION
#undef __ASSERT_FUNCTION
#endif
#include "log.h"
#include "zassert.h"
#define ZLOG_FUNC(FUNCNAME) \
void FUNCNAME(const char *format, ...) \
{ \
va_list args; \
va_start(args, format); \
vfprintf (stderr, format, args); \
fputs ("\n", stderr); \
va_end(args); \
}
ZLOG_FUNC(zlog_err)
ZLOG_FUNC(zlog_warn)
ZLOG_FUNC(zlog_info)
ZLOG_FUNC(zlog_notice)
ZLOG_FUNC(zlog_debug)
void
_zlog_assert_failed (const char *assertion, const char *file,
unsigned int line, const char *function)
{
fprintf(stderr, "Assertion `%s' failed in file %s, line %u, function %s",
assertion, file, line, (function ? function : "?"));
abort();
}
void memory_oom (size_t size, const char *name)
{
abort();
}

28
lib/clippy.h Normal file
View File

@ -0,0 +1,28 @@
/*
* clippy (CLI preparator in python)
* Copyright (C) 2016-2017 David Lamparter for NetDEF, Inc.
*
* This program 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 of the License, or (at your option)
* any later version.
*
* This program 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.
*
* 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
*/
#ifndef _FRR_CLIPPY_H
#define _FRR_CLIPPY_H
#include <Python.h>
extern PyObject *clippy_parse(PyObject *self, PyObject *args);
extern PyMODINIT_FUNC command_py_init(void);
#endif /* _FRR_CLIPPY_H */

View File

@ -433,29 +433,28 @@ static int
config_write_host (struct vty *vty)
{
if (host.name)
vty_out (vty, "hostname %s%s", host.name, VTY_NEWLINE);
vty_outln (vty, "hostname %s", host.name);
if (host.encrypt)
{
if (host.password_encrypt)
vty_out (vty, "password 8 %s%s", host.password_encrypt, VTY_NEWLINE);
vty_outln (vty, "password 8 %s", host.password_encrypt);
if (host.enable_encrypt)
vty_out (vty, "enable password 8 %s%s", host.enable_encrypt, VTY_NEWLINE);
vty_outln (vty, "enable password 8 %s", host.enable_encrypt);
}
else
{
if (host.password)
vty_out (vty, "password %s%s", host.password, VTY_NEWLINE);
vty_outln (vty, "password %s", host.password);
if (host.enable)
vty_out (vty, "enable password %s%s", host.enable, VTY_NEWLINE);
vty_outln (vty, "enable password %s", host.enable);
}
if (zlog_default->default_lvl != LOG_DEBUG)
{
vty_out (vty, "! N.B. The 'log trap' command is deprecated.%s",
VTY_NEWLINE);
vty_out (vty, "log trap %s%s",
zlog_priority[zlog_default->default_lvl], VTY_NEWLINE);
vty_outln (vty,"! N.B. The 'log trap' command is deprecated.");
vty_outln (vty, "log trap %s",
zlog_priority[zlog_default->default_lvl]);
}
if (host.logfile && (zlog_default->maxlvl[ZLOG_DEST_FILE] != ZLOG_DISABLED))
@ -464,7 +463,7 @@ config_write_host (struct vty *vty)
if (zlog_default->maxlvl[ZLOG_DEST_FILE] != zlog_default->default_lvl)
vty_out (vty, " %s",
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_FILE]]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != ZLOG_DISABLED)
@ -473,14 +472,14 @@ config_write_host (struct vty *vty)
if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != zlog_default->default_lvl)
vty_out (vty, " %s",
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_STDOUT]]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED)
vty_out(vty,"no log monitor%s",VTY_NEWLINE);
vty_outln (vty,"no log monitor");
else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != zlog_default->default_lvl)
vty_out(vty,"log monitor %s%s",
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]],VTY_NEWLINE);
vty_outln (vty,"log monitor %s",
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]]);
if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != ZLOG_DISABLED)
{
@ -488,34 +487,33 @@ config_write_host (struct vty *vty)
if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != zlog_default->default_lvl)
vty_out (vty, " %s",
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_SYSLOG]]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (zlog_default->facility != LOG_DAEMON)
vty_out (vty, "log facility %s%s",
facility_name(zlog_default->facility), VTY_NEWLINE);
vty_outln (vty, "log facility %s",
facility_name(zlog_default->facility));
if (zlog_default->record_priority == 1)
vty_out (vty, "log record-priority%s", VTY_NEWLINE);
vty_outln (vty, "log record-priority");
if (zlog_default->timestamp_precision > 0)
vty_out (vty, "log timestamp precision %d%s",
zlog_default->timestamp_precision, VTY_NEWLINE);
vty_outln (vty, "log timestamp precision %d",
zlog_default->timestamp_precision);
if (host.advanced)
vty_out (vty, "service advanced-vty%s", VTY_NEWLINE);
vty_outln (vty, "service advanced-vty");
if (host.encrypt)
vty_out (vty, "service password-encryption%s", VTY_NEWLINE);
vty_outln (vty, "service password-encryption");
if (host.lines >= 0)
vty_out (vty, "service terminal-length %d%s", host.lines,
VTY_NEWLINE);
vty_outln (vty, "service terminal-length %d",host.lines);
if (host.motdfile)
vty_out (vty, "banner motd file %s%s", host.motdfile, VTY_NEWLINE);
vty_outln (vty, "banner motd file %s", host.motdfile);
else if (! host.motd)
vty_out (vty, "no banner motd%s", VTY_NEWLINE);
vty_outln (vty, "no banner motd");
return 1;
}
@ -1151,7 +1149,7 @@ DEFUN (config_terminal,
vty->node = CONFIG_NODE;
else
{
vty_out (vty, "VTY configuration is locked by other VTY%s", VTY_NEWLINE);
vty_outln (vty, "VTY configuration is locked by other VTY");
return CMD_WARNING;
}
return CMD_SUCCESS;
@ -1348,12 +1346,11 @@ DEFUN (show_version,
SHOW_STR
"Displays zebra version\n")
{
vty_out (vty, "%s %s (%s).%s", FRR_FULL_NAME, FRR_VERSION,
host.name ? host.name : "",
VTY_NEWLINE);
vty_out (vty, "%s%s%s", FRR_COPYRIGHT, GIT_INFO, VTY_NEWLINE);
vty_out (vty, "configured with:%s %s%s", VTY_NEWLINE,
FRR_CONFIG_ARGS, VTY_NEWLINE);
vty_outln (vty, "%s %s (%s).", FRR_FULL_NAME, FRR_VERSION,
host.name ? host.name : "");
vty_outln (vty, "%s%s", FRR_COPYRIGHT, GIT_INFO);
vty_outln (vty, "configured with:%s %s", VTYNL,
FRR_CONFIG_ARGS);
return CMD_SUCCESS;
}
@ -1376,7 +1373,7 @@ DEFUN (config_help,
"help",
"Description of the interactive help system\n")
{
vty_out (vty,
vty_outln (vty,
"Quagga VTY provides advanced help feature. When you need help,%s\
anytime at the command line please press '?'.%s\
%s\
@ -1388,9 +1385,9 @@ command argument (e.g. 'show ?') and describes each possible%s\
argument.%s\
2. Partial help is provided when an abbreviated argument is entered%s\
and you want to know what arguments match the input%s\
(e.g. 'show me?'.)%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE,
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE,
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
(e.g. 'show me?'.)%s", VTYNL, VTYNL, VTYNL,
VTYNL, VTYNL, VTYNL, VTYNL, VTYNL,
VTYNL, VTYNL, VTYNL, VTYNL);
return CMD_SUCCESS;
}
@ -1424,7 +1421,7 @@ permute (struct graph_node *start, struct vty *vty)
}
if (gn == start)
vty_out (vty, "...");
vty_out (vty, VTY_NEWLINE);
vty_out (vty, VTYNL);
}
else
{
@ -1458,7 +1455,7 @@ cmd_list_cmds (struct vty *vty, int do_permute)
if ((element = vector_slot (node->cmd_vector, i)) &&
element->attr != CMD_ATTR_DEPRECATED &&
element->attr != CMD_ATTR_HIDDEN)
vty_out (vty, " %s%s", element->string, VTY_NEWLINE);
vty_outln (vty, " %s", element->string);
}
return CMD_SUCCESS;
}
@ -1491,26 +1488,25 @@ vty_write_config (struct vty *vty)
if (vty->type == VTY_TERM)
{
vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE,
VTY_NEWLINE);
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "%sCurrent configuration:",VTYNL);
vty_outln (vty, "!");
}
vty_out (vty, "frr version %s%s", FRR_VER_SHORT, VTY_NEWLINE);
vty_out (vty, "frr defaults %s%s", DFLT_NAME, VTY_NEWLINE);
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "frr version %s", FRR_VER_SHORT);
vty_outln (vty, "frr defaults %s", DFLT_NAME);
vty_outln (vty, "!");
for (i = 0; i < vector_active (cmdvec); i++)
if ((node = vector_slot (cmdvec, i)) && node->func
&& (node->vtysh || vty->type != VTY_SHELL))
{
if ((*node->func) (vty))
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
}
if (vty->type == VTY_TERM)
{
vty_out (vty, "end%s",VTY_NEWLINE);
vty_outln (vty, "end");
}
}
@ -1534,8 +1530,8 @@ DEFUN (config_write,
struct stat conf_stat;
// if command was 'write terminal' or 'show running-config'
if (argc == 2 && (!strcmp(argv[idx_type]->text, "terminal") ||
!strcmp(argv[0]->text, "show")))
if (argc == 2 && (strmatch(argv[idx_type]->text, "terminal") ||
strmatch(argv[0]->text, "show")))
{
vty_write_config (vty);
return CMD_SUCCESS;
@ -1547,8 +1543,7 @@ DEFUN (config_write,
/* Check and see if we are operating under vtysh configuration */
if (host.config == NULL)
{
vty_out (vty, "Can't save to configuration file, using vtysh.%s",
VTY_NEWLINE);
vty_outln (vty,"Can't save to configuration file, using vtysh.");
return CMD_WARNING;
}
@ -1583,14 +1578,13 @@ DEFUN (config_write,
fd = mkstemp (config_file_tmp);
if (fd < 0)
{
vty_out (vty, "Can't open configuration file %s.%s", config_file_tmp,
VTY_NEWLINE);
vty_outln (vty, "Can't open configuration file %s.",config_file_tmp);
goto finished;
}
if (fchmod (fd, CONFIGFILE_MASK) != 0)
{
vty_out (vty, "Can't chmod configuration file %s: %s (%d).%s",
config_file_tmp, safe_strerror(errno), errno, VTY_NEWLINE);
vty_outln (vty, "Can't chmod configuration file %s: %s (%d).",
config_file_tmp, safe_strerror(errno), errno);
goto finished;
}
@ -1611,14 +1605,14 @@ DEFUN (config_write,
if (unlink (config_file_sav) != 0)
if (errno != ENOENT)
{
vty_out (vty, "Can't unlink backup configuration file %s.%s", config_file_sav,
VTY_NEWLINE);
vty_outln (vty, "Can't unlink backup configuration file %s.",
config_file_sav);
goto finished;
}
if (link (config_file, config_file_sav) != 0)
{
vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav,
VTY_NEWLINE);
vty_outln (vty, "Can't backup old configuration file %s.",
config_file_sav);
goto finished;
}
if (dirfd >= 0)
@ -1626,15 +1620,13 @@ DEFUN (config_write,
}
if (rename (config_file_tmp, config_file) != 0)
{
vty_out (vty, "Can't save configuration file %s.%s", config_file,
VTY_NEWLINE);
vty_outln (vty, "Can't save configuration file %s.",config_file);
goto finished;
}
if (dirfd >= 0)
fsync (dirfd);
vty_out (vty, "Configuration saved to %s%s", config_file,
VTY_NEWLINE);
vty_outln (vty, "Configuration saved to %s",config_file);
ret = CMD_SUCCESS;
finished:
@ -1689,8 +1681,8 @@ DEFUN (show_startup_config,
confp = fopen (host.config, "r");
if (confp == NULL)
{
vty_out (vty, "Can't open configuration file [%s] due to '%s'%s",
host.config, safe_strerror(errno), VTY_NEWLINE);
vty_outln (vty, "Can't open configuration file [%s] due to '%s'",
host.config, safe_strerror(errno));
return CMD_WARNING;
}
@ -1702,7 +1694,7 @@ DEFUN (show_startup_config,
cp++;
*cp = '\0';
vty_out (vty, "%s%s", buf, VTY_NEWLINE);
vty_outln (vty, "%s", buf);
}
fclose (confp);
@ -1729,7 +1721,7 @@ DEFUN (config_hostname,
if (!isalpha((int) word->arg[0]))
{
vty_out (vty, "Please specify string starting with alphabet%s", VTY_NEWLINE);
vty_outln (vty, "Please specify string starting with alphabet");
return CMD_WARNING;
}
@ -1769,8 +1761,8 @@ DEFUN (config_password,
if (!isalnum (argv[idx_8]->arg[0]))
{
vty_out (vty,
"Please specify string starting with alphanumeric%s", VTY_NEWLINE);
vty_outln (vty,
"Please specify string starting with alphanumeric");
return CMD_WARNING;
}
@ -1819,15 +1811,15 @@ DEFUN (config_enable_password,
}
else
{
vty_out (vty, "Unknown encryption type.%s", VTY_NEWLINE);
vty_outln (vty, "Unknown encryption type.");
return CMD_WARNING;
}
}
if (!isalnum (argv[idx_8]->arg[0]))
{
vty_out (vty,
"Please specify string starting with alphanumeric%s", VTY_NEWLINE);
vty_outln (vty,
"Please specify string starting with alphanumeric");
return CMD_WARNING;
}
@ -1976,8 +1968,8 @@ DEFUN_HIDDEN (do_echo,
{
char *message;
vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 1)) ? message : ""),
VTY_NEWLINE);
vty_outln (vty, "%s",
((message = argv_concat(argv, argc, 1)) ? message : ""));
if (message)
XFREE(MTYPE_TMP, message);
return CMD_SUCCESS;
@ -2020,7 +2012,7 @@ DEFUN (show_logging,
vty_out (vty, "level %s, facility %s, ident %s",
zlog_priority[zl->maxlvl[ZLOG_DEST_SYSLOG]],
facility_name(zl->facility), zl->ident);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, "Stdout logging: ");
if (zl->maxlvl[ZLOG_DEST_STDOUT] == ZLOG_DISABLED)
@ -2028,7 +2020,7 @@ DEFUN (show_logging,
else
vty_out (vty, "level %s",
zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, "Monitor logging: ");
if (zl->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED)
@ -2036,7 +2028,7 @@ DEFUN (show_logging,
else
vty_out (vty, "level %s",
zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, "File logging: ");
if ((zl->maxlvl[ZLOG_DEST_FILE] == ZLOG_DISABLED) ||
@ -2046,14 +2038,14 @@ DEFUN (show_logging,
vty_out (vty, "level %s, filename %s",
zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]],
zl->filename);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
vty_out (vty, "Protocol name: %s%s",
zl->protoname, VTY_NEWLINE);
vty_out (vty, "Record priority: %s%s",
(zl->record_priority ? "enabled" : "disabled"), VTY_NEWLINE);
vty_out (vty, "Timestamp precision: %d%s",
zl->timestamp_precision, VTY_NEWLINE);
vty_outln (vty, "Protocol name: %s",
zl->protoname);
vty_outln (vty, "Record priority: %s",
(zl->record_priority ? "enabled" : "disabled"));
vty_outln (vty, "Timestamp precision: %d",
zl->timestamp_precision);
return CMD_SUCCESS;
}
@ -2345,8 +2337,7 @@ DEFUN (config_log_timestamp_precision,
"Number of subsecond digits\n")
{
int idx_number = 3;
VTY_GET_INTEGER_RANGE("Timestamp Precision",
zlog_default->timestamp_precision, argv[idx_number]->arg, 0, 6);
zlog_default->timestamp_precision = strtoul(argv[idx_number]->arg, NULL, 10);
return CMD_SUCCESS;
}

View File

@ -207,6 +207,10 @@ struct cmd_node
int argc __attribute__ ((unused)), \
struct cmd_token *argv[] __attribute__ ((unused)) )
#define DEFPY(funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
funcdecl_##funcname
#define DEFUN(funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_FUNC_DECL(funcname) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
@ -274,6 +278,9 @@ struct cmd_node
#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon)
#else /* VTYSH_EXTRACT_PL */
#define DEFPY(funcname, cmdname, cmdstr, helpstr) \
DEFUN(funcname, cmdname, cmdstr, helpstr)
#endif /* VTYSH_EXTRACT_PL */
/* Some macroes */

View File

@ -44,6 +44,8 @@
* struct parser_ctx is needed for the bison forward decls.
*/
%code requires {
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@ -189,7 +191,7 @@ start:
varname_token: '$' WORD
{
$$ = XSTRDUP (MTYPE_LEX, $2);
$$ = $2;
}
| /* empty */
{

336
lib/command_py.c Normal file
View File

@ -0,0 +1,336 @@
/*
* clippy (CLI preparator in python) wrapper for FRR command_graph
* Copyright (C) 2016-2017 David Lamparter for NetDEF, Inc.
*
* This program 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 of the License, or (at your option)
* any later version.
*
* This program 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.
*
* 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
*/
/* note: this wrapper is intended to be used as build-time helper. while
* it should be generally correct and proper, there may be the occasional
* memory leak or SEGV for things that haven't been well-tested.
*/
#include <Python.h>
#include "structmember.h"
#include <string.h>
#include <stdlib.h>
#include "command_graph.h"
#include "clippy.h"
struct wrap_graph;
static PyObject *graph_to_pyobj(struct wrap_graph *graph, struct graph_node *gn);
/*
* nodes are wrapped as follows:
* - instances can only be acquired from a graph
* - the same node will return the same wrapper object (they're buffered
* through "idx")
* - a reference is held onto the graph
* - fields are copied for easy access with PyMemberDef
*/
struct wrap_graph_node {
PyObject_HEAD
bool allowrepeat;
const char *type;
bool deprecated;
bool hidden;
const char *text;
const char *desc;
const char *varname;
long long min, max;
struct graph_node *node;
struct wrap_graph *wgraph;
size_t idx;
};
/*
* graphs are wrapped as follows:
* - they can only be created by parsing a definition string
* - there's a table here for the wrapped nodes (nodewrappers), indexed
* by "idx" (corresponds to node's position in graph's table of nodes)
* - graphs do NOT hold references to nodes (would be circular)
*/
struct wrap_graph {
PyObject_HEAD
char *definition;
struct graph *graph;
struct wrap_graph_node **nodewrappers;
};
static PyObject *refuse_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyErr_SetString(PyExc_ValueError, "cannot create instances of this type");
return NULL;
}
#define member(name, type) {(char *)#name, type, offsetof(struct wrap_graph_node, name), READONLY, \
(char *)#name " (" #type ")"}
static PyMemberDef members_graph_node[] = {
member(allowrepeat, T_BOOL),
member(type, T_STRING),
member(deprecated, T_BOOL),
member(hidden, T_BOOL),
member(text, T_STRING),
member(desc, T_STRING),
member(min, T_LONGLONG),
member(max, T_LONGLONG),
member(varname, T_STRING),
{},
};
#undef member
/*
* node.next() -- returns list of all "next" nodes.
* this will include circles if the graph has them.
*/
static PyObject *graph_node_next(PyObject *self, PyObject *args)
{
struct wrap_graph_node *wrap = (struct wrap_graph_node *)self;
PyObject *pylist;
if (wrap->node->data
&& ((struct cmd_token *)wrap->node->data)->type == END_TKN)
return PyList_New(0);
pylist = PyList_New(vector_active(wrap->node->to));
for (size_t i = 0; i < vector_active(wrap->node->to); i++) {
struct graph_node *gn = vector_slot(wrap->node->to, i);
PyList_SetItem(pylist, i, graph_to_pyobj(wrap->wgraph, gn));
}
return pylist;
};
/*
* node.join() -- return FORK's JOIN node or None
*/
static PyObject *graph_node_join(PyObject *self, PyObject *args)
{
struct wrap_graph_node *wrap = (struct wrap_graph_node *)self;
if (!wrap->node->data
|| ((struct cmd_token *)wrap->node->data)->type == END_TKN)
Py_RETURN_NONE;
struct cmd_token *tok = wrap->node->data;
if (tok->type != FORK_TKN)
Py_RETURN_NONE;
return graph_to_pyobj(wrap->wgraph, tok->forkjoin);
};
static PyMethodDef methods_graph_node[] = {
{"next", graph_node_next, METH_NOARGS, "outbound graph edge list"},
{"join", graph_node_join, METH_NOARGS, "outbound join node"},
{}
};
static void graph_node_wrap_free(void *arg)
{
struct wrap_graph_node *wrap = arg;
wrap->wgraph->nodewrappers[wrap->idx] = NULL;
Py_DECREF(wrap->wgraph);
}
static PyTypeObject typeobj_graph_node = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "_clippy.GraphNode",
.tp_basicsize = sizeof(struct wrap_graph_node),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "struct graph_node *",
.tp_new = refuse_new,
.tp_free = graph_node_wrap_free,
.tp_members = members_graph_node,
.tp_methods = methods_graph_node,
};
static PyObject *graph_to_pyobj(struct wrap_graph *wgraph, struct graph_node *gn)
{
struct wrap_graph_node *wrap;
size_t i;
for (i = 0; i < vector_active(wgraph->graph->nodes); i++)
if (vector_slot(wgraph->graph->nodes, i) == gn)
break;
if (i == vector_active(wgraph->graph->nodes)) {
PyErr_SetString(PyExc_ValueError, "cannot find node in graph");
return NULL;
}
if (wgraph->nodewrappers[i]) {
PyObject *obj = (PyObject *)wgraph->nodewrappers[i];
Py_INCREF(obj);
return obj;
}
wrap = (struct wrap_graph_node *)typeobj_graph_node.tp_alloc(&typeobj_graph_node, 0);
if (!wrap)
return NULL;
wgraph->nodewrappers[i] = wrap;
Py_INCREF(wgraph);
wrap->idx = i;
wrap->wgraph = wgraph;
wrap->node = gn;
wrap->type = "NULL";
wrap->allowrepeat = false;
if (gn->data) {
struct cmd_token *tok = gn->data;
switch (tok->type) {
#define item(x) case x: wrap->type = #x; break;
item(WORD_TKN) // words
item(VARIABLE_TKN) // almost anything
item(RANGE_TKN) // integer range
item(IPV4_TKN) // IPV4 addresses
item(IPV4_PREFIX_TKN) // IPV4 network prefixes
item(IPV6_TKN) // IPV6 prefixes
item(IPV6_PREFIX_TKN) // IPV6 network prefixes
/* plumbing types */
item(FORK_TKN)
item(JOIN_TKN)
item(START_TKN)
item(END_TKN)
default:
wrap->type = "???";
}
wrap->deprecated = (tok->attr == CMD_ATTR_DEPRECATED);
wrap->hidden = (tok->attr == CMD_ATTR_HIDDEN);
wrap->text = tok->text;
wrap->desc = tok->desc;
wrap->varname = tok->varname;
wrap->min = tok->min;
wrap->max = tok->max;
wrap->allowrepeat = tok->allowrepeat;
}
return (PyObject *)wrap;
}
#define member(name, type) {(char *)#name, type, offsetof(struct wrap_graph, name), READONLY, \
(char *)#name " (" #type ")"}
static PyMemberDef members_graph[] = {
member(definition, T_STRING),
{},
};
#undef member
/* graph.first() - root node */
static PyObject *graph_first(PyObject *self, PyObject *args)
{
struct wrap_graph *gwrap = (struct wrap_graph *)self;
struct graph_node *gn = vector_slot(gwrap->graph->nodes, 0);
return graph_to_pyobj(gwrap, gn);
};
static PyMethodDef methods_graph[] = {
{"first", graph_first, METH_NOARGS, "first graph node"},
{}
};
static PyObject *graph_parse(PyTypeObject *type, PyObject *args, PyObject *kwds);
static void graph_wrap_free(void *arg)
{
struct wrap_graph *wgraph = arg;
free(wgraph->nodewrappers);
free(wgraph->definition);
}
static PyTypeObject typeobj_graph = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "_clippy.Graph",
.tp_basicsize = sizeof(struct wrap_graph),
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = "struct graph *",
.tp_new = graph_parse,
.tp_free = graph_wrap_free,
.tp_members = members_graph,
.tp_methods = methods_graph,
};
/* top call / entrypoint for python code */
static PyObject *graph_parse(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
const char *def, *doc = NULL;
struct wrap_graph *gwrap;
static const char *kwnames[] = { "cmddef", "doc", NULL };
gwrap = (struct wrap_graph *)typeobj_graph.tp_alloc(&typeobj_graph, 0);
if (!gwrap)
return NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|s", (char **)kwnames, &def, &doc))
return NULL;
struct graph *graph = graph_new ();
struct cmd_token *token = cmd_token_new (START_TKN, 0, NULL, NULL);
graph_new_node (graph, token, (void (*)(void *)) &cmd_token_del);
struct cmd_element cmd = { .string = def, .doc = doc };
cmd_graph_parse (graph, &cmd);
cmd_graph_names (graph);
gwrap->graph = graph;
gwrap->definition = strdup(def);
gwrap->nodewrappers = calloc(vector_active(graph->nodes),
sizeof (gwrap->nodewrappers[0]));
return (PyObject *)gwrap;
}
static PyMethodDef clippy_methods[] = {
{"parse", clippy_parse, METH_VARARGS, "Parse a C file"},
{NULL, NULL, 0, NULL}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef pymoddef_clippy = {
PyModuleDef_HEAD_INIT,
"_clippy",
NULL, /* docstring */
-1,
clippy_methods,
};
#define modcreate() PyModule_Create(&pymoddef_clippy)
#define initret(val) return val;
#else
#define modcreate() Py_InitModule("_clippy", clippy_methods)
#define initret(val) do { \
if (!val) Py_FatalError("initialization failure"); \
return; } while (0)
#endif
PyMODINIT_FUNC command_py_init(void)
{
PyObject* pymod;
if (PyType_Ready(&typeobj_graph_node) < 0)
initret(NULL);
if (PyType_Ready(&typeobj_graph) < 0)
initret(NULL);
pymod = modcreate();
if (!pymod)
initret(NULL);
Py_INCREF(&typeobj_graph_node);
PyModule_AddObject(pymod, "GraphNode", (PyObject *)&typeobj_graph_node);
Py_INCREF(&typeobj_graph);
PyModule_AddObject(pymod, "Graph", (PyObject *)&typeobj_graph);
initret(pymod);
}

265
lib/defun_lex.l Normal file
View File

@ -0,0 +1,265 @@
%{
/*
* clippy (CLI preparator in python) C pseudo-lexer
* Copyright (C) 2016-2017 David Lamparter for NetDEF, Inc.
*
* This program 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 of the License, or (at your option)
* any later version.
*
* This program 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.
*
* 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
*/
/* This is just enough of a lexer to make rough sense of a C source file.
* It handles C preprocessor directives, strings, and looks for FRR-specific
* idioms (aka DEFUN).
*
* There is some preliminary support for documentation comments for DEFUNs.
* They would look like this (note the ~): (replace \ by /)
*
* \*~ documentation for foobar_cmd
* * parameter does xyz
* *\
* DEFUN(foobar_cmd, ...)
*
* This is intended for user documentation / command reference. Don't put
* code documentation in it.
*/
/* ignore harmless bug in old versions of flex */
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "config.h"
#include <Python.h>
#include <string.h>
#include <stdlib.h>
#include "command_graph.h"
#include "clippy.h"
#define ID 258
#define PREPROC 259
#define OPERATOR 260
#define STRING 261
#define COMMENT 262
#define SPECIAL 263
#define DEFUNNY 270
#define INSTALL 271
#define AUXILIARY 272
int comment_link;
char string_end;
char *value;
static void extendbuf(char **what, const char *arg)
{
if (!*what)
*what = strdup(arg);
else {
size_t vall = strlen(*what), argl = strlen(arg);
*what = realloc(*what, vall + argl + 1);
memcpy(*what + vall, arg, argl);
(*what)[vall + argl] = '\0';
}
}
#define extend(x) extendbuf(&value, x)
%}
ID [A-Za-z0-9_]+
OPERATOR [!%&/\[\]{}=?:^|\*.;><~'\\+-]
SPECIAL [(),]
%pointer
%option yylineno
%option noyywrap
%option noinput
%option nounput
%option outfile="defun_lex.c"
%option prefix="def_yy"
%option 8bit
%s linestart
%x comment
%x linecomment
%x preproc
%x rstring
%%
BEGIN(linestart);
\n BEGIN(linestart);
<INITIAL,linestart,preproc>"/*" comment_link = YY_START; extend(yytext); BEGIN(comment);
<comment>[^*\n]* extend(yytext);
<comment>"*"+[^*/\n]* extend(yytext);
<comment>\n extend(yytext);
<comment>"*"+"/" extend(yytext); BEGIN(comment_link); return COMMENT;
<INITIAL,linestart,preproc>"//" comment_link = YY_START; extend(yytext); BEGIN(linecomment);
<linecomment>[^\n]* extend(yytext);
<linecomment>\n BEGIN((comment_link == INITIAL) ? linestart : comment_link); return COMMENT;
<linestart># BEGIN(preproc);
<preproc>\n BEGIN(INITIAL); return PREPROC;
<preproc>[^\n\\]+ extend(yytext);
<preproc>\\\n extend(yytext);
<preproc>\\+[^\n] extend(yytext);
[\"\'] string_end = yytext[0]; extend(yytext); BEGIN(rstring);
<rstring>[\"\'] {
extend(yytext);
if (yytext[0] == string_end) {
BEGIN(INITIAL);
return STRING;
}
}
<rstring>\\\n /* ignore */
<rstring>\\. extend(yytext);
<rstring>[^\\\"\']+ extend(yytext);
"DEFUN" value = strdup(yytext); return DEFUNNY;
"DEFUN_NOSH" value = strdup(yytext); return DEFUNNY;
"DEFUN_HIDDEN" value = strdup(yytext); return DEFUNNY;
"DEFPY" value = strdup(yytext); return DEFUNNY;
"ALIAS" value = strdup(yytext); return DEFUNNY;
"ALIAS_HIDDEN" value = strdup(yytext); return DEFUNNY;
"install_element" value = strdup(yytext); return INSTALL;
"VTYSH_TARGETS" value = strdup(yytext); return AUXILIARY;
"VTYSH_NODESWITCH" value = strdup(yytext); return AUXILIARY;
[ \t\n]+ /* ignore */
\\ /* ignore */
{ID} BEGIN(INITIAL); value = strdup(yytext); return ID;
{OPERATOR} BEGIN(INITIAL); value = strdup(yytext); return OPERATOR;
{SPECIAL} BEGIN(INITIAL); value = strdup(yytext); return SPECIAL;
. /* printf("-- '%s' in init\n", yytext); */ BEGIN(INITIAL); return yytext[0];
%%
static int yylex_clr(char **retbuf)
{
int rv = def_yylex();
*retbuf = value;
value = NULL;
return rv;
}
static PyObject *get_args(void)
{
PyObject *pyObj = PyList_New(0);
PyObject *pyArg = NULL;
char *tval;
int depth = 1;
int token;
while ((token = yylex_clr(&tval)) != YY_NULL) {
if (token == SPECIAL && tval[0] == '(') {
free(tval);
break;
}
if (token == COMMENT) {
free(tval);
continue;
}
fprintf(stderr, "invalid input!\n");
exit(1);
}
while ((token = yylex_clr(&tval)) != YY_NULL) {
if (token == COMMENT) {
free(tval);
continue;
}
if (token == SPECIAL) {
if (depth == 1 && (tval[0] == ',' || tval[0] == ')')) {
if (pyArg)
PyList_Append(pyObj, pyArg);
pyArg = NULL;
if (tval[0] == ')') {
free(tval);
break;
}
free(tval);
continue;
}
if (tval[0] == '(')
depth++;
if (tval[0] == ')')
depth--;
}
if (!pyArg)
pyArg = PyList_New(0);
PyList_Append(pyArg, PyUnicode_FromString(tval));
free(tval);
}
return pyObj;
}
/* _clippy.parse() -- read a C file, returning a list of interesting bits.
* note this ditches most of the actual C code. */
PyObject *clippy_parse(PyObject *self, PyObject *args)
{
const char *filename;
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
FILE *fd = fopen(filename, "r");
if (!fd)
return PyErr_SetFromErrnoWithFilename(PyExc_IOError, filename);
char *tval;
int token;
yyin = fd;
value = NULL;
PyObject *pyCont = PyDict_New();
PyObject *pyObj = PyList_New(0);
PyDict_SetItemString(pyCont, "filename", PyUnicode_FromString(filename));
PyDict_SetItemString(pyCont, "data", pyObj);
while ((token = yylex_clr(&tval)) != YY_NULL) {
int lineno = yylineno;
PyObject *pyItem = NULL, *pyArgs;
switch (token) {
case DEFUNNY:
case INSTALL:
case AUXILIARY:
pyArgs = get_args();
pyItem = PyDict_New();
PyDict_SetItemString(pyItem, "type", PyUnicode_FromString(tval));
PyDict_SetItemString(pyItem, "args", pyArgs);
break;
case COMMENT:
if (strncmp(tval, "//~", 3) && strncmp(tval, "/*~", 3))
break;
pyItem = PyDict_New();
PyDict_SetItemString(pyItem, "type", PyUnicode_FromString("COMMENT"));
PyDict_SetItemString(pyItem, "line", PyUnicode_FromString(tval));
break;
case PREPROC:
pyItem = PyDict_New();
PyDict_SetItemString(pyItem, "type", PyUnicode_FromString("PREPROC"));
PyDict_SetItemString(pyItem, "line", PyUnicode_FromString(tval));
break;
}
if (pyItem) {
PyDict_SetItemString(pyItem, "lineno", PyLong_FromLong(lineno));
PyList_Append(pyObj, pyItem);
}
free(tval);
}
def_yylex_destroy();
fclose(fd);
return pyCont;
}

View File

@ -349,7 +349,7 @@ DEFUN (no_distribute_list,
if (! ret)
{
vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
vty_outln (vty, "distribute list doesn't exist");
return CMD_WARNING;
}
return CMD_SUCCESS;
@ -393,9 +393,9 @@ config_show_distribute (struct vty *vty)
DISTRIBUTE_V6_OUT, has_print);
}
if (has_print)
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
else
vty_out (vty, " not set%s", VTY_NEWLINE);
vty_outln (vty, " not set");
for (i = 0; i < disthash->size; i++)
for (mp = disthash->index[i]; mp; mp = mp->next)
@ -414,9 +414,9 @@ config_show_distribute (struct vty *vty)
has_print = distribute_print(vty, dist->prefix, 1,
DISTRIBUTE_V6_OUT, has_print);
if (has_print)
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
else
vty_out(vty, " nothing%s", VTY_NEWLINE);
vty_outln (vty, " nothing");
}
}
@ -437,9 +437,9 @@ config_show_distribute (struct vty *vty)
DISTRIBUTE_V6_IN, has_print);
}
if (has_print)
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
else
vty_out (vty, " not set%s", VTY_NEWLINE);
vty_outln (vty, " not set");
for (i = 0; i < disthash->size; i++)
for (mp = disthash->index[i]; mp; mp = mp->next)
@ -458,9 +458,9 @@ config_show_distribute (struct vty *vty)
has_print = distribute_print(vty, dist->prefix, 1,
DISTRIBUTE_V6_IN, has_print);
if (has_print)
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
else
vty_out(vty, " nothing%s", VTY_NEWLINE);
vty_outln (vty, " nothing");
}
}
return 0;
@ -487,12 +487,11 @@ config_write_distribute (struct vty *vty)
if (dist->list[j]) {
output = j == DISTRIBUTE_V4_OUT || j == DISTRIBUTE_V6_OUT;
v6 = j == DISTRIBUTE_V6_IN || j == DISTRIBUTE_V6_OUT;
vty_out (vty, " %sdistribute-list %s %s %s%s",
vty_outln (vty, " %sdistribute-list %s %s %s",
v6 ? "ipv6 " : "",
dist->list[j],
output ? "out" : "in",
dist->ifname ? dist->ifname : "",
VTY_NEWLINE);
dist->ifname ? dist->ifname : "");
write++;
}
@ -500,12 +499,11 @@ config_write_distribute (struct vty *vty)
if (dist->prefix[j]) {
output = j == DISTRIBUTE_V4_OUT || j == DISTRIBUTE_V6_OUT;
v6 = j == DISTRIBUTE_V6_IN || j == DISTRIBUTE_V6_OUT;
vty_out (vty, " %sdistribute-list prefix %s %s %s%s",
vty_outln (vty, " %sdistribute-list prefix %s %s %s",
v6 ? "ipv6 " : "",
dist->prefix[j],
output ? "out" : "in",
dist->ifname ? dist->ifname : "",
VTY_NEWLINE);
dist->ifname ? dist->ifname : "");
write++;
}
}

View File

@ -576,8 +576,7 @@ vty_access_list_remark_unset (struct vty *vty, afi_t afi, const char *name)
access = access_list_lookup (afi, name);
if (! access)
{
vty_out (vty, "%% access-list %s doesn't exist%s", name,
VTY_NEWLINE);
vty_outln (vty, "%% access-list %s doesn't exist",name);
return CMD_WARNING;
}
@ -616,23 +615,21 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str,
type = FILTER_DENY;
else
{
vty_out (vty, "%% filter type must be permit or deny%s", VTY_NEWLINE);
vty_outln (vty, "%% filter type must be permit or deny");
return CMD_WARNING;
}
ret = inet_aton (addr_str, &addr);
if (ret <= 0)
{
vty_out (vty, "%%Inconsistent address and mask%s",
VTY_NEWLINE);
vty_outln (vty,"%%Inconsistent address and mask");
return CMD_WARNING;
}
ret = inet_aton (addr_mask_str, &addr_mask);
if (ret <= 0)
{
vty_out (vty, "%%Inconsistent address and mask%s",
VTY_NEWLINE);
vty_outln (vty,"%%Inconsistent address and mask");
return CMD_WARNING;
}
@ -641,16 +638,14 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str,
ret = inet_aton (mask_str, &mask);
if (ret <= 0)
{
vty_out (vty, "%%Inconsistent address and mask%s",
VTY_NEWLINE);
vty_outln (vty,"%%Inconsistent address and mask");
return CMD_WARNING;
}
ret = inet_aton (mask_mask_str, &mask_mask);
if (ret <= 0)
{
vty_out (vty, "%%Inconsistent address and mask%s",
VTY_NEWLINE);
vty_outln (vty,"%%Inconsistent address and mask");
return CMD_WARNING;
}
}
@ -1261,9 +1256,9 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str,
if (strlen(name_str) > ACL_NAMSIZ)
{
vty_out (vty, "%% ACL name %s is invalid: length exceeds "
"%d characters%s",
name_str, ACL_NAMSIZ, VTY_NEWLINE);
vty_outln (vty, "%% ACL name %s is invalid: length exceeds "
"%d characters",
name_str, ACL_NAMSIZ);
return CMD_WARNING;
}
@ -1274,7 +1269,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str,
type = FILTER_DENY;
else
{
vty_out (vty, "filter type must be [permit|deny]%s", VTY_NEWLINE);
vty_outln (vty, "filter type must be [permit|deny]");
return CMD_WARNING;
}
@ -1284,8 +1279,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str,
ret = str2prefix_ipv4 (prefix_str, (struct prefix_ipv4 *)&p);
if (ret <= 0)
{
vty_out (vty, "IP address prefix/prefixlen is malformed%s",
VTY_NEWLINE);
vty_outln (vty,"IP address prefix/prefixlen is malformed");
return CMD_WARNING;
}
}
@ -1294,8 +1288,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str,
ret = str2prefix_ipv6 (prefix_str, (struct prefix_ipv6 *) &p);
if (ret <= 0)
{
vty_out (vty, "IPv6 address prefix/prefixlen is malformed%s",
VTY_NEWLINE);
vty_outln (vty,"IPv6 address prefix/prefixlen is malformed");
return CMD_WARNING;
}
}
@ -1431,8 +1424,7 @@ DEFUN (no_access_list_all,
access = access_list_lookup (AFI_IP, argv[idx_acl]->arg);
if (access == NULL)
{
vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_acl]->arg,
VTY_NEWLINE);
vty_outln (vty, "%% access-list %s doesn't exist",argv[idx_acl]->arg);
return CMD_WARNING;
}
@ -1609,8 +1601,7 @@ DEFUN (no_ipv6_access_list_all,
access = access_list_lookup (AFI_IP6, argv[idx_word]->arg);
if (access == NULL)
{
vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_word]->arg,
VTY_NEWLINE);
vty_outln (vty, "%% access-list %s doesn't exist",argv[idx_word]->arg);
return CMD_WARNING;
}
@ -1697,7 +1688,7 @@ filter_show (struct vty *vty, const char *name, afi_t afi)
return 0;
/* Print the name of the protocol */
vty_out(vty, "%s:%s", frr_protoname, VTY_NEWLINE);
vty_outln (vty, "%s:", frr_protoname);
for (access = master->num.head; access; access = access->next)
{
@ -1712,11 +1703,11 @@ filter_show (struct vty *vty, const char *name, afi_t afi)
if (write)
{
vty_out (vty, "%s IP%s access list %s%s",
vty_outln (vty, "%s IP%s access list %s",
mfilter->cisco ?
(filter->extended ? "Extended" : "Standard") : "Zebra",
afi == AFI_IP6 ? "v6" : "",
access->name, VTY_NEWLINE);
access->name);
write = 0;
}
@ -1730,13 +1721,13 @@ filter_show (struct vty *vty, const char *name, afi_t afi)
else
{
if (filter->addr_mask.s_addr == 0xffffffff)
vty_out (vty, " any%s", VTY_NEWLINE);
vty_outln (vty, " any");
else
{
vty_out (vty, " %s", inet_ntoa (filter->addr));
if (filter->addr_mask.s_addr != 0)
vty_out (vty, ", wildcard bits %s", inet_ntoa (filter->addr_mask));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
}
@ -1755,11 +1746,11 @@ filter_show (struct vty *vty, const char *name, afi_t afi)
if (write)
{
vty_out (vty, "%s IP%s access list %s%s",
vty_outln (vty, "%s IP%s access list %s",
mfilter->cisco ?
(filter->extended ? "Extended" : "Standard") : "Zebra",
afi == AFI_IP6 ? "v6" : "",
access->name, VTY_NEWLINE);
access->name);
write = 0;
}
@ -1773,13 +1764,13 @@ filter_show (struct vty *vty, const char *name, afi_t afi)
else
{
if (filter->addr_mask.s_addr == 0xffffffff)
vty_out (vty, " any%s", VTY_NEWLINE);
vty_outln (vty, " any");
else
{
vty_out (vty, " %s", inet_ntoa (filter->addr));
if (filter->addr_mask.s_addr != 0)
vty_out (vty, ", wildcard bits %s", inet_ntoa (filter->addr_mask));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
}
@ -1864,18 +1855,18 @@ config_write_access_cisco (struct vty *vty, struct filter *mfilter)
vty_out (vty, " %s", inet_ntoa (filter->mask));
vty_out (vty, " %s", inet_ntoa (filter->mask_mask));
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
else
{
if (filter->addr_mask.s_addr == 0xffffffff)
vty_out (vty, " any%s", VTY_NEWLINE);
vty_outln (vty, " any");
else
{
vty_out (vty, " %s", inet_ntoa (filter->addr));
if (filter->addr_mask.s_addr != 0)
vty_out (vty, " %s", inet_ntoa (filter->addr_mask));
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
}
@ -1898,7 +1889,7 @@ config_write_access_zebra (struct vty *vty, struct filter *mfilter)
p->prefixlen,
filter->exact ? " exact-match" : "");
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
static int
@ -1917,10 +1908,9 @@ config_write_access (struct vty *vty, afi_t afi)
{
if (access->remark)
{
vty_out (vty, "%saccess-list %s remark %s%s",
vty_outln (vty, "%saccess-list %s remark %s",
afi == AFI_IP ? "" : "ipv6 ",
access->name, access->remark,
VTY_NEWLINE);
access->name,access->remark);
write++;
}
@ -1944,10 +1934,9 @@ config_write_access (struct vty *vty, afi_t afi)
{
if (access->remark)
{
vty_out (vty, "%saccess-list %s remark %s%s",
vty_outln (vty, "%saccess-list %s remark %s",
afi == AFI_IP ? "" : "ipv6 ",
access->name, access->remark,
VTY_NEWLINE);
access->name,access->remark);
write++;
}

View File

@ -86,7 +86,7 @@ struct frr_pthread *frr_pthread_new(const char *name, unsigned int id,
XCALLOC(MTYPE_FRR_PTHREAD,
sizeof(struct frr_pthread));
fpt->id = id;
fpt->master = thread_master_create();
fpt->master = thread_master_create(name);
fpt->start_routine = start_routine;
fpt->stop_routine = stop_routine;
fpt->name = XSTRDUP(MTYPE_FRR_PTHREAD, name);

View File

@ -118,7 +118,7 @@ DEFUN (grammar_test_complete,
// print completions
for (i = 0; i < vector_active (comps); i++) {
tkn = vector_slot (comps, i);
vty_out (vty, " %-*s %s%s", width, tkn->text, tkn->desc, VTY_NEWLINE);
vty_outln (vty, " %-*s %s", width, tkn->text, tkn->desc);
}
for (i = 0; i < vector_active (comps); i++)
@ -126,7 +126,7 @@ DEFUN (grammar_test_complete,
vector_free (comps);
}
else
vty_out (vty, "%% No match%s", VTY_NEWLINE);
vty_outln (vty, "%% No match");
// free resources
list_delete (completions);
@ -164,13 +164,13 @@ DEFUN (grammar_test_match,
// print completions or relevant error message
if (element)
{
vty_out (vty, "Matched: %s%s", element->string, VTY_NEWLINE);
vty_outln (vty, "Matched: %s", element->string);
struct listnode *ln;
struct cmd_token *token;
for (ALL_LIST_ELEMENTS_RO(argvv,ln,token))
vty_out (vty, "%s -- %s%s", token->text, token->arg, VTY_NEWLINE);
vty_outln (vty, "%s -- %s", token->text, token->arg);
vty_out (vty, "func: %p%s", element->func, VTY_NEWLINE);
vty_outln (vty, "func: %p", element->func);
list_delete (argvv);
}
@ -178,16 +178,16 @@ DEFUN (grammar_test_match,
assert(MATCHER_ERROR(result));
switch (result) {
case MATCHER_NO_MATCH:
vty_out (vty, "%% Unknown command%s", VTY_NEWLINE);
vty_outln (vty, "%% Unknown command");
break;
case MATCHER_INCOMPLETE:
vty_out (vty, "%% Incomplete command%s", VTY_NEWLINE);
vty_outln (vty, "%% Incomplete command");
break;
case MATCHER_AMBIGUOUS:
vty_out (vty, "%% Ambiguous command%s", VTY_NEWLINE);
vty_outln (vty, "%% Ambiguous command");
break;
default:
vty_out (vty, "%% Unknown error%s", VTY_NEWLINE);
vty_outln (vty, "%% Unknown error");
break;
}
}
@ -401,7 +401,7 @@ DEFUN (grammar_findambig,
nodegraph = cnode->cmdgraph;
if (!nodegraph)
continue;
vty_out (vty, "scanning node %d%s", scannode - 1, VTY_NEWLINE);
vty_outln (vty, "scanning node %d", scannode - 1);
}
commands = cmd_graph_permutations (nodegraph);
@ -410,23 +410,25 @@ DEFUN (grammar_findambig,
{
int same = prev && !strcmp (prev->cmd, cur->cmd);
if (printall && !same)
vty_out (vty, "'%s' [%x]%s", cur->cmd, cur->el->daemon, VTY_NEWLINE);
vty_outln (vty, "'%s' [%x]", cur->cmd, cur->el->daemon);
if (same)
{
vty_out (vty, "'%s' AMBIGUOUS:%s", cur->cmd, VTY_NEWLINE);
vty_out (vty, " %s%s '%s'%s", prev->el->name, VTY_NEWLINE, prev->el->string, VTY_NEWLINE);
vty_out (vty, " %s%s '%s'%s", cur->el->name, VTY_NEWLINE, cur->el->string, VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE);
vty_outln (vty, "'%s' AMBIGUOUS:", cur->cmd);
vty_outln (vty, " %s%s '%s'", prev->el->name, VTYNL,
prev->el->string);
vty_outln (vty, " %s%s '%s'", cur->el->name, VTYNL,
cur->el->string);
vty_out (vty, VTYNL);
ambig++;
}
prev = cur;
}
list_delete (commands);
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
} while (scan && scannode < LINK_PARAMS_NODE);
vty_out (vty, "%d ambiguous commands found.%s", ambig, VTY_NEWLINE);
vty_outln (vty, "%d ambiguous commands found.", ambig);
if (scan)
nodegraph = NULL;
@ -463,11 +465,11 @@ DEFUN (grammar_access,
cnode = vector_slot (cmdvec, atoi (argv[2]->arg));
if (!cnode)
{
vty_out (vty, "%% no such node%s", VTY_NEWLINE);
vty_outln (vty, "%% no such node");
return CMD_WARNING;
}
vty_out (vty, "node %d%s", (int)cnode->node, VTY_NEWLINE);
vty_outln (vty, "node %d", (int)cnode->node);
nodegraph = cnode->cmdgraph;
return CMD_SUCCESS;
}
@ -532,7 +534,7 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level,
if (stackpos == MAXDEPTH)
{
vty_out(vty, " -aborting! (depth limit)%s", VTY_NEWLINE);
vty_outln (vty, " -aborting! (depth limit)");
return;
}
stack[stackpos++] = start;
@ -541,7 +543,7 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level,
if (numto)
{
if (numto > 1)
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
for (unsigned int i = 0; i < vector_active (start->to); i++)
{
struct graph_node *adj = vector_slot (start->to, i);
@ -553,12 +555,12 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level,
if (adj == start)
vty_out(vty, "*");
else if (((struct cmd_token *)adj->data)->type == END_TKN)
vty_out(vty, "--END%s", VTY_NEWLINE);
vty_outln (vty, "--END");
else {
size_t k;
for (k = 0; k < stackpos; k++)
if (stack[k] == adj) {
vty_out(vty, "<<loop@%zu %s", k, VTY_NEWLINE);
vty_outln (vty, "<<loop@%zu ", k);
break;
}
if (k == stackpos)
@ -567,7 +569,7 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level,
}
}
else
vty_out(vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
static void
@ -650,5 +652,5 @@ init_cmdgraph (struct vty *vty, struct graph **graph)
struct cmd_token *token = cmd_token_new (START_TKN, 0, NULL, NULL);
graph_new_node (*graph, token, (void (*)(void *)) &cmd_token_del);
if (vty)
vty_out (vty, "initialized graph%s", VTY_NEWLINE);
vty_outln (vty, "initialized graph");
}

View File

@ -38,7 +38,7 @@ int main(int argc, char **argv)
{
struct thread thread;
master = thread_master_create ();
master = thread_master_create(NULL);
openzlog ("grammar_sandbox", "NONE", 0,
LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);

View File

@ -158,7 +158,7 @@ if_create (const char *name, int namelen, vrf_id_t vrf_id)
/* Create new interface structure. */
void
if_update (struct interface *ifp, const char *name, int namelen, vrf_id_t vrf_id)
if_update_to_new_vrf (struct interface *ifp, vrf_id_t vrf_id)
{
struct list *intf_list = vrf_iflist_get (vrf_id);
@ -166,10 +166,6 @@ if_update (struct interface *ifp, const char *name, int namelen, vrf_id_t vrf_id
if (vrf_iflist (ifp->vrf_id))
listnode_delete (vrf_iflist (ifp->vrf_id), ifp);
assert (name);
assert (namelen <= INTERFACE_NAMSIZ); /* Need space for '\0' at end. */
strncpy (ifp->name, name, namelen);
ifp->name[namelen] = '\0';
ifp->vrf_id = vrf_id;
if (if_lookup_by_name (ifp->name, vrf_id) == NULL)
listnode_add_sort (intf_list, ifp);
@ -453,7 +449,7 @@ if_get_by_name_len (const char *name, size_t namelen, vrf_id_t vrf_id, int vty)
}
else
{
if_update (ifp, name, namelen, vrf_id);
if_update_to_new_vrf (ifp, vrf_id);
return ifp;
}
}
@ -694,9 +690,9 @@ DEFUN (interface,
if ((sl = strlen(ifname)) > INTERFACE_NAMSIZ)
{
vty_out (vty, "%% Interface name %s is invalid: length exceeds "
"%d characters%s",
ifname, INTERFACE_NAMSIZ, VTY_NEWLINE);
vty_outln (vty, "%% Interface name %s is invalid: length exceeds "
"%d characters",
ifname, INTERFACE_NAMSIZ);
return CMD_WARNING;
}
@ -713,7 +709,7 @@ DEFUN (interface,
if (!ifp)
{
vty_out (vty, "%% interface %s not in %s%s", ifname, vrfname, VTY_NEWLINE);
vty_outln (vty, "%% interface %s not in %s", ifname, vrfname);
return CMD_WARNING;
}
VTY_PUSH_CONTEXT (INTERFACE_NODE, ifp);
@ -743,14 +739,14 @@ DEFUN_NOSH (no_interface,
if (ifp == NULL)
{
vty_out (vty, "%% Interface %s does not exist%s", ifname, VTY_NEWLINE);
vty_out (vty, "%% Interface %s does not exist%s", ifname, VTYNL);
return CMD_WARNING;
}
if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
vty_out (vty, "%% Only inactive interfaces can be deleted%s",
VTY_NEWLINE);
VTYNL);
return CMD_WARNING;
}
@ -798,7 +794,7 @@ DEFUN (show_address,
if (p->family == AF_INET)
vty_out (vty, "%s/%d%s", inet_ntoa (p->u.prefix4), p->prefixlen,
VTY_NEWLINE);
VTYNL);
}
}
return CMD_SUCCESS;
@ -823,8 +819,8 @@ DEFUN (show_address_vrf_all,
if (!vrf->iflist || !listcount (vrf->iflist))
continue;
vty_out (vty, "%sVRF %u%s%s", VTY_NEWLINE, vrf->vrf_id, VTY_NEWLINE,
VTY_NEWLINE);
vty_out (vty, "%sVRF %u%s%s", VTYNL, vrf->vrf_id, VTYNL,
VTYNL);
for (ALL_LIST_ELEMENTS_RO (vrf->iflist, node, ifp))
{
@ -834,7 +830,7 @@ DEFUN (show_address_vrf_all,
if (p->family == AF_INET)
vty_out (vty, "%s/%d%s", inet_ntoa (p->u.prefix4), p->prefixlen,
VTY_NEWLINE);
VTYNL);
}
}
}

View File

@ -393,8 +393,7 @@ struct nbr_connected
/* Prototypes. */
extern int if_cmp_name_func (char *, char *);
extern void if_update (struct interface *, const char *name, int namelen,
vrf_id_t vrf_id);
extern void if_update_to_new_vrf (struct interface *, vrf_id_t vrf_id);
extern struct interface *if_create (const char *name, int namelen,
vrf_id_t vrf_id);
extern struct interface *if_lookup_by_index (ifindex_t, vrf_id_t vrf_id);

View File

@ -228,7 +228,7 @@ DEFUN (if_rmap,
type = IF_RMAP_OUT;
else
{
vty_out (vty, "route-map direction must be [in|out]%s", VTY_NEWLINE);
vty_outln (vty, "route-map direction must be [in|out]");
return CMD_WARNING;
}
@ -259,14 +259,14 @@ DEFUN (no_if_rmap,
type = IF_RMAP_OUT;
else
{
vty_out (vty, "route-map direction must be [in|out]%s", VTY_NEWLINE);
vty_outln (vty, "route-map direction must be [in|out]");
return CMD_WARNING;
}
ret = if_rmap_unset (argv[idx_ifname]->arg, type, argv[idx_routemap_name]->arg);
if (! ret)
{
vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE);
vty_outln (vty, "route-map doesn't exist");
return CMD_WARNING;
}
return CMD_SUCCESS;
@ -290,19 +290,17 @@ config_write_if_rmap (struct vty *vty)
if (if_rmap->routemap[IF_RMAP_IN])
{
vty_out (vty, " route-map %s in %s%s",
vty_outln (vty, " route-map %s in %s",
if_rmap->routemap[IF_RMAP_IN],
if_rmap->ifname,
VTY_NEWLINE);
if_rmap->ifname);
write++;
}
if (if_rmap->routemap[IF_RMAP_OUT])
{
vty_out (vty, " route-map %s out %s%s",
vty_outln (vty, " route-map %s out %s",
if_rmap->routemap[IF_RMAP_OUT],
if_rmap->ifname,
VTY_NEWLINE);
if_rmap->ifname);
write++;
}
}

View File

@ -34,7 +34,7 @@ use_json (const int argc, struct cmd_token *argv[])
if (argc == 0)
return 0;
if (argv[argc-1]->arg && strcmp(argv[argc-1]->arg, "json") == 0)
if (argv[argc-1]->arg && strmatch (argv[argc-1]->text, "json"))
return 1;
return 0;
@ -48,13 +48,7 @@ json_object_string_add(struct json_object* obj, const char *key,
}
void
json_object_int_add(struct json_object* obj, const char *key, int32_t i)
{
json_object_object_add(obj, key, json_object_new_int(i));
}
void
json_object_long_add(struct json_object* obj, const char *key, int64_t i)
json_object_int_add(struct json_object* obj, const char *key, int64_t i)
{
#if defined(HAVE_JSON_C_JSON_H)
json_object_object_add(obj, key, json_object_new_int64(i));

View File

@ -43,8 +43,6 @@ extern int use_json(const int argc, struct cmd_token *argv[]);
extern void json_object_string_add(struct json_object* obj, const char *key,
const char *s);
extern void json_object_int_add(struct json_object* obj, const char *key,
int32_t i);
extern void json_object_long_add(struct json_object* obj, const char *key,
int64_t i);
extern void json_object_boolean_false_add(struct json_object* obj,
const char *key);

View File

@ -271,7 +271,7 @@ DEFUN (no_key_chain,
if (! keychain)
{
vty_out (vty, "Can't find keychain %s%s", argv[idx_word]->arg, VTY_NEWLINE);
vty_outln (vty, "Can't find keychain %s", argv[idx_word]->arg);
return CMD_WARNING;
}
@ -291,7 +291,7 @@ DEFUN_NOSH (key,
struct key *key;
u_int32_t index;
VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg);
index = strtoul (argv[idx_number]->arg, NULL, 10);
key = key_get (keychain, index);
VTY_PUSH_CONTEXT_SUB (KEYCHAIN_KEY_NODE, key);
@ -310,11 +310,11 @@ DEFUN (no_key,
struct key *key;
u_int32_t index;
VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg);
index = strtoul(argv[idx_number]->arg, NULL, 10);
key = key_lookup (keychain, index);
if (! key)
{
vty_out (vty, "Can't find key %d%s", index, VTY_NEWLINE);
vty_outln (vty, "Can't find key %d", index);
return CMD_WARNING;
}
@ -477,20 +477,20 @@ key_lifetime_set (struct vty *vty, struct key_range *krange,
time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str);
if (time_start < 0)
{
vty_out (vty, "Malformed time value%s", VTY_NEWLINE);
vty_outln (vty, "Malformed time value");
return CMD_WARNING;
}
time_end = key_str2time (etime_str, eday_str, emonth_str, eyear_str);
if (time_end < 0)
{
vty_out (vty, "Malformed time value%s", VTY_NEWLINE);
vty_outln (vty, "Malformed time value");
return CMD_WARNING;
}
if (time_end <= time_start)
{
vty_out (vty, "Expire time is not later than start time%s", VTY_NEWLINE);
vty_outln (vty, "Expire time is not later than start time");
return CMD_WARNING;
}
@ -512,12 +512,12 @@ key_lifetime_duration_set (struct vty *vty, struct key_range *krange,
time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str);
if (time_start < 0)
{
vty_out (vty, "Malformed time value%s", VTY_NEWLINE);
vty_outln (vty, "Malformed time value");
return CMD_WARNING;
}
krange->start = time_start;
VTY_GET_INTEGER ("duration", duration, duration_str);
duration = strtoul(duration_str, NULL, 10);
krange->duration = 1;
krange->end = time_start + duration;
@ -534,7 +534,7 @@ key_lifetime_infinite_set (struct vty *vty, struct key_range *krange,
time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str);
if (time_start < 0)
{
vty_out (vty, "Malformed time value%s", VTY_NEWLINE);
vty_outln (vty, "Malformed time value");
return CMD_WARNING;
}
krange->start = time_start;
@ -966,14 +966,14 @@ keychain_config_write (struct vty *vty)
for (ALL_LIST_ELEMENTS_RO (keychain_list, node, keychain))
{
vty_out (vty, "key chain %s%s", keychain->name, VTY_NEWLINE);
vty_outln (vty, "key chain %s", keychain->name);
for (ALL_LIST_ELEMENTS_RO (keychain->key, knode, key))
{
vty_out (vty, " key %d%s", key->index, VTY_NEWLINE);
vty_outln (vty, " key %d", key->index);
if (key->string)
vty_out (vty, " key-string %s%s", key->string, VTY_NEWLINE);
vty_outln (vty, " key-string %s", key->string);
if (key->accept.start)
{
@ -990,7 +990,7 @@ keychain_config_write (struct vty *vty)
keychain_strftime (buf, BUFSIZ, &key->accept.end);
vty_out (vty, " %s", buf);
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
if (key->send.start)
@ -1007,10 +1007,10 @@ keychain_config_write (struct vty *vty)
keychain_strftime (buf, BUFSIZ, &key->send.end);
vty_out (vty, " %s", buf);
}
vty_out (vty, "%s", VTY_NEWLINE);
vty_out (vty, VTYNL);
}
}
vty_out (vty, "!%s", VTY_NEWLINE);
vty_outln (vty, "!");
}
return 0;

View File

@ -366,7 +366,7 @@ struct thread_master *frr_init(void)
zprivs_init(di->privs);
master = thread_master_create();
master = thread_master_create(NULL);
signal_init(master, di->n_signals, di->signals);
if (di->flags & FRR_LIMITED_CLI)

View File

@ -509,16 +509,18 @@ zlog_signal(int signo, const char *action
);
s = buf;
if (!thread_current)
struct thread *tc;
tc = pthread_getspecific (thread_current);
if (!tc)
s = str_append (LOC, "no thread information available\n");
else
{
s = str_append (LOC, "in thread ");
s = str_append (LOC, thread_current->funcname);
s = str_append (LOC, tc->funcname);
s = str_append (LOC, " scheduled from ");
s = str_append (LOC, thread_current->schedfrom);
s = str_append (LOC, tc->schedfrom);
s = str_append (LOC, ":");
s = num_append (LOC, thread_current->schedfrom_line);
s = num_append (LOC, tc->schedfrom_line);
s = str_append (LOC, "\n");
}
@ -700,10 +702,13 @@ ZLOG_FUNC(zlog_debug, LOG_DEBUG)
void zlog_thread_info (int log_level)
{
if (thread_current)
struct thread *tc;
tc = pthread_getspecific (thread_current);
if (tc)
zlog(log_level, "Current thread function %s, scheduled from "
"file %s, line %u", thread_current->funcname,
thread_current->schedfrom, thread_current->schedfrom_line);
"file %s, line %u", tc->funcname,
tc->schedfrom, tc->schedfrom_line);
else
zlog(log_level, "Current thread not known/applicable");
}

View File

@ -44,36 +44,26 @@ show_memory_mallinfo (struct vty *vty)
struct mallinfo minfo = mallinfo();
char buf[MTYPE_MEMSTR_LEN];
vty_out (vty, "System allocator statistics:%s", VTY_NEWLINE);
vty_out (vty, " Total heap allocated: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena),
VTY_NEWLINE);
vty_out (vty, " Holding block headers: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd),
VTY_NEWLINE);
vty_out (vty, " Used small blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks),
VTY_NEWLINE);
vty_out (vty, " Used ordinary blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks),
VTY_NEWLINE);
vty_out (vty, " Free small blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks),
VTY_NEWLINE);
vty_out (vty, " Free ordinary blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks),
VTY_NEWLINE);
vty_out (vty, " Ordinary blocks: %ld%s",
(unsigned long)minfo.ordblks,
VTY_NEWLINE);
vty_out (vty, " Small blocks: %ld%s",
(unsigned long)minfo.smblks,
VTY_NEWLINE);
vty_out (vty, " Holding blocks: %ld%s",
(unsigned long)minfo.hblks,
VTY_NEWLINE);
vty_out (vty, "(see system documentation for 'mallinfo' for meaning)%s",
VTY_NEWLINE);
vty_outln (vty, "System allocator statistics:");
vty_outln (vty, " Total heap allocated: %s",
mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.arena));
vty_outln (vty, " Holding block headers: %s",
mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.hblkhd));
vty_outln (vty, " Used small blocks: %s",
mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.usmblks));
vty_outln (vty, " Used ordinary blocks: %s",
mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.uordblks));
vty_outln (vty, " Free small blocks: %s",
mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fsmblks));
vty_outln (vty, " Free ordinary blocks: %s",
mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fordblks));
vty_outln (vty, " Ordinary blocks: %ld",
(unsigned long)minfo.ordblks);
vty_outln (vty, " Small blocks: %ld",
(unsigned long)minfo.smblks);
vty_outln (vty, " Holding blocks: %ld",
(unsigned long)minfo.hblks);
vty_outln (vty,"(see system documentation for 'mallinfo' for meaning)");
return 1;
}
#endif /* HAVE_MALLINFO */
@ -82,16 +72,14 @@ static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt)
{
struct vty *vty = arg;
if (!mt)
vty_out (vty, "--- qmem %s ---%s", mg->name, VTY_NEWLINE);
vty_outln (vty, "--- qmem %s ---", mg->name);
else {
if (mt->n_alloc != 0) {
char size[32];
snprintf(size, sizeof(size), "%6zu", mt->size);
vty_out (vty, "%-30s: %10zu %s%s",
vty_outln (vty, "%-30s: %10zu %s",
mt->name, mt->n_alloc,
mt->size == 0 ? "" :
mt->size == SIZE_VAR ? "(variably sized)" :
size, VTY_NEWLINE);
mt->size == 0 ? "" : mt->size == SIZE_VAR ? "(variably sized)" : size);
}
}
return 0;
@ -120,15 +108,14 @@ DEFUN (show_modules,
{
struct frrmod_runtime *plug = frrmod_list;
vty_out (vty, "%-12s %-25s %s%s%s",
vty_outln (vty, "%-12s %-25s %s%s",
"Module Name", "Version", "Description",
VTY_NEWLINE, VTY_NEWLINE);
VTYNL);
while (plug)
{
const struct frrmod_info *i = plug->info;
vty_out (vty, "%-12s %-25s %s%s", i->name, i->version, i->description,
VTY_NEWLINE);
vty_outln (vty, "%-12s %-25s %s", i->name, i->version,i->description);
if (plug->dl_handle)
{
#ifdef HAVE_DLINFO_ORIGIN
@ -142,13 +129,13 @@ DEFUN (show_modules,
{
name = strrchr(lm->l_name, '/');
name = name ? name + 1 : lm->l_name;
vty_out (vty, "\tfrom: %s/%s%s", origin, name, VTY_NEWLINE);
vty_outln (vty, "\tfrom: %s/%s", origin, name);
}
# else
vty_out (vty, "\tfrom: %s %s", origin, plug->load_name, VTY_NEWLINE);
vty_outln (vty, "\tfrom: %s ", origin, plug->load_name);
# endif
#else
vty_out (vty, "\tfrom: %s%s", plug->load_name, VTY_NEWLINE);
vty_outln (vty, "\tfrom: %s", plug->load_name);
#endif
}
plug = plug->next;

View File

@ -296,8 +296,7 @@ ns_netns_pathname (struct vty *vty, const char *name)
if (! result)
{
vty_out (vty, "Invalid pathname: %s%s", safe_strerror (errno),
VTY_NEWLINE);
vty_outln (vty, "Invalid pathname: %s",safe_strerror(errno));
return NULL;
}
return pathname;
@ -320,13 +319,13 @@ DEFUN_NOSH (ns_netns,
if (!pathname)
return CMD_WARNING;
VTY_GET_INTEGER ("NS ID", ns_id, argv[idx_number]->arg);
ns_id = strtoul (argv[idx_number]->arg, NULL, 10);
ns = ns_get (ns_id);
if (ns->name && strcmp (ns->name, pathname) != 0)
{
vty_out (vty, "NS %u is already configured with NETNS %s%s",
ns->ns_id, ns->name, VTY_NEWLINE);
ns->ns_id, ns->name, VTYNL);
return CMD_WARNING;
}
@ -336,7 +335,7 @@ DEFUN_NOSH (ns_netns,
if (!ns_enable (ns))
{
vty_out (vty, "Can not associate NS %u with NETNS %s%s",
ns->ns_id, ns->name, VTY_NEWLINE);
ns->ns_id, ns->name, VTYNL);
return CMD_WARNING;
}
@ -361,18 +360,18 @@ DEFUN (no_ns_netns,
if (!pathname)
return CMD_WARNING;
VTY_GET_INTEGER ("NS ID", ns_id, argv[idx_number]->arg);
ns_id = strtoul(argv[idx_number]->arg, NULL, 10);
ns = ns_lookup (ns_id);
if (!ns)
{
vty_out (vty, "NS %u is not found%s", ns_id, VTY_NEWLINE);
vty_outln (vty, "NS %u is not found", ns_id);
return CMD_SUCCESS;
}
if (ns->name && strcmp (ns->name, pathname) != 0)
{
vty_out (vty, "Incorrect NETNS file name%s", VTY_NEWLINE);
vty_outln (vty, "Incorrect NETNS file name");
return CMD_WARNING;
}
@ -406,8 +405,7 @@ ns_config_write (struct vty *vty)
if (ns->ns_id == NS_DEFAULT || ns->name == NULL)
continue;
vty_out (vty, "logical-router %u netns %s%s", ns->ns_id, ns->name,
VTY_NEWLINE);
vty_outln (vty, "logical-router %u netns %s", ns->ns_id,ns->name);
write = 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -292,6 +292,31 @@ prefix_match (const struct prefix *n, const struct prefix *p)
return 1;
}
/* If n includes p then return 1 else return 0. Prefix mask is not considered */
int
prefix_match_network_statement (const struct prefix *n, const struct prefix *p)
{
int offset;
int shift;
const u_char *np, *pp;
/* Set both prefix's head pointer. */
np = (const u_char *)&n->u.prefix;
pp = (const u_char *)&p->u.prefix;
offset = n->prefixlen / PNBBY;
shift = n->prefixlen % PNBBY;
if (shift)
if (maskbit[shift] & (np[offset] ^ pp[offset]))
return 0;
while (offset--)
if (np[offset] != pp[offset])
return 0;
return 1;
}
/* Copy prefix from src to dest. */
void
prefix_copy (struct prefix *dest, const struct prefix *src)

View File

@ -279,6 +279,7 @@ extern int str2prefix (const char *, struct prefix *);
extern const char *prefix2str (union prefixconstptr, char *, int);
extern int prefix_match (const struct prefix *, const struct prefix *);
extern int prefix_match_network_statement (const struct prefix *, const struct prefix *);
extern int prefix_same (const struct prefix *, const struct prefix *);
extern int prefix_cmp (const struct prefix *, const struct prefix *);
extern int prefix_common_bits (const struct prefix *, const struct prefix *);

View File

@ -123,7 +123,7 @@ sub codelist {
push @lines, " \" > - selected route, * - FIB route%s%s\", \\\n";
my @nl = ();
for (my $c = 0; $c < @lines + 1; $c++) {
push @nl, "VTY_NEWLINE"
push @nl, "VTYNL"
}
return join("", @lines) ." ". join(", ", @nl);
}

Some files were not shown because too many files have changed in this diff Show More