debian/quagga.substvars
debian/quagga/
debian/tmp/
+*.pyc
*.swp
cscope.*
*.pb.h
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 \
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;
}
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;
}
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);
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);
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);
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);
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);
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);
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);
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);
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,
}
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);
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,
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,
}
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) {
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),
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
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,
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;
}
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;
}
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;
}
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;
}
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;
}
"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;
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;
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;
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"
"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);
}
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;
}
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;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[2]->arg);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[3]->arg);
return CMD_WARNING;
}
if (debug == BABEL_DEBUG_ALL)
{
- vty_out (vty, "debug babel all%s", VTY_NEWLINE);
+ vty_outln (vty, "debug babel all");
lines++;
}
else
&& 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;
{
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;
babel_zebra_close_connexion(void)
{
zclient_stop(zclient);
+ zclient_free(zclient);
}
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 */
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++;
}
{
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;
{
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;
{
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;
.arch-ids
*~
*.loT
+*clippy.c
## 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
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
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
{
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
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);
}
/*
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;
&& 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 *
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);
}
}
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;
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* Print the command to enable the debug for each peer/prefix this debug is
{
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++;
}
}
if (!write)
{
- vty_out (vty, "%s%s", desc, VTY_NEWLINE);
+ vty_outln (vty, "%s", desc);
write++;
}
}
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;
else if (p)
{
filter->host = NULL;
- filter->p = p;
+ filter->p = prefix_new();
+ prefix_copy (filter->p, p);
}
listnode_add(list, filter);
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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"
"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)
{
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;
if (!ret)
{
prefix_free(argv_p);
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
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;
}
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;
}
{
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;
}
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;
{
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;
}
}
{
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;
}
}
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;
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
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)");
}
}
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");
}
}
}
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");
}
}
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;
}
if (!ret)
{
prefix_free(argv_p);
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
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;
}
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;
if (!ret)
{
prefix_free(argv_p);
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
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;
}
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;
}
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;
}
if (!ret)
{
prefix_free(argv_p);
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
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;
}
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;
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;
}
if (!ret)
{
prefix_free(argv_p);
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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",
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",
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;
}
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++;
}
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++;
}
{
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
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++;
}
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;
}
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)
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)
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)
{
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;
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;
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;
}
} 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;
ip),
rd_ip.
val);
- vty_out(vty, "%s",
- VTY_NEWLINE);
+ vty_outln (vty, VTYNL);
}
rd_header = 0;
}
}
}
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;
}
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,
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,
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
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);
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;
}
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;
}
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,
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;
}
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;
}
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;
}
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;
}
if (asfilter == NULL)
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
return CMD_WARNING;
}
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;
}
{
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);
}
}
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);
}
}
}
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;
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;
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;
}
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;
}
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;
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;
}
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;
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));
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);
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);
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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);
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);
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;
}
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;
}
"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;
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])
{
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);
}
}
}
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;
}
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);
}
}
vty_out (vty, "SAFI Unknown %d ", mpc.safi);
break;
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
else if (hdr->code >= 128)
ret = str2prefix (ip_str, &p);
if (! ret)
{
- vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed prefix");
return CMD_WARNING;
}
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6))
{
- vty_out (vty, "%% Malformed prefix (link-local address)%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% Malformed prefix (link-local address)");
return CMD_WARNING;
}
/* Label index cannot be changed. */
if (bgp_static->label_index != label_index)
{
- vty_out (vty, "%% Label index cannot be changed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Label index cannot be changed");
return CMD_WARNING;
}
ret = str2prefix (ip_str, &p);
if (! ret)
{
- vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed prefix");
return CMD_WARNING;
}
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6))
{
- vty_out (vty, "%% Malformed prefix (link-local address)%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% Malformed prefix (link-local address)");
return CMD_WARNING;
}
rn = bgp_node_lookup (bgp->route[afi][safi], &p);
if (! rn)
{
- vty_out (vty, "%% Can't find specified static route configuration.%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% Can't find specified static route configuration.");
return CMD_WARNING;
}
ret = str2prefix (ip_str, &p);
if (! ret)
{
- vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed prefix");
return CMD_WARNING;
}
apply_mask (&p);
if ( (afi == AFI_L2VPN) &&
(bgp_build_evpn_prefix ( evpn_type, ethtag!=NULL?atol(ethtag):0, &p)))
{
- vty_out (vty, "%% L2VPN prefix could not be forged%s", VTY_NEWLINE);
+ vty_outln (vty, "%% L2VPN prefix could not be forged");
return CMD_WARNING;
}
ret = str2prefix_rd (rd_str, &prd);
if (! ret)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
if (label_str)
{
unsigned long label_val;
- VTY_GET_INTEGER_RANGE("Label", label_val, label_str, 0, 16777215);
+ label_val = strtoul(label_str, NULL, 10);
encode_label (label_val, &label);
}
{
if( esi && str2esi (esi, NULL) == 0)
{
- vty_out (vty, "%% Malformed ESI%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed ESI");
return CMD_WARNING;
}
if( routermac && prefix_str2mac (routermac, NULL) == 0)
{
- vty_out (vty, "%% Malformed Router MAC%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Router MAC");
return CMD_WARNING;
}
if (gwip)
ret = str2prefix (gwip, &gw_ip);
if (! ret)
{
- vty_out (vty, "%% Malformed GatewayIp%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed GatewayIp");
return CMD_WARNING;
}
if((gw_ip.family == AF_INET && (p.u.prefix_evpn.flags & IP_PREFIX_V6))
|| (gw_ip.family == AF_INET6 && (p.u.prefix_evpn.flags & IP_PREFIX_V4)))
{
- vty_out (vty, "%% GatewayIp family differs with IP prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% GatewayIp family differs with IP prefix");
return CMD_WARNING;
}
}
if (rn->info)
{
- vty_out (vty, "%% Same network configuration exists%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Same network configuration exists");
bgp_unlock_node (rn);
}
else
ret = str2prefix (ip_str, &p);
if (! ret)
{
- vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed prefix");
return CMD_WARNING;
}
apply_mask (&p);
if ( (afi == AFI_L2VPN) &&
(bgp_build_evpn_prefix ( evpn_type, ethtag!=NULL?atol(ethtag):0, &p)))
{
- vty_out (vty, "%% L2VPN prefix could not be forged%s", VTY_NEWLINE);
+ vty_outln (vty, "%% L2VPN prefix could not be forged");
return CMD_WARNING;
}
ret = str2prefix_rd (rd_str, &prd);
if (! ret)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
if (label_str)
{
unsigned long label_val;
- VTY_GET_INTEGER_RANGE("Label", label_val, label_str, 0, MPLS_LABEL_MAX);
+ label_val = strtoul(label_str, NULL, 10);
encode_label (label_val, &label);
}
bgp_unlock_node (rn);
}
else
- vty_out (vty, "%% Can't find the route%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find the route");
return CMD_SUCCESS;
}
if (bgp->table_map[afi][safi].name)
{
bgp_config_write_family_header (vty, afi, safi, write);
- vty_out (vty, " table-map %s%s",
- bgp->table_map[afi][safi].name, VTY_NEWLINE);
+ vty_outln (vty, " table-map %s",
+ bgp->table_map[afi][safi].name);
}
return 0;
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
{
u_int32_t label_index;
- VTY_GET_INTEGER ("label-index", label_index, argv[3]->arg);
+ label_index = strtoul(argv[3]->arg, NULL, 10);
return bgp_static_set (vty, argv[1]->arg,
AFI_IP, bgp_node_safi (vty), NULL, 0, label_index);
}
{
u_int32_t label_index;
- VTY_GET_INTEGER ("label-index", label_index, argv[3]->arg);
+ label_index = strtoul(argv[3]->arg, NULL, 10);
return bgp_static_set (vty, argv[1]->arg,
AFI_IP, bgp_node_safi (vty), argv[5]->arg, 0, label_index);
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, NULL, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
{
u_int32_t label_index;
- VTY_GET_INTEGER ("label-index", label_index, argv[3]->arg);
+ label_index = strtoul(argv[3]->arg, NULL, 10);
return bgp_static_set (vty, argv[1]->arg,
AFI_IP6, bgp_node_safi (vty), NULL, 0, label_index);
}
{
u_int32_t label_index;
- VTY_GET_INTEGER ("label-index", label_index, argv[3]->arg);
+ label_index = strtoul(argv[3]->arg, NULL, 10);
return bgp_static_set (vty, argv[1]->arg,
AFI_IP6, bgp_node_safi (vty), argv[5]->arg, 0, label_index);
}
ret = str2prefix (prefix_str, &p);
if (!ret)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
apply_mask (&p);
rn = bgp_node_lookup (bgp->aggregate[afi][safi], &p);
if (! rn)
{
- vty_out (vty, "%% There is no aggregate-address configuration.%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% There is no aggregate-address configuration.");
return CMD_WARNING;
}
ret = str2prefix (prefix_str, &p);
if (!ret)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
apply_mask (&p);
if (rn->info)
{
- vty_out (vty, "There is already same aggregate network.%s", VTY_NEWLINE);
+ vty_outln (vty, "There is already same aggregate network.");
/* try to remove the old entry */
ret = bgp_aggregate_unset (vty, prefix_str, afi, safi);
if (ret)
{
- vty_out (vty, "Error deleting aggregate.%s", VTY_NEWLINE);
+ vty_outln (vty, "Error deleting aggregate.");
bgp_unlock_node (rn);
return CMD_WARNING;
}
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
len = 17 - len;
if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 20, " ");
+ vty_out (vty, "%s%*s", VTYNL, 20, " ");
else
vty_out (vty, "%*s", len, " ");
}
len = 7 - len; /* len of IPv6 addr + max len of def ifname */
if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 45, " ");
+ vty_out (vty, "%s%*s", VTYNL, 45, " ");
else
vty_out (vty, "%*s", len, " ");
}
len = 16 - len;
if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " ");
+ vty_out (vty, "%s%*s", VTYNL, 36, " ");
else
vty_out (vty, "%*s", len, " ");
}
len = 16 - len;
if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " ");
+ vty_out (vty, "%s%*s", VTYNL, 36, " ");
else
vty_out (vty, "%*s", len, " ");
}
if (json_paths)
json_object_string_add(json_path, "alert", "No attributes");
else
- vty_out (vty, "No attributes to print%s", VTY_NEWLINE);
+ vty_outln (vty, "No attributes to print");
}
if (json_paths)
}
else
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
#if ENABLE_BGP_VNC
/* prints an additional line, indented, with VNC info, if present */
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP))
buf, BUFSIZ));
len = 16 - len;
if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " ");
+ vty_out (vty, "%s%*s", VTYNL, 36, " ");
else
vty_out (vty, "%*s", len, " ");
}
json_object_object_add(json_ar, inet_ntop (p->family, &p->u.prefix, buf_cut, BUFSIZ), json_net);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
void
}
else
{
- vty_out (vty, "notag/%d%s", label, VTY_NEWLINE);
+ vty_out (vty, "notag/%d", label);
+ vty_out (vty, VTYNL);
}
}
}
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* dampening route */
if (len < 1)
{
if (!use_json)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 34, " ");
+ vty_out (vty, "%s%*s", VTYNL, 34, " ");
}
else
{
vty_out (vty, "%s", bgp_origin_str[attr->origin]);
}
if (!use_json)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* flap route */
if (len < 1)
{
if (!use_json)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 33, " ");
+ vty_out (vty, "%s%*s", VTYNL, 33, " ");
}
else
{
vty_out (vty, "%s", bgp_origin_str[attr->origin]);
}
if (!use_json)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
static void
}
if (!json_paths)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
/* Line2 display Next-hop, Neighbor, Router-id */
/* Display the nexthop */
}
if (!json_paths)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
/* display the link-local nexthop */
if (attr->extra && attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
}
else
{
- vty_out (vty, " (%s) %s%s",
+ vty_outln (vty, " (%s) %s",
inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
buf, INET6_ADDRSTRLEN),
- attr->extra->mp_nexthop_prefer_global ?
- "(prefer-global)" : "(used)",
- VTY_NEWLINE);
+ attr->extra->mp_nexthop_prefer_global ? "(prefer-global)" : "(used)");
}
}
/* If we do not have a link-local nexthop then we must flag the global as "used" */
json_object_object_add(json_path, "bestpath", json_bestpath);
if (!json_paths)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
/* Line 4 display Community */
if (attr->community)
}
else
{
- vty_out (vty, " Community: %s%s", attr->community->str,
- VTY_NEWLINE);
+ vty_outln (vty, " Community: %s",attr->community->str);
}
}
}
else
{
- vty_out (vty, " Extended Community: %s%s",
- attr->extra->ecommunity->str, VTY_NEWLINE);
+ vty_outln (vty, " Extended Community: %s",
+ attr->extra->ecommunity->str);
}
}
/* Line 6 display Large community */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))
- vty_out (vty, " Large Community: %s%s",
- attr->extra->lcommunity->str, VTY_NEWLINE);
+ vty_outln (vty, " Large Community: %s",
+ attr->extra->lcommunity->str);
/* Line 7 display Originator, Cluster-id */
if ((attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) ||
}
if (!json_paths)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (binfo->extra && binfo->extra->damp_info)
if (json_paths)
json_object_int_add(json_path, "remoteLabel", label);
else
- vty_out(vty, " Remote label: %d%s", label, VTY_NEWLINE);
+ vty_outln (vty, " Remote label: %d", label);
}
/* Label Index */
if (json_paths)
json_object_int_add(json_path, "labelIndex", attr->extra->label_index);
else
- vty_out(vty, " Label Index: %d%s", attr->extra->label_index, VTY_NEWLINE);
+ vty_outln (vty, " Label Index: %d",
+ attr->extra->label_index);
}
/* Line 8 display Addpath IDs */
}
else
{
- vty_out (vty, " AddPath ID: RX %u, TX %u%s",
- binfo->addpath_rx_id, binfo->addpath_tx_id,
- VTY_NEWLINE);
+ vty_outln (vty, " AddPath ID: RX %u, TX %u",
+ binfo->addpath_rx_id,binfo->addpath_tx_id);
}
}
{
if (!first)
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
}
json_object_array_add(json_paths, json_path);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
-#define BGP_SHOW_HEADER_CSV "Flags, Network, Next Hop, Metric, LocPrf, Weight, Path%s"
-#define BGP_SHOW_DAMP_HEADER " Network From Reuse Path%s"
-#define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path%s"
+#define BGP_SHOW_HEADER_CSV "Flags, Network, Next Hop, Metric, LocPrf, Weight, Path"
+#define BGP_SHOW_DAMP_HEADER " Network From Reuse Path"
+#define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path"
static int
bgp_show_prefix_list (struct vty *vty, struct bgp *bgp,
if (!use_json && header)
{
- 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);
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor)
- vty_out (vty, BGP_SHOW_DAMP_HEADER, VTY_NEWLINE);
+ vty_outln (vty, BGP_SHOW_DAMP_HEADER);
else if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor)
- vty_out (vty, BGP_SHOW_FLAP_HEADER, VTY_NEWLINE);
+ vty_outln (vty, BGP_SHOW_FLAP_HEADER);
else
- vty_out (vty, BGP_SHOW_HEADER, VTY_NEWLINE);
+ vty_outln (vty, BGP_SHOW_HEADER);
header = 0;
}
if (use_json)
{
json_object_free (json_paths);
- vty_out (vty, " } }%s", VTY_NEWLINE);
+ vty_outln (vty, " } }");
}
else
{
if (output_count == 0)
{
if (type == bgp_show_type_normal)
- vty_out (vty, "No BGP prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
+ vty_outln (vty, "No BGP 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;
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;
}
/* use MPLS and ENCAP specific shows until they are merged */
int is_first = 1;
if (use_json)
- vty_out (vty, "{%s", VTY_NEWLINE);
+ vty_outln (vty, "{");
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
{
if (use_json)
{
if (! is_first)
- vty_out (vty, ",%s", VTY_NEWLINE);
+ vty_outln (vty, ",");
else
is_first = 0;
}
else
{
- 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 (vty, bgp, afi, safi, bgp_show_type_normal, NULL, use_json);
}
if (use_json)
- vty_out (vty, "}%s", VTY_NEWLINE);
+ vty_outln (vty, "}");
}
/* Header of detailed BGP route information */
prefix2str (p, buf2, INET6_ADDRSTRLEN);
else
inet_ntop (p->family, &p->u.prefix, buf2, INET6_ADDRSTRLEN);
- vty_out (vty, "BGP routing table entry for %s%s%s/%d%s",
+ vty_outln (vty, "BGP routing table entry for %s%s%s/%d",
((safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP || safi == SAFI_EVPN) ?
prefix_rd2str (prd, buf1, RD_ADDRSTRLEN) : ""),
((safi == SAFI_MPLS_VPN) || (safi == SAFI_EVPN)) ? ":" : "",
buf2,
- p->prefixlen, VTY_NEWLINE);
+ p->prefixlen);
if (has_valid_label)
- vty_out(vty, "Local label: %d%s", label, VTY_NEWLINE);
+ vty_outln (vty, "Local label: %d%s", label);
else if (bgp_labeled_safi(safi))
- vty_out(vty, "Local label: not allocated%s", VTY_NEWLINE);
+ vty_outln (vty, "Local label: not allocated%s");
}
for (ri = rn->info; ri; ri = ri->next)
if (suppress)
vty_out (vty, ", Advertisements suppressed by an aggregate.");
- vty_out (vty, ")%s", VTY_NEWLINE);
+ vty_outln (vty, ")");
}
/* If we are not using addpath then we can display Advertised to and that will
{
if (first)
vty_out (vty, " Not advertised to any peer");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
}
ret = str2prefix (ip_str, &match);
if (! ret)
{
- vty_out (vty, "address is malformed%s", VTY_NEWLINE);
+ vty_outln (vty, "address is malformed");
return CMD_WARNING;
}
if (display)
json_object_object_add(json, "paths", json_paths);
- 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 (!display)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
}
XFREE (MTYPE_TMP, str);
if (! lcom)
{
- vty_out (vty, "%% Large-community malformed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Large-community malformed");
return CMD_WARNING;
}
list = community_list_lookup (bgp_clist, lcom, LARGE_COMMUNITY_LIST_MASTER);
if (list == NULL)
{
- vty_out (vty, "%% %s is not a valid large-community-list name%s", lcom,
- VTY_NEWLINE);
+ vty_outln (vty, "%% %s is not a valid large-community-list name",lcom);
return CMD_WARNING;
}
{
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
- safi = bgp_vty_safi_from_arg (argv[idx]->text);
+ safi = bgp_vty_safi_from_str (argv[idx]->text);
}
int uj = use_json (argc, argv);
struct bgp *bgp = bgp_lookup_by_name (vrf);
if (bgp == NULL)
{
- vty_out (vty, "Can't find BGP instance %s%s", vrf, VTY_NEWLINE);
+ vty_outln (vty, "Can't find BGP instance %s", vrf);
return CMD_WARNING;
}
{
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
- safi = bgp_vty_safi_from_arg (argv[idx]->text);
+ safi = bgp_vty_safi_from_str (argv[idx]->text);
}
int uj = use_json (argc, argv);
struct bgp *bgp = bgp_lookup_by_name (vrf);
if (bgp == NULL)
{
- vty_out (vty, "Can't find BGP instance %s%s", vrf, VTY_NEWLINE);
+ vty_outln (vty, "Can't find BGP instance %s", vrf);
return CMD_WARNING;
}
if (!bgp)
{
- vty_out (vty, "Specified 'all' vrf's but this command currently only works per view/vrf%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Specified 'all' vrf's but this command currently only works per view/vrf");
return CMD_WARNING;
}
if ((argv[idx]->type == IPV6_TKN || argv[idx]->type == IPV6_PREFIX_TKN) && afi != AFI_IP6)
{
- vty_out (vty, "%% Cannot specify IPv6 address or prefix with IPv4 AFI%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "%% Cannot specify IPv6 address or prefix with IPv4 AFI");
return CMD_WARNING;
}
if ((argv[idx]->type == IPV4_TKN || argv[idx]->type == IPV4_PREFIX_TKN) && afi != AFI_IP)
{
- vty_out (vty, "%% Cannot specify IPv4 address or prefix with IPv6 AFI%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "%% Cannot specify IPv4 address or prefix with IPv6 AFI");
return CMD_WARNING;
}
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);
return CMD_WARNING;
}
plist = prefix_list_lookup (afi, prefix_list_str);
if (plist == NULL)
{
- vty_out (vty, "%% %s is not a valid prefix-list name%s",
- prefix_list_str, VTY_NEWLINE);
+ vty_outln (vty, "%% %s is not a valid prefix-list name",
+ prefix_list_str);
return CMD_WARNING;
}
as_list = as_list_lookup (filter);
if (as_list == NULL)
{
- vty_out (vty, "%% %s is not a valid AS-path access-list name%s", filter, VTY_NEWLINE);
+ vty_outln (vty, "%% %s is not a valid AS-path access-list name",
+ filter);
return CMD_WARNING;
}
rmap = route_map_lookup_by_name (rmap_str);
if (! rmap)
{
- vty_out (vty, "%% %s is not a valid route-map name%s",
- rmap_str, VTY_NEWLINE);
+ vty_outln (vty, "%% %s is not a valid route-map name",
+ rmap_str);
return CMD_WARNING;
}
buffer_putc (b, ' ');
else
{
- if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0))
+ if (strmatch(argv[i]->text, "unicast") || strmatch(argv[i]->text, "multicast"))
continue;
first = 1;
}
XFREE (MTYPE_TMP, str);
if (! com)
{
- vty_out (vty, "%% Community malformed: %s", VTY_NEWLINE);
+ vty_outln (vty, "%% Community malformed: ");
return CMD_WARNING;
}
list = community_list_lookup (bgp_clist, com, COMMUNITY_LIST_MASTER);
if (list == NULL)
{
- vty_out (vty, "%% %s is not a valid community-list name%s", com,
- VTY_NEWLINE);
+ vty_outln (vty, "%% %s is not a valid community-list name",com);
return CMD_WARNING;
}
ret = str2prefix (prefix, p);
if (! ret)
{
- vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Prefix");
return CMD_WARNING;
}
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "malformedAddressOrName", ip_str);
- 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 or name: %s%s", ip_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address or name: %s", ip_str);
return NULL;
}
}
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning","No such neighbor");
- 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%s", VTY_NEWLINE);
+ vty_outln (vty, "No such neighbor");
return NULL;
}
if (!bgp->rib[afi][safi])
{
- vty_out (vty, "%% No RIB exist's for the AFI(%d)/SAFI(%d)%s",
- afi, safi, VTY_NEWLINE);
+ vty_outln (vty, "%% No RIB exist's for the AFI(%d)/SAFI(%d)",
+ afi, safi);
return CMD_WARNING;
}
ts.table = bgp->rib[afi][safi];
thread_execute (bm->master, bgp_table_stats_walker, &ts, 0);
- vty_out (vty, "BGP %s RIB statistics%s%s",
- afi_safi_print (afi, safi), VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "BGP %s RIB statistics%s",
+ afi_safi_print (afi, safi), VTYNL);
for (i = 0; i < BGP_STATS_MAX; i++)
{
break;
case BGP_STATS_SPACE:
vty_out (vty, "%-30s: ", table_stats_strs[i]);
- vty_out (vty, "%12llu%s", ts.counts[i], VTY_NEWLINE);
+ vty_outln (vty, "%12llu", ts.counts[i]);
if (ts.counts[BGP_STATS_MAXBITLEN] < 9)
break;
vty_out (vty, "%30s: ", "%% announced ");
- vty_out (vty, "%12.2f%s",
- 100 * (float)ts.counts[BGP_STATS_SPACE] /
- (float)((uint64_t)1UL << ts.counts[BGP_STATS_MAXBITLEN]),
- VTY_NEWLINE);
+ vty_outln (vty, "%12.2f",
+ 100 * (float)ts.counts[BGP_STATS_SPACE] / (float)((uint64_t)1UL << ts.counts[BGP_STATS_MAXBITLEN]));
vty_out (vty, "%30s: ", "/8 equivalent ");
- vty_out (vty, "%12.2f%s",
- (float)ts.counts[BGP_STATS_SPACE] /
- (float)(1UL << (ts.counts[BGP_STATS_MAXBITLEN] - 8)),
- VTY_NEWLINE);
+ vty_outln (vty, "%12.2f",
+ (float)ts.counts[BGP_STATS_SPACE] / (float)(1UL << (ts.counts[BGP_STATS_MAXBITLEN] - 8)));
if (ts.counts[BGP_STATS_MAXBITLEN] < 25)
break;
vty_out (vty, "%30s: ", "/24 equivalent ");
vty_out (vty, "%12llu", ts.counts[i]);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return CMD_SUCCESS;
}
if (use_json)
{
json_object_string_add(json, "warning", "No such neighbor or address family");
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_outln (vty, "%s", json_object_to_json_string(json));
json_object_free(json);
}
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;
}
json_object_string_add(json, "pfxctDriftFor", peer->host);
json_object_string_add(json, "recommended", "Please report this bug, with the above command output");
}
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_outln (vty, "%s", json_object_to_json_string(json));
json_object_free(json);
}
else
if (peer->hostname && bgp_flag_check(peer->bgp, BGP_FLAG_SHOW_HOSTNAME))
{
- vty_out (vty, "Prefix counts for %s/%s, %s%s",
- peer->hostname, peer->host, afi_safi_print (afi, safi),
- VTY_NEWLINE);
+ vty_outln (vty, "Prefix counts for %s/%s, %s",
+ peer->hostname, peer->host,afi_safi_print(afi, safi));
}
else
{
- vty_out (vty, "Prefix counts for %s, %s%s",
- peer->host, afi_safi_print (afi, safi), VTY_NEWLINE);
+ vty_outln (vty, "Prefix counts for %s, %s",
+ peer->host, afi_safi_print(afi, safi));
}
- vty_out (vty, "PfxCt: %ld%s", peer->pcount[afi][safi], VTY_NEWLINE);
- vty_out (vty, "%sCounts from RIB table walk:%s%s",
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "PfxCt: %ld", peer->pcount[afi][safi]);
+ vty_outln (vty, "%sCounts from RIB table walk:%s",
+ VTYNL, VTYNL);
for (i = 0; i < PCOUNT_MAX; i++)
- vty_out (vty, "%20s: %-10d%s", pcount_strs[i], pcounts.count[i], VTY_NEWLINE);
+ vty_outln (vty, "%20s: %-10d", pcount_strs[i], pcounts.count[i]);
if (pcounts.count[PCOUNT_PFCNT] != peer->pcount[afi][safi])
{
- vty_out (vty, "%s [pcount] PfxCt drift!%s",
- peer->host, VTY_NEWLINE);
- vty_out (vty, "Please report this bug, with the above command output%s",
- VTY_NEWLINE);
+ vty_outln (vty, "%s [pcount] PfxCt drift!",
+ peer->host);
+ vty_outln (vty,
+ "Please report this bug, with the above command output");
}
}
struct bgp *bgp = bgp_get_default();
if (!bgp)
{
- vty_out (vty, "Can't find default instance%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find default instance");
return CMD_WARNING;
}
network = argv[idx]->arg;
else
{
- vty_out (vty, "Unable to figure out Network%s", VTY_NEWLINE);
+ vty_outln (vty, "Unable to figure out Network");
return CMD_WARNING;
}
network = argv[idx]->arg;
else
{
- vty_out (vty, "Unable to figure out Network%s", VTY_NEWLINE);
+ vty_outln (vty, "Unable to figure out Network");
return CMD_WARNING;
}
return bgp_show_route (vty, NULL, network, AFI_L2VPN, SAFI_EVPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv));
if (use_json)
{
json_object_string_add(json, "alert", "no BGP");
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_outln (vty, "%s", json_object_to_json_string(json));
json_object_free(json);
}
else
- vty_out (vty, "%% No bgp%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No bgp");
return;
}
}
else
{
- 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);
- vty_out (vty, "Originating default network 0.0.0.0%s%s",
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "Originating default network 0.0.0.0%s",
+ VTYNL);
}
header1 = 0;
}
}
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, 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 0, local router ID is %s",
+ 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)
{
if (!use_json)
- vty_out (vty, BGP_SHOW_HEADER, VTY_NEWLINE);
+ vty_outln (vty, BGP_SHOW_HEADER);
header2 = 0;
}
if (ain->attr)
}
else
{
- 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)
{
if (!use_json)
- vty_out (vty, BGP_SHOW_HEADER, VTY_NEWLINE);
+ vty_outln (vty, BGP_SHOW_HEADER);
header2 = 0;
}
if (use_json)
json_object_int_add(json, "totalPrefixCounter", output_count);
else
- 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);
}
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_outln (vty, "%s", json_object_to_json_string(json));
json_object_free(json);
}
if (use_json)
{
json_object_string_add(json, "warning", "No such neighbor or address family");
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_outln (vty, "%s", json_object_to_json_string(json));
json_object_free(json);
}
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;
}
if (use_json)
{
json_object_string_add(json, "warning", "Inbound soft reconfiguration not enabled");
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_outln (vty, "%s", json_object_to_json_string(json));
json_object_free(json);
}
else
- vty_out (vty, "%% Inbound soft reconfiguration not enabled%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inbound soft reconfiguration not enabled");
return CMD_WARNING;
}
if (! peer)
{
if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "%% Malformed address or name: %s%s", peerstr, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address or name: %s", peerstr);
return CMD_WARNING;
}
}
if (! peer)
{
if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "No peer%s", VTY_NEWLINE);
+ vty_outln (vty, "No peer");
return CMD_WARNING;
}
}
if (count)
{
if (!uj)
- vty_out (vty, "Address Family: %s%s", afi_safi_print(afi, safi), VTY_NEWLINE);
+ vty_outln (vty, "Address Family: %s", afi_safi_print(afi, safi));
prefix_bgp_show_prefix_list (vty, afi, name, uj);
}
else
{
if (uj)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "No functional output%s", VTY_NEWLINE);
+ vty_outln (vty, "No functional output");
}
return CMD_SUCCESS;
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;
}
peer = peer_lookup_in_view (vty, bgp, peerstr, uj);
if (! peer)
{
- vty_out (vty, "No such neighbor%s", VTY_NEWLINE);
+ vty_outln (vty, "No such neighbor");
return CMD_WARNING;
}
ret = str2prefix_rd (argv[5]->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_route (vty, NULL, argv[6]->arg, afi, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv));
ret = str2prefix (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
ret = str2prefix (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
rn = bgp_node_lookup (bgp_distance_table[afi][safi], (struct prefix *)&p);
if (! rn)
{
- vty_out (vty, "Can't find specified prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find specified prefix");
return CMD_WARNING;
}
if (bdistance->distance != distance)
{
- vty_out (vty, "Distance does not match configured%s", VTY_NEWLINE);
+ vty_outln (vty, "Distance does not match configured");
return CMD_WARNING;
}
if (suppress < reuse)
{
- vty_out (vty, "Suppress value cannot be less than reuse value %s",
- VTY_NEWLINE);
+ vty_outln (vty,"Suppress value cannot be less than reuse value ");
return 0;
}
bgp = bgp_lookup_by_name (view_name);
if (bgp == NULL)
{
- vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find BGP instance %s", view_name);
return CMD_WARNING;
}
}
bgp = bgp_get_default ();
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;
}
}
ret = str2prefix (ip_str, &match);
if (! ret)
{
- vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% address is malformed");
return CMD_WARNING;
}
ret = netmask_str2prefix_str (argv[idx_ipv4]->arg, argv[idx_ipv4_2]->arg, prefix_str);
if (! ret)
{
- vty_out (vty, "%% Inconsistent address and mask%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Inconsistent address and mask");
return CMD_WARNING;
}
if (bgp_static->backdoor)
vty_out (vty, " backdoor");
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return 0;
}
prefix2str (p, buf, sizeof (buf)),
vty_out (vty, " network %s rd %s ethtag %u tag %u esi %s gwip %s routermac %s",
buf, rdbuf, p->u.prefix_evpn.eth_tag,
+<<<<<<< HEAD
decode_label (&bgp_static->label), esi, buf2 , macrouter);
vty_out (vty, "%s", VTY_NEWLINE);
+=======
+ decode_label (bgp_static->tag), esi, buf2 , macrouter);
+ vty_out (vty, VTYNL);
+>>>>>>> 5fca4e3635c2778e8349bce0eaf944c26913d321
if (macrouter)
XFREE (MTYPE_TMP, macrouter);
if (esi)
vty_out (vty, " backdoor");
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* Aggregate-address configuration. */
if (bgp_aggregate->summary_only)
vty_out (vty, " summary-only");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return 0;
|| bgp->distance_local[afi][safi] != ZEBRA_IBGP_DISTANCE_DEFAULT))
{
bgp_config_write_family_header (vty, afi, safi, write);
- vty_out (vty, " distance bgp %d %d %d%s",
+ vty_outln (vty, " distance bgp %d %d %d",
bgp->distance_ebgp[afi][safi], bgp->distance_ibgp[afi][safi],
- bgp->distance_local[afi][safi], VTY_NEWLINE);
+ bgp->distance_local[afi][safi]);
}
for (rn = bgp_table_top (bgp_distance_table[afi][safi]); rn;
char buf[PREFIX_STRLEN];
bgp_config_write_family_header (vty, afi, safi, write);
- vty_out (vty, " distance %d %s %s%s", bdistance->distance,
+ vty_outln (vty, " distance %d %s %s", bdistance->distance,
prefix2str (&rn->p, buf, sizeof (buf)),
- bdistance->access_list ? bdistance->access_list : "",
- VTY_NEWLINE);
+ bdistance->access_list ? bdistance->access_list : "");
}
return *write;
#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.)
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;
}
}
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)
/* 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;
}
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;
}
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;
}
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) ||
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;
}
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;
{
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;
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);
}
/*
{
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)
}
}
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
{
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;
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);
}
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;
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;
}
}
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;
}
rd_vnc_eth.macaddr.octet[5]);
#endif
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
rd_header = 0;
}
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;
return safi;
}
-/* supports <ipv4|ipv6> */
+/**
+ * Converts an AFI in string form to afi_t
+ *
+ * @param afi string, one of
+ * - "ipv4"
+ * - "ipv6"
+ * @return the corresponding afi_t
+ */
afi_t
-bgp_vty_afi_from_arg(const char *afi_str)
+bgp_vty_afi_from_str(const char *afi_str)
{
- afi_t afi = AFI_MAX; /* unknown */
- if (!strcmp(afi_str, "ipv4")) {
+ afi_t afi = AFI_MAX; /* unknown */
+ if (strmatch(afi_str, "ipv4"))
afi = AFI_IP;
- }
- else if (!strcmp(afi_str, "ipv6")) {
+ else if (strmatch(afi_str, "ipv6"))
afi = AFI_IP6;
- }
- else if (!strcmp(afi_str, "l2vpn")) {
- afi = AFI_L2VPN;
- }
return afi;
}
-int
-bgp_parse_afi(const char *str, afi_t *afi)
-{
- *afi = bgp_vty_afi_from_arg(str);
- if (*afi != AFI_MAX)
- return 0;
- else
- return -1;
-}
-
int
argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *afi)
{
/* supports <unicast|multicast|vpn|labeled-unicast> */
safi_t
-bgp_vty_safi_from_arg(const char *safi_str)
+bgp_vty_safi_from_str(const char *safi_str)
{
safi_t safi = SAFI_MAX; /* unknown */
- if (strncmp (safi_str, "m", 1) == 0)
+ if (strmatch (safi_str, "multicast"))
safi = SAFI_MULTICAST;
- else if (strncmp (safi_str, "u", 1) == 0)
+ else if (strmatch (safi_str, "unicast"))
safi = SAFI_UNICAST;
- else if (strncmp (safi_str, "v", 1) == 0)
+ else if (strmatch (safi_str, "vpn"))
safi = SAFI_MPLS_VPN;
- else if (strncmp (safi_str, "l", 1) == 0)
+ else if (strmatch (safi_str, "labeled-unicast"))
safi = SAFI_LABELED_UNICAST;
return safi;
}
if (safi)
*safi = SAFI_MPLS_VPN;
}
- else if (argv_find (argv, argc, "evpn", index))
- {
- ret = 1;
- if (safi)
- *safi = SAFI_EVPN;
- }
return ret;
}
*bgp = bgp_lookup_by_name (vrf_name);
if (!*bgp)
{
- vty_out (vty, "View/Vrf specified is unknown: %s%s", vrf_name, VTY_NEWLINE);
+ vty_out (vty, "View/Vrf specified is unknown: %s%s", vrf_name, VTYNL);
*idx = 0;
return 0;
}
*bgp = bgp_get_default ();
if (!*bgp)
{
- vty_out (vty, "Unable to find default BGP instance%s", VTY_NEWLINE);
+ vty_out (vty, "Unable to find default BGP instance%s", VTYNL);
*idx = 0;
return 0;
}
{
if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL)
{
- vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
+ vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTYNL);
return NULL;
}
}
if (! peer)
{
vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
- VTY_NEWLINE);
+ VTYNL);
return NULL;
}
if (peer_dynamic_neighbor (peer))
{
vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
- VTY_NEWLINE);
+ VTYNL);
return NULL;
}
if (peer_dynamic_neighbor (peer))
{
vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
- VTY_NEWLINE);
+ VTYNL);
return NULL;
}
return group->conf;
vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
- VTY_NEWLINE);
+ VTYNL);
return NULL;
}
}
if (str)
{
- vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
+ vty_out (vty, "%% %s%s", str, VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
case BGP_ERR_AF_UNCONFIGURED:
vty_out (vty,
"%%BGP: Enable %s address family for the neighbor %s%s",
- afi_safi_print(afi, safi), peer->host, VTY_NEWLINE);
+ afi_safi_print(afi, safi), peer->host, VTYNL);
break;
case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
- vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTYNL, VTYNL);
break;
default:
break;
peer = peer_lookup_by_hostname(bgp, arg);
if (!peer)
{
- vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
+ vty_out (vty, "Malformed address or name: %s%s", arg, VTYNL);
return CMD_WARNING;
}
}
peer = peer_lookup (bgp, &su);
if (! peer)
{
- vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
+ vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTYNL);
return CMD_WARNING;
}
}
group = peer_group_lookup (bgp, arg);
if (! group)
{
- vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
+ vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTYNL);
return CMD_WARNING;
}
as_t as;
int find = 0;
- VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
+ as = strtoul(arg, NULL, 10);
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{
}
if (! find)
vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
- VTY_NEWLINE);
+ VTYNL);
return CMD_SUCCESS;
}
bgp = bgp_lookup_by_name (name);
if (bgp == NULL)
{
- vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE);
+ vty_out (vty, "Can't find BGP instance %s%s", name, VTYNL);
return CMD_WARNING;
}
}
bgp = bgp_get_default ();
if (bgp == NULL)
{
- vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
+ vty_out (vty, "No BGP process is configured%s", VTYNL);
return CMD_WARNING;
}
}
}
+#ifndef VTYSH_EXTRACT_PL
+#include "bgp_vty_clippy.c"
+#endif
+
/* BGP global configuration. */
DEFUN (bgp_multiple_instance_func,
ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
if (ret < 0)
{
- vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
+ vty_out (vty, "%% There are more than two BGP instances%s", VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
"cisco\n"
"zebra\n")
{
- int idx_vendor = 2;
- if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0)
+ int idx = 0;
+ if (argv_find (argv, argc, "cisco", &idx))
bgp_option_set (BGP_OPT_CONFIG_CISCO);
else
bgp_option_unset (BGP_OPT_CONFIG_CISCO);
if (bgp == NULL)
{
- vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
+ vty_out (vty, "%% No BGP process is configured%s", VTYNL);
return CMD_WARNING;
}
if (listcount(bm->bgp) > 1)
{
- vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
+ vty_out (vty, "%% Multiple BGP processes are configured%s", VTYNL);
return CMD_WARNING;
}
}
// "router bgp X"
else
{
- VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_asn]->arg, 1, BGP_AS4_MAX);
+ as = strtoul (argv[idx_asn]->arg, NULL, 10);
inst_type = BGP_INSTANCE_TYPE_DEFAULT;
if (argc > 3)
{
case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
case BGP_ERR_AS_MISMATCH:
- vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
+ vty_out (vty, "BGP is already running; AS is %u%s", as, VTYNL);
return CMD_WARNING;
case BGP_ERR_INSTANCE_MISMATCH:
- vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE);
+ vty_out (vty, "BGP instance name and AS number mismatch%s", VTYNL);
vty_out (vty, "BGP instance is already running; AS is %u%s",
- as, VTY_NEWLINE);
+ as, VTYNL);
return CMD_WARNING;
}
if (bgp == NULL)
{
- vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
+ vty_out (vty, "%% No BGP process is configured%s", VTYNL);
return CMD_WARNING;
}
if (listcount(bm->bgp) > 1)
{
- vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
+ vty_out (vty, "%% Multiple BGP processes are configured%s", VTYNL);
return CMD_WARNING;
}
}
else
{
- VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_asn]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[idx_asn]->arg, NULL, 10);
if (argc > 4)
name = argv[idx_vrf]->arg;
bgp = bgp_lookup (as, name);
if (! bgp)
{
- vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
+ vty_out (vty, "%% Can't find BGP instance%s", VTYNL);
return CMD_WARNING;
}
}
/* BGP router-id. */
-DEFUN (bgp_router_id,
+DEFPY (bgp_router_id,
bgp_router_id_cmd,
"bgp router-id A.B.C.D",
BGP_STR
"Manually configured router identifier\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
- int idx_ipv4 = 2;
- int ret;
- struct in_addr id;
-
- ret = inet_aton (argv[idx_ipv4]->arg, &id);
- if (! ret)
- {
- vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- bgp_router_id_static_set (bgp, id);
-
+ bgp_router_id_static_set (bgp, router_id);
return CMD_SUCCESS;
}
-DEFUN (no_bgp_router_id,
+DEFPY (no_bgp_router_id,
no_bgp_router_id_cmd,
"no bgp router-id [A.B.C.D]",
NO_STR
"Manually configured router identifier\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
- int idx_router_id = 3;
- int ret;
- struct in_addr id;
- if (argc > idx_router_id)
+ if (router_id_str)
{
- ret = inet_aton (argv[idx_router_id]->arg, &id);
- if (! ret)
+ if (! IPV4_ADDR_SAME (&bgp->router_id_static, &router_id))
{
- vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
- {
- vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
+ vty_outln (vty, "%% BGP router-id doesn't match");
return CMD_WARNING;
}
}
- id.s_addr = 0;
- bgp_router_id_static_set (bgp, id);
+ router_id.s_addr = 0;
+ bgp_router_id_static_set (bgp, router_id);
return CMD_SUCCESS;
}
ret = inet_aton (argv[idx_ipv4]->arg, &cluster);
if (! ret)
{
- vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed bgp cluster identifier%s", VTYNL);
return CMD_WARNING;
}
int idx_number = 3;
as_t as;
- VTY_GET_INTEGER_RANGE ("AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[idx_number]->arg, NULL, 10);
bgp_confederation_id_set (bgp, as);
for (i = idx_asn; i < argc; i++)
{
- VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[i]->arg, NULL, 10);
if (bgp->as == as)
{
vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
- VTY_NEWLINE);
+ VTYNL);
continue;
}
for (i = idx_asn; i < argc; i++)
{
- VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[i]->arg, NULL, 10);
bgp_confederation_peers_remove (bgp, as);
}
"%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
(set == 1) ? "" : "un",
(peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp",
- maxpaths, afi, safi, VTY_NEWLINE);
+ maxpaths, afi, safi, VTYNL);
return CMD_WARNING;
}
u_int16_t update_delay;
u_int16_t establish_wait;
- VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay,
- BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX);
+ update_delay = strtoul(delay, NULL, 10);
if (!wait) /* update-delay <delay> */
{
if (update_delay < establish_wait)
{
vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
vty_out (vty, " update-delay %d", bgp->v_update_delay);
if (bgp->v_update_delay != bgp->v_establish_wait)
vty_out (vty, " %d", bgp->v_establish_wait);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
VTY_DECLVAR_CONTEXT(bgp, bgp);
if (set)
- VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num,
- 1, 10000);
+ bgp->wpkt_quanta = strtoul(num, NULL, 10);
else
bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX;
{
if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX)
vty_out (vty, " write-quanta %d%s",
- bgp->wpkt_quanta, VTY_NEWLINE);
+ bgp->wpkt_quanta, VTYNL);
return 0;
}
{
if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME)
vty_out (vty, " coalesce-time %u%s",
- bgp->coalesce_time, VTY_NEWLINE);
+ bgp->coalesce_time, VTYNL);
return 0;
}
{
bgp_config_write_family_header (vty, afi, safi, write);
vty_out (vty, " maximum-paths %d%s",
- bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
+ bgp->maxpaths[afi][safi].maxpaths_ebgp, VTYNL);
}
if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM)
if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
vty_out (vty, " equal-cluster-length");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
unsigned long keepalive = 0;
unsigned long holdtime = 0;
- VTY_GET_INTEGER ("keepalive", keepalive, argv[idx_number]->arg);
- VTY_GET_INTEGER ("holdtime", holdtime, argv[idx_number_2]->arg);
+ keepalive = strtoul(argv[idx_number]->arg, NULL, 10);
+ holdtime = strtoul(argv[idx_number_2]->arg, NULL, 10);
/* Holdtime value check. */
if (holdtime < 3 && holdtime != 0)
{
vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (bestpath_per_as_used)
{
vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
else
int idx_number = 3;
u_int32_t stalepath;
- VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[idx_number]->arg, 1, 3600);
+ stalepath = strtoul(argv[idx_number]->arg, NULL, 10);
bgp->stalepath_time = stalepath;
return CMD_SUCCESS;
}
int idx_number = 3;
u_int32_t restart;
- VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[idx_number]->arg, 1, 3600);
+ restart = strtoul(argv[idx_number]->arg, NULL, 10);
bgp->restart_time = restart;
return CMD_SUCCESS;
}
int idx_number = 3;
u_int32_t local_pref;
- VTY_GET_INTEGER ("local preference", local_pref, argv[idx_number]->arg);
+ local_pref = strtoul(argv[idx_number]->arg, NULL, 10);
bgp_default_local_preference_set (bgp, local_pref);
bgp_clear_star_soft_in (vty, bgp->name);
int idx_number = 3;
u_int32_t max_size;
- VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[idx_number]->arg);
+ max_size = strtoul(argv[idx_number]->arg, NULL, 10);
bgp_default_subgroup_pkt_queue_max_set (bgp, max_size);
int idx_number = 3;
int listen_limit;
- VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[idx_number]->arg,
- BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN,
- BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX);
+ listen_limit = strtoul(argv[idx_number]->arg, NULL, 10);
bgp_listen_limit_set (bgp, listen_limit);
ret = str2prefix (prefix, &range);
if (! ret)
{
- vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed listen range%s", VTYNL);
return CMD_WARNING;
}
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
{
vty_out (vty, "%% Malformed listen range (link-local address)%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
else
{
vty_out (vty, "%% Same listen range is attached to peer-group %s%s",
- existing_group->name, VTY_NEWLINE);
+ existing_group->name, VTYNL);
return CMD_WARNING;
}
}
if (listen_range_exists (bgp, &range, 0))
{
vty_out (vty, "%% Listen range overlaps with existing listen range%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
group = peer_group_lookup (bgp, peergroup);
if (! group)
{
- vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Configure the peer-group first%s", VTYNL);
return CMD_WARNING;
}
argv_find (argv, argc, "WORD", &idx);
char *peergroup = argv[idx]->arg;
- // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
-
/* Convert IP prefix string to struct prefix. */
ret = str2prefix (prefix, &range);
if (! ret)
{
- vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed listen range%s", VTYNL);
return CMD_WARNING;
}
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
{
vty_out (vty, "%% Malformed listen range (link-local address)%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
group = peer_group_lookup (bgp, peergroup);
if (! group)
{
- vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE);
+ vty_out (vty, "%% Peer-group does not exist%s", VTYNL);
return CMD_WARNING;
}
if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
vty_out (vty, " bgp listen limit %d%s",
- bgp->dynamic_neighbors_limit, VTY_NEWLINE);
+ bgp->dynamic_neighbors_limit, VTYNL);
for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
{
{
prefix2str(range, buf, sizeof(buf));
vty_out(vty, " bgp listen range %s peer-group %s%s",
- buf, group->name, VTY_NEWLINE);
+ buf, group->name, VTYNL);
}
}
}
else
{
/* Get AS number. */
- VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
+ as = strtoul(as_str, NULL, 10);
}
/* If peer is peer group, call proper function. */
if (ret < 0)
{
vty_out (vty, "%% Create the peer-group or interface first%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
if (peer_address_self_check (bgp, &su))
{
vty_out (vty, "%% Can not configure the local system as neighbor%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi);
switch (ret)
{
case BGP_ERR_PEER_GROUP_MEMBER:
- vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
+ vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTYNL);
return CMD_WARNING;
case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
- vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE);
+ vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTYNL);
return CMD_WARNING;
}
return bgp_vty_return (vty, ret);
if (group)
{
- vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE);
+ vty_out (vty, "%% Name conflict with peer-group %s", VTYNL);
return CMD_WARNING;
}
else
{
/* Get AS number. */
- VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
+ as = strtoul(as_str, NULL, 10);
as_type = AS_SPECIFIED;
}
}
group = peer_group_lookup (bgp, peer_group_name);
if (! group)
{
- vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Configure the peer-group first%s", VTYNL);
return CMD_WARNING;
}
peer = peer_lookup_by_conf_if (bgp, argv[idx_word]->arg);
if (peer)
{
- vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE);
+ vty_out (vty, "%% Name conflict with interface: %s", VTYNL);
return CMD_WARNING;
}
peer_group_delete (group);
else
{
- vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Create the peer-group first%s", VTYNL);
return CMD_WARNING;
}
}
if (peer_dynamic_neighbor (peer))
{
vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
}
else
{
- vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Create the bgp interface first%s", VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
peer_group_delete (group);
else
{
- vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Create the peer-group first%s", VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
peer_group_remote_as_delete (group);
else
{
- vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Create the peer-group or interface first%s", VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Local AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[idx_number]->arg, NULL, 10);
ret = peer_local_as_set (peer, as, 0, 0);
return bgp_vty_return (vty, ret);
}
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Local AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[idx_number]->arg, NULL, 10);
ret = peer_local_as_set (peer, as, 1, 0);
return bgp_vty_return (vty, ret);
}
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Local AS", as, argv[idx_number]->arg, 1, BGP_AS4_MAX);
+ as = strtoul(argv[idx_number]->arg, NULL, 10);
ret = peer_local_as_set (peer, as, 1, 1);
return bgp_vty_return (vty, ret);
}
peer = peer_lookup_by_conf_if (bgp, argv[idx_peer]->arg);
if (!peer)
{
- vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
+ vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTYNL);
return CMD_WARNING;
}
}
if (peer_address_self_check (bgp, &su))
{
vty_out (vty, "%% Can not configure the local system as neighbor%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (peer && peer_dynamic_neighbor (peer))
{
vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
}
group = peer_group_lookup (bgp, argv[idx_word]->arg);
if (! group)
{
- vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Configure the peer-group first%s", VTYNL);
return CMD_WARNING;
}
if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
{
- vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE);
+ vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTYNL);
return CMD_WARNING;
}
group = peer_group_lookup (bgp, argv[idx_word]->arg);
if (! group)
{
- vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
+ vty_out (vty, "%% Configure the peer-group first%s", VTYNL);
return CMD_WARNING;
}
*/
if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) {
vty_out (vty, "%s is directly connected peer, cannot accept disable-"
- "connected-check%s", ip_str, VTY_NEWLINE);
+ "connected-check%s", ip_str, VTYNL);
return CMD_WARNING;
}
int idx_send_recv = 5;
u_int16_t flag = 0;
- if (strncmp (argv[idx_send_recv]->arg, "s", 1) == 0)
+ if (strmatch (argv[idx_send_recv]->text, "send"))
flag = PEER_FLAG_ORF_PREFIX_SM;
- else if (strncmp (argv[idx_send_recv]->arg, "r", 1) == 0)
+ else if (strmatch (argv[idx_send_recv]->text, "receive"))
flag = PEER_FLAG_ORF_PREFIX_RM;
- else if (strncmp (argv[idx_send_recv]->arg, "b", 1) == 0)
+ else if (strmatch (argv[idx_send_recv]->text, "both"))
flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
else
return CMD_WARNING;
int idx_send_recv = 6;
u_int16_t flag = 0;
- if (strncmp (argv[idx_send_recv]->arg, "s", 1) == 0)
+ if (strmatch (argv[idx_send_recv]->text, "send"))
flag = PEER_FLAG_ORF_PREFIX_SM;
- else if (strncmp (argv[idx_send_recv]->arg, "r", 1) == 0)
+ else if (strmatch (argv[idx_send_recv]->text, "receive"))
flag = PEER_FLAG_ORF_PREFIX_RM;
- else if (strncmp (argv[idx_send_recv]->arg, "b", 1) == 0)
+ else if (strmatch (argv[idx_send_recv]->text, "both"))
flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
else
return CMD_WARNING;
"Send Large Community attributes\n")
{
int idx_peer = 2;
- int idx_type = 4;
- if (strncmp (argv[idx_type]->arg, "s", 1) == 0)
+
+ const char *type = argv[argc - 1]->text;
+
+ if (strmatch (type, "standard"))
return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
bgp_node_safi (vty),
PEER_FLAG_SEND_COMMUNITY);
- if (strncmp (argv[idx_type]->arg, "e", 1) == 0)
+ if (strmatch (type, "extended"))
return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
bgp_node_safi (vty),
PEER_FLAG_SEND_EXT_COMMUNITY);
- if (strncmp (argv[idx_type]->arg, "l", 1) == 0)
+ if (strmatch (type, "large"))
return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
bgp_node_safi (vty),
PEER_FLAG_SEND_LARGE_COMMUNITY);
- if (strncmp (argv[idx_type]->arg, "b", 1) == 0)
+ if (strmatch (type, "both"))
return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
bgp_node_safi (vty),
PEER_FLAG_SEND_COMMUNITY |
PEER_FLAG_SEND_EXT_COMMUNITY);
+ /* if (strmatch (type, "all")) */
return peer_af_flag_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
bgp_node_safi (vty),
(PEER_FLAG_SEND_COMMUNITY |
DEFUN (neighbor_attr_unchanged,
neighbor_attr_unchanged_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
- [<\
- as-path [<next-hop [med]|med [next-hop]>]|\
- next-hop [<as-path [med]|med [as-path]>]|\
- med [<as-path [next-hop]|next-hop [as-path]>]\
- >]",
+ "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"BGP attribute is propagated unchanged to this neighbor\n"
"As-path attribute\n"
"Nexthop attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n")
+ "Med attribute\n")
{
int idx = 0;
char *peer = argv[1]->arg;
ALIAS_HIDDEN (neighbor_attr_unchanged,
neighbor_attr_unchanged_hidden_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
- [<\
- as-path [<next-hop [med]|med [next-hop]>]|\
- next-hop [<as-path [med]|med [as-path]>]|\
- med [<as-path [next-hop]|next-hop [as-path]>]\
- >]",
+ "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"BGP attribute is propagated unchanged to this neighbor\n"
"As-path attribute\n"
"Nexthop attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n")
+ "Med attribute\n")
DEFUN (no_neighbor_attr_unchanged,
no_neighbor_attr_unchanged_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
- [<\
- as-path [<next-hop [med]|med [next-hop]>]|\
- next-hop [<as-path [med]|med [as-path]>]|\
- med [<as-path [next-hop]|next-hop [as-path]>]\
- >]",
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"BGP attribute is propagated unchanged to this neighbor\n"
"As-path attribute\n"
"Nexthop attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n")
+ "Med attribute\n")
{
int idx = 0;
char *peer = argv[2]->arg;
ALIAS_HIDDEN (no_neighbor_attr_unchanged,
no_neighbor_attr_unchanged_hidden_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
- [<\
- as-path [<next-hop [med]|med [next-hop]>]|\
- next-hop [<as-path [med]|med [as-path]>]|\
- med [<as-path [next-hop]|next-hop [as-path]>]\
- >]",
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"BGP attribute is propagated unchanged to this neighbor\n"
"As-path attribute\n"
"Nexthop attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n")
-
+ "Med attribute\n")
/* EBGP multihop configuration. */
static int
if (! ttl_str)
ttl = MAXTTL;
else
- VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL);
+ ttl = strtoul(ttl_str, NULL, 10);
return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
}
if (str2prefix (source_str, &p))
{
vty_out (vty, "%% Invalid update-source, remove prefix length %s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
else
}
else
{
- VTY_GET_INTEGER("port", port, port_str);
+ port = strtoul(port_str, NULL, 10);
}
peer_port_set (peer, port);
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
+ weight = strtoul(weight_str, NULL, 10);
ret = peer_weight_set (peer, afi, safi, weight);
return bgp_vty_return (vty, ret);
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
- VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
+ keepalive = strtoul(keep_str, NULL, 10);
+ holdtime = strtoul(hold_str, NULL, 10);
ret = peer_timers_set (peer, keepalive, holdtime);
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
+ connect = strtoul(time_str, NULL, 10);
ret = peer_timers_connect_set (peer, connect);
return CMD_WARNING;
if (time_str)
- VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
+ routeadv = strtoul(time_str, NULL, 10);
if (set)
ret = peer_advertise_interval_set (peer, routeadv);
if (argv[idx_number]->arg)
{
- VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[idx_number]->arg, 0, 600);
+ rmap_delay_timer = strtoul(argv[idx_number]->arg, NULL, 10);
bm->rmap_update_timer = rmap_delay_timer;
/* if the dynamic update handling is being disabled, and a timer is
return peer_interface_vty (vty, argv[idx_peer]->arg, NULL);
}
-/* Set distribute list to the peer. */
-static int
-peer_distribute_set_vty (struct vty *vty, const char *ip_str,
- afi_t afi, safi_t safi,
- const char *name_str, const char *direct_str)
-{
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
-
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
-
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
-
- ret = peer_distribute_set (peer, afi, safi, direct, name_str);
-
- return bgp_vty_return (vty, ret);
-}
-
-static int
-peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *direct_str)
-{
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
-
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
-
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
-
- ret = peer_distribute_unset (peer, afi, safi, direct);
-
- return bgp_vty_return (vty, ret);
-}
-
DEFUN (neighbor_distribute_list,
neighbor_distribute_list_cmd,
"neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
{
int idx_peer = 1;
int idx_acl = 3;
- int idx_in_out = 4;
- return peer_distribute_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
- bgp_node_safi (vty), argv[idx_acl]->arg, argv[idx_in_out]->arg);
+ int direct, ret;
+ struct peer *peer;
+
+ const char *pstr = argv[idx_peer]->arg;
+ const char *acl = argv[idx_acl]->arg;
+ const char *inout = argv[argc-1]->text;
+
+ peer = peer_and_group_lookup_vty (vty, pstr);
+ if (! peer)
+ return CMD_WARNING;
+
+ /* Check filter direction. */
+ direct = strmatch (inout, "in") ? FILTER_IN : FILTER_OUT;
+ ret = peer_distribute_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), direct, acl);
+
+ return bgp_vty_return (vty, ret);
}
ALIAS_HIDDEN (neighbor_distribute_list,
"Filter outgoing updates\n")
{
int idx_peer = 2;
- int idx_in_out = 5;
- return peer_distribute_unset_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
- bgp_node_safi (vty), argv[idx_in_out]->arg);
+ int direct, ret;
+ struct peer *peer;
+
+ const char *pstr = argv[idx_peer]->arg;
+ const char *inout = argv[argc-1]->text;
+
+ peer = peer_and_group_lookup_vty (vty, pstr);
+ if (! peer)
+ return CMD_WARNING;
+
+ /* Check filter direction. */
+ direct = strmatch (inout, "in") ? FILTER_IN : FILTER_OUT;
+ ret = peer_distribute_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty), direct);
+
+ return bgp_vty_return (vty, ret);
}
ALIAS_HIDDEN (no_neighbor_distribute_list,
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER ("maximum number", max, num_str);
+ max = strtoul(num_str, NULL, 10);
if (threshold_str)
threshold = atoi (threshold_str);
else
if (! peer)
return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[idx_number]->arg, 1, 254);
+ gtsm_hops = strtoul(argv[idx_number]->arg, NULL, 10);
/*
* If 'neighbor swpX', then this is for directly connected peers,
*/
if (peer->conf_if && (gtsm_hops > 1)) {
vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s",
- argv[idx_peer]->arg, VTY_NEWLINE);
+ argv[idx_peer]->arg, VTYNL);
return CMD_WARNING;
}
if (argc == 3)
{
- safi_t safi = bgp_vty_safi_from_arg(argv[2]->arg);
+ safi_t safi = bgp_vty_safi_from_str (argv[2]->text);
vty->node = bgp_node_type(AFI_IP, safi);
}
else
{
if (argc == 3)
{
- safi_t safi = bgp_vty_safi_from_arg(argv[2]->arg);
+ safi_t safi = bgp_vty_safi_from_str (argv[2]->text);
vty->node = bgp_node_type(AFI_IP6, safi);
}
else
bgp = bgp_lookup_by_name (view_name);
if (bgp == NULL)
{
- vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE);
+ vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTYNL);
return CMD_WARNING;
}
}
bgp = bgp_get_default ();
if (bgp == NULL)
{
- vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
+ vty_out (vty, "%% No BGP process is configured%s", VTYNL);
return CMD_WARNING;
}
}
ret = str2prefix (ip_str, &match);
if (! ret)
{
- vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
+ vty_out (vty, "%% address is malformed%s", VTYNL);
return CMD_WARNING;
}
int idx_safi = 3;
int idx_ipv6_prefixlen = 5;
return bgp_clear_prefix (vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6,
- bgp_vty_safi_from_arg(argv[idx_safi]->arg), NULL);
+ bgp_vty_safi_from_str(argv[idx_safi]->text), NULL);
}
DEFUN (clear_bgp_instance_ipv6_safi_prefix,
int idx_safi = 5;
int idx_ipv6_prefixlen = 7;
return bgp_clear_prefix (vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, AFI_IP6,
- bgp_vty_safi_from_arg(argv[idx_safi]->arg), NULL);
+ bgp_vty_safi_from_str(argv[idx_safi]->text), NULL);
}
DEFUN (show_bgp_views,
if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
{
- vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
+ vty_out (vty, "BGP Multiple Instance is not enabled%s", VTYNL);
return CMD_WARNING;
}
- vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
+ vty_out (vty, "Defined BGP views:%s", VTYNL);
for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
{
/* Skip VRFs. */
continue;
vty_out (vty, "\t%s (AS%u)%s",
bgp->name ? bgp->name : "(null)",
- bgp->as, VTY_NEWLINE);
+ bgp->as, VTYNL);
}
return CMD_SUCCESS;
if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
{
- vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
+ vty_out (vty, "BGP Multiple Instance is not enabled%s", VTYNL);
return CMD_WARNING;
}
count++;
if (!uj && count == 1)
- vty_out (vty, "%s%s", header, VTY_NEWLINE);
+ vty_out (vty, "%s%s", header, VTYNL);
peers_cfg = peers_estb = 0;
if (uj)
vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s",
type, vrf_id_ui, inet_ntoa (bgp->router_id),
peers_cfg, peers_estb, name,
- VTY_NEWLINE);
+ VTYNL);
}
if (uj)
json_object_int_add(json, "totalVrfs", count);
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
{
if (count)
vty_out (vty, "%sTotal number of VRFs (including default): %d%s",
- VTY_NEWLINE, count, VTY_NEWLINE);
+ VTYNL, count, VTYNL);
}
return CMD_SUCCESS;
vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_node)),
- VTY_NEWLINE);
+ VTYNL);
count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_info)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_info_extra)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
vty_out (vty, "%ld Static routes, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_static)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET)))
vty_out (vty, "%ld Packets, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bpacket)),
- VTY_NEWLINE);
+ VTYNL);
/* Adj-In/Out */
if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_adj_in)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_adj_out)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_nexthop_cache)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct bgp_damp_info)),
- VTY_NEWLINE);
+ VTYNL);
/* Attributes */
count = attr_count();
vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof(struct attr)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof(struct attr_extra)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = attr_unknown_count()))
- vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
+ vty_out (vty, "%ld unknown attributes%s", count, VTYNL);
/* AS_PATH attributes */
count = aspath_count ();
vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct aspath)),
- VTY_NEWLINE);
+ VTYNL);
count = mtype_stats_alloc (MTYPE_AS_SEG);
vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct assegment)),
- VTY_NEWLINE);
+ VTYNL);
/* Other attributes */
if ((count = community_count ()))
vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct community)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct ecommunity)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_LCOMMUNITY)))
vty_out (vty, "%ld BGP large-community entries, using %s of memory%s",
count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct lcommunity)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct cluster_list)),
- VTY_NEWLINE);
+ VTYNL);
/* Peer related usage */
count = mtype_stats_alloc (MTYPE_BGP_PEER);
vty_out (vty, "%ld peers, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct peer)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
vty_out (vty, "%ld peer groups, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct peer_group)),
- VTY_NEWLINE);
+ VTYNL);
/* Other */
if ((count = mtype_stats_alloc (MTYPE_HASH)))
vty_out (vty, "%ld hash tables, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct hash)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct hash_backet)),
- VTY_NEWLINE);
+ VTYNL);
if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (regex_t)),
- VTY_NEWLINE);
+ VTYNL);
return CMD_SUCCESS;
}
vty_out (vty,
"BGP router identifier %s, local AS number %u vrf-id %d",
inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (bgp_update_delay_configured(bgp))
else
{
vty_out (vty, "Read-only mode update-delay limit: %d seconds%s",
- bgp->v_update_delay, VTY_NEWLINE);
+ bgp->v_update_delay, VTYNL);
if (bgp->v_update_delay != bgp->v_establish_wait)
vty_out (vty, " Establish wait: %d seconds%s",
- bgp->v_establish_wait, VTY_NEWLINE);
+ bgp->v_establish_wait, VTYNL);
if (bgp_update_delay_active(bgp))
{
vty_out (vty, " First neighbor established: %s%s",
- bgp->update_delay_begin_time, VTY_NEWLINE);
- vty_out (vty, " Delay in progress%s", VTY_NEWLINE);
+ bgp->update_delay_begin_time, VTYNL);
+ vty_out (vty, " Delay in progress%s", VTYNL);
}
else
{
if (bgp->update_delay_over)
{
vty_out (vty, " First neighbor established: %s%s",
- bgp->update_delay_begin_time, VTY_NEWLINE);
+ bgp->update_delay_begin_time, VTYNL);
vty_out (vty, " Best-paths resumed: %s%s",
- bgp->update_delay_end_time, VTY_NEWLINE);
+ bgp->update_delay_end_time, VTYNL);
vty_out (vty, " zebra update resumed: %s%s",
- bgp->update_delay_zebra_resume_time, VTY_NEWLINE);
+ bgp->update_delay_zebra_resume_time, VTYNL);
vty_out (vty, " peers update resumed: %s%s",
- bgp->update_delay_peers_resume_time, VTY_NEWLINE);
+ bgp->update_delay_peers_resume_time, VTYNL);
}
}
}
else
{
if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
- vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE);
+ vty_out (vty, "Max-med on-startup active%s", VTYNL);
if (bgp->v_maxmed_admin)
- vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE);
+ vty_out (vty, "Max-med administrative active%s", VTYNL);
vty_out(vty, "BGP table version %" PRIu64 "%s",
- bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE);
+ bgp_table_version(bgp->rib[afi][safi]), VTYNL);
ents = bgp_table_count (bgp->rib[afi][safi]);
vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
ents * sizeof (struct bgp_node)),
- VTY_NEWLINE);
+ VTYNL);
/* Peer related usage */
ents = listcount (bgp->peer);
ents,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
ents * sizeof (struct peer)),
- VTY_NEWLINE);
+ VTYNL);
if ((ents = listcount (bgp->group)))
vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
mtype_memstr (memstrbuf, sizeof (memstrbuf),
ents * sizeof (struct peer_group)),
- VTY_NEWLINE);
+ VTYNL);
if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
- vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "Dampening enabled.%s", VTYNL);
+ vty_out (vty, "%s", VTYNL);
/* Subtract 8 here because 'Neighbor' is 8 characters */
vty_out (vty, "Neighbor");
vty_out (vty, "%*s", max_neighbor_width - 8, " ");
- vty_out (vty, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTY_NEWLINE);
+ vty_out (vty, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTYNL);
}
}
else
vty_out (vty, " %12s", lookup_msg(bgp_status_msg, peer->status, NULL));
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
}
json_object_int_add(json, "totalPeers", count);
json_object_int_add(json, "dynamicPeers", dn_count);
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
{
if (count)
- vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
- count, VTY_NEWLINE);
+ vty_out (vty, "%sTotal number of neighbors %d%s", VTYNL,
+ count, VTYNL);
else
{
if (use_json)
vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
- afi_safi_print(afi, safi), VTY_NEWLINE);
+ afi_safi_print(afi, safi), VTYNL);
else
vty_out (vty, "No %s neighbor is configured%s",
- afi_safi_print(afi, safi), VTY_NEWLINE);
+ afi_safi_print(afi, safi), VTYNL);
}
if (dn_count && ! use_json)
{
- vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE);
+ vty_out(vty, "* - dynamic neighbor%s", VTYNL);
vty_out(vty,
"%d dynamic neighbor(s), limit %d%s",
- dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE);
+ dn_count, bgp->dynamic_neighbors_limit, VTYNL);
}
}
bool json_output = false;
if (use_json && is_wildcard)
- vty_out (vty, "{%s", VTY_NEWLINE);
+ vty_out (vty, "{%s", VTYNL);
if (afi_wildcard)
afi = 1; /* AFI_IP */
while (afi < AFI_MAX)
json = json_object_new_object();
if (! is_first)
- vty_out (vty, ",%s", VTY_NEWLINE);
+ vty_out (vty, ",%s", VTYNL);
else
is_first = 0;
else
{
vty_out (vty, "%s%s Summary:%s",
- VTY_NEWLINE, afi_safi_print(afi, safi), VTY_NEWLINE);
+ VTYNL, afi_safi_print(afi, safi), VTYNL);
}
}
bgp_show_summary (vty, bgp, afi, safi, use_json, json);
}
if (use_json && is_wildcard)
- vty_out (vty, "}%s", VTY_NEWLINE);
+ vty_out (vty, "}%s", VTYNL);
else if (use_json && !json_output)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_out (vty, "{}%s", VTYNL);
}
static void
int is_first = 1;
if (use_json)
- vty_out (vty, "{%s", VTY_NEWLINE);
+ vty_out (vty, "{%s", VTYNL);
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
{
json = json_object_new_object();
if (! is_first)
- vty_out (vty, ",%s", VTY_NEWLINE);
+ vty_out (vty, ",%s", VTYNL);
else
is_first = 0;
else
{
vty_out (vty, "%sInstance %s:%s",
- VTY_NEWLINE,
+ VTYNL,
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
- ? "Default" : bgp->name, VTY_NEWLINE);
+ ? "Default" : bgp->name, VTYNL);
}
bgp_show_summary_afi_safi (vty, bgp, afi, safi, use_json, json);
}
if (use_json)
- vty_out (vty, "}%s", VTY_NEWLINE);
+ vty_out (vty, "}%s", VTYNL);
}
if (! bgp)
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_out (vty, "{}%s", VTYNL);
else
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
+ vty_out (vty, "%% No such BGP instance exist%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, "%sreceived",
CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
", " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
vty_out (vty, "%sreceived",
CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
", " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
}
filter = &p->filter[afi][safi];
vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
- VTY_NEWLINE);
+ VTYNL);
if (peer_group_active(p))
- vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
+ vty_out (vty, " %s peer-group member%s", p->group->name, VTYNL);
paf = peer_af_find(p, afi, safi);
if (paf && PAF_SUBGRP(paf))
{
vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s",
- PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE);
+ PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTYNL);
vty_out (vty, " Packet Queue length %d%s",
- bpacket_queue_virtual_length(paf), VTY_NEWLINE);
+ bpacket_queue_virtual_length(paf), VTYNL);
}
else
{
- vty_out(vty, " Not part of any update group%s", VTY_NEWLINE);
+ vty_out(vty, " Not part of any update group%s", VTYNL);
}
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
- vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
+ vty_out (vty, " AF-dependant capabilities:%s", VTYNL);
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
{
vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
- ORF_TYPE_PREFIX, VTY_NEWLINE);
+ ORF_TYPE_PREFIX, VTYNL);
bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
PEER_CAP_ORF_PREFIX_SM_ADV,
PEER_CAP_ORF_PREFIX_RM_ADV,
|| CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
{
vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
- ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
+ ORF_TYPE_PREFIX_OLD, VTYNL);
bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
PEER_CAP_ORF_PREFIX_SM_ADV,
PEER_CAP_ORF_PREFIX_RM_ADV,
vty_out (vty, " sent;");
if (orf_pfx_count)
vty_out (vty, " received (%d entries)", orf_pfx_count);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
- vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
+ vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
- vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
+ vty_out (vty, " Route-Reflector Client%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
- vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
+ vty_out (vty, " Route-Server Client%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
- vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
+ vty_out (vty, " Inbound soft reconfiguration allowed%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
- vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTYNL);
else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
- vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTYNL);
else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
- vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTYNL);
else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
- vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
- vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE);
+ vty_out (vty, " Advertise all paths via addpath%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
- vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE);
+ vty_out (vty, " Advertise bestpath per AS via addpath%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
- vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE);
+ vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
- vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
+ vty_out (vty, " NEXT_HOP is always this router%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
- vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
- vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
- vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
+ vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTYNL);
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
|| CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
|| CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
&& CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
&& CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
- vty_out (vty, "(all)%s", VTY_NEWLINE);
+ vty_out (vty, "(all)%s", VTYNL);
else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
- vty_out (vty, "(large)%s", VTY_NEWLINE);
+ vty_out (vty, "(large)%s", VTYNL);
else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
- vty_out (vty, "(extended)%s", VTY_NEWLINE);
+ vty_out (vty, "(extended)%s", VTYNL);
else
- vty_out (vty, "(standard)%s", VTY_NEWLINE);
+ vty_out (vty, "(standard)%s", VTYNL);
}
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
{
p->default_rmap[afi][safi].map ? "*" : "",
p->default_rmap[afi][safi].name);
if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
- vty_out (vty, " default sent%s", VTY_NEWLINE);
+ vty_out (vty, " default sent%s", VTYNL);
else
- vty_out (vty, " default not sent%s", VTY_NEWLINE);
+ vty_out (vty, " default not sent%s", VTYNL);
}
if (filter->plist[FILTER_IN].name
|| filter->dlist[FILTER_IN].name
|| filter->aslist[FILTER_IN].name
|| filter->map[RMAP_IN].name)
- vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
+ vty_out (vty, " Inbound path policy configured%s", VTYNL);
if (filter->plist[FILTER_OUT].name
|| filter->dlist[FILTER_OUT].name
|| filter->aslist[FILTER_OUT].name
|| filter->map[RMAP_OUT].name
|| filter->usmap.name)
- vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
+ vty_out (vty, " Outbound path policy configured%s", VTYNL);
/* prefix-list */
if (filter->plist[FILTER_IN].name)
vty_out (vty, " Incoming update prefix filter list is %s%s%s",
filter->plist[FILTER_IN].plist ? "*" : "",
filter->plist[FILTER_IN].name,
- VTY_NEWLINE);
+ VTYNL);
if (filter->plist[FILTER_OUT].name)
vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
filter->plist[FILTER_OUT].plist ? "*" : "",
filter->plist[FILTER_OUT].name,
- VTY_NEWLINE);
+ VTYNL);
/* distribute-list */
if (filter->dlist[FILTER_IN].name)
vty_out (vty, " Incoming update network filter list is %s%s%s",
filter->dlist[FILTER_IN].alist ? "*" : "",
filter->dlist[FILTER_IN].name,
- VTY_NEWLINE);
+ VTYNL);
if (filter->dlist[FILTER_OUT].name)
vty_out (vty, " Outgoing update network filter list is %s%s%s",
filter->dlist[FILTER_OUT].alist ? "*" : "",
filter->dlist[FILTER_OUT].name,
- VTY_NEWLINE);
+ VTYNL);
/* filter-list. */
if (filter->aslist[FILTER_IN].name)
vty_out (vty, " Incoming update AS path filter list is %s%s%s",
filter->aslist[FILTER_IN].aslist ? "*" : "",
filter->aslist[FILTER_IN].name,
- VTY_NEWLINE);
+ VTYNL);
if (filter->aslist[FILTER_OUT].name)
vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
filter->aslist[FILTER_OUT].aslist ? "*" : "",
filter->aslist[FILTER_OUT].name,
- VTY_NEWLINE);
+ VTYNL);
/* route-map. */
if (filter->map[RMAP_IN].name)
vty_out (vty, " Route map for incoming advertisements is %s%s%s",
filter->map[RMAP_IN].map ? "*" : "",
filter->map[RMAP_IN].name,
- VTY_NEWLINE);
+ VTYNL);
if (filter->map[RMAP_OUT].name)
vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
filter->map[RMAP_OUT].map ? "*" : "",
filter->map[RMAP_OUT].name,
- VTY_NEWLINE);
+ VTYNL);
/* unsuppress-map */
if (filter->usmap.name)
vty_out (vty, " Route map for selective unsuppress is %s%s%s",
filter->usmap.map ? "*" : "",
- filter->usmap.name, VTY_NEWLINE);
+ filter->usmap.name, VTYNL);
/* Receive prefix count */
- vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
+ vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTYNL);
/* Maximum prefix */
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
{
vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
- ? " (warning-only)" : "", VTY_NEWLINE);
+ ? " (warning-only)" : "", VTYNL);
vty_out (vty, " Threshold for warning message %d%%",
p->pmax_threshold[afi][safi]);
if (p->pmax_restart[afi][safi])
vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
else
{
if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
- vty_out (vty, "confed-internal link%s", VTY_NEWLINE);
+ vty_out (vty, "confed-internal link%s", VTYNL);
else
- vty_out (vty, "internal link%s", VTY_NEWLINE);
+ vty_out (vty, "internal link%s", VTYNL);
}
}
else
else
{
if (bgp_confederation_peers_check(bgp, p->as))
- vty_out (vty, "confed-external link%s", VTY_NEWLINE);
+ vty_out (vty, "confed-external link%s", VTYNL);
else
- vty_out (vty, "external link%s", VTY_NEWLINE);
+ vty_out (vty, "external link%s", VTYNL);
}
}
if (use_json)
json_object_string_add(json_neigh, "nbrDesc", p->desc);
else
- vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
+ vty_out (vty, " Description: %s%s", p->desc, VTYNL);
}
if (p->hostname)
{
if (p->domainname && (p->domainname[0] != '\0'))
vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
- VTY_NEWLINE);
+ VTYNL);
else
- vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
+ vty_out(vty, "Hostname: %s%s", p->hostname, VTYNL);
}
}
else
{
vty_out (vty, " Member of peer-group %s for session parameters%s",
- p->group->name, VTY_NEWLINE);
+ p->group->name, VTYNL);
if (dn_flag[0])
{
if (range)
{
prefix2str(range, buf1, sizeof(buf1));
- vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE);
+ vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTYNL);
}
}
}
{
/* Administrative shutdown. */
if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
- vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
+ vty_out (vty, " Administratively shut down%s", VTYNL);
/* BGP Version. */
vty_out (vty, " BGP version 4");
vty_out (vty, ", remote router ID %s%s",
inet_ntop (AF_INET, &p->remote_id, buf1, sizeof(buf1)),
- VTY_NEWLINE);
+ VTYNL);
/* Confederation */
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
&& bgp_confederation_peers_check (bgp, p->as))
- vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
+ vty_out (vty, " Neighbor under common administration%s", VTYNL);
/* Status. */
vty_out (vty, " BGP state = %s", lookup_msg(bgp_status_msg, p->status, NULL));
else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
vty_out (vty, " (NSF passive)");
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
/* read timer */
vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL));
vty_out (vty, ", Last write %s%s",
- peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE);
+ peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTYNL);
/* Configured timer values. */
vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s",
- p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
+ p->v_holdtime, p->v_keepalive, VTYNL);
if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
{
vty_out (vty, " Configured hold time is %d", p->holdtime);
vty_out (vty, ", keepalive interval is %d seconds%s",
- p->keepalive, VTY_NEWLINE);
+ p->keepalive, VTYNL);
}
}
/* Capability. */
}
else
{
- vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
+ vty_out (vty, " Neighbor capabilities:%s", VTYNL);
/* AS4 */
if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
vty_out (vty, " %sreceived",
CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* AddPath */
if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
|| CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
{
- vty_out (vty, " AddPath:%s", VTY_NEWLINE);
+ vty_out (vty, " AddPath:%s", VTYNL);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" );
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" );
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
}
if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
vty_out (vty, " %sreceived",
CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Extended nexthop */
if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
vty_out (vty, " %sreceived",
CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
{
- vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
+ vty_out (vty, " Address families by peer:%s ", VTYNL);
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
vty_out (vty, " %s%s",
- afi_safi_print (AFI_IP, safi), VTY_NEWLINE);
+ afi_safi_print (AFI_IP, safi), VTYNL);
}
}
&& CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
"old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Multiprotocol Extensions */
vty_out (vty, " advertised");
if (p->afc_recv[afi][safi])
vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Hostname capability */
if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV))
vty_out (vty, " %sreceived",
CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Gracefull Restart */
if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
vty_out (vty, " %sreceived",
CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
{
int restart_af_count = 0;
vty_out (vty, " Remote Restart timer is %d seconds%s",
- p->v_gr_restart, VTY_NEWLINE);
- vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
+ p->v_gr_restart, VTYNL);
+ vty_out (vty, " Address families by peer:%s ", VTYNL);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
}
if (! restart_af_count)
vty_out (vty, "none");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
}
}
else
{
- vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
+ vty_out (vty, " Graceful restart informations:%s", VTYNL);
if (p->status == Established)
{
vty_out (vty, " End-of-RIB send: ");
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
vty_out (vty, " End-of-RIB received: ");
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
{
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (p->t_gr_restart)
vty_out (vty, " The remaining time of restart timer is %ld%s",
- thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
+ thread_timer_remain_second (p->t_gr_restart), VTYNL);
if (p->t_gr_stale)
vty_out (vty, " The remaining time of stalepath timer is %ld%s",
- thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
+ thread_timer_remain_second (p->t_gr_stale), VTYNL);
}
}
if (use_json)
else
{
/* Packet counts. */
- vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
- vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
- vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
- vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
- vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
- vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
- vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
- vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
- vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
- vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
+ vty_out (vty, " Message statistics:%s", VTYNL);
+ vty_out (vty, " Inq depth is 0%s", VTYNL);
+ vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTYNL);
+ vty_out (vty, " Sent Rcvd%s", VTYNL);
+ vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTYNL);
+ vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTYNL);
+ vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTYNL);
+ vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTYNL);
+ vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTYNL);
+ vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTYNL);
vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
- p->dynamic_cap_in, VTY_NEWLINE);
+ p->dynamic_cap_in, VTYNL);
}
if (use_json)
{
/* advertisement-interval */
vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
- p->v_routeadv, VTY_NEWLINE);
+ p->v_routeadv, VTYNL);
/* Update-source. */
if (p->update_if || p->update_source)
vty_out (vty, "%s", p->update_if);
else if (p->update_source)
vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Address Family Information */
}
else
vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped,
- VTY_NEWLINE);
+ VTYNL);
if (! p->last_reset)
{
if (use_json)
json_object_string_add(json_neigh, "lastReset", "never");
else
- vty_out (vty, " Last reset never%s", VTY_NEWLINE);
+ vty_out (vty, " Last reset never%s", VTYNL);
}
else
{
subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode);
vty_out (vty, "due to NOTIFICATION %s (%s%s)%s",
p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received",
- code_str, subcode_str, VTY_NEWLINE);
+ code_str, subcode_str, VTYNL);
if (p->last_reset == PEER_DOWN_NOTIFY_RECEIVED
&& p->notify.code == BGP_NOTIFY_CEASE
&& (p->notify.subcode == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
msg_str = bgp_notify_admin_message(msgbuf, sizeof(msgbuf),
(u_char*)p->notify.data, p->notify.length);
if (msg_str)
- vty_out (vty, " Message: \"%s\"%s", msg_str, VTY_NEWLINE);
+ vty_out (vty, " Message: \"%s\"%s", msg_str, VTYNL);
}
}
else
{
vty_out (vty, "due to %s%s",
- peer_down_str[(int) p->last_reset], VTY_NEWLINE);
+ peer_down_str[(int) p->last_reset], VTYNL);
}
if (p->last_reset_cause_size)
{
msg = p->last_reset_cause;
- vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE);
+ vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTYNL);
for (i = 1; i <= p->last_reset_cause_size; i++)
{
vty_out(vty, "%02X", *msg++);
{
if (i % 16 == 0)
{
- vty_out(vty, "%s ", VTY_NEWLINE);
+ vty_out(vty, "%s ", VTYNL);
}
else if (i % 4 == 0)
{
}
}
}
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out(vty, "%s", VTYNL);
}
}
}
if (use_json)
json_object_boolean_true_add(json_neigh, "prefixesConfigExceedMax");
else
- vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
+ vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTYNL);
if (p->t_pmax_restart)
{
else
vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
p->host, thread_timer_remain_second (p->t_pmax_restart),
- VTY_NEWLINE);
+ VTYNL);
}
else
{
json_object_boolean_true_add(json_neigh, "reducePrefixNumAndClearIpBgp");
else
vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
- p->host, VTY_NEWLINE);
+ p->host, VTYNL);
}
}
{
if (p->gtsm_hops > 0)
vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
- p->gtsm_hops, VTY_NEWLINE);
+ p->gtsm_hops, VTYNL);
else if (p->ttl > 1)
vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
- p->ttl, VTY_NEWLINE);
+ p->ttl, VTYNL);
}
}
else
json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops);
else
vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
- p->gtsm_hops, VTY_NEWLINE);
+ p->gtsm_hops, VTYNL);
}
}
vty_out (vty, "Local host: %s, Local port: %d%s",
sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
ntohs (p->su_local->sin.sin_port),
- VTY_NEWLINE);
+ VTYNL);
}
/* Remote address. */
vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
ntohs (p->su_remote->sin.sin_port),
- VTY_NEWLINE);
+ VTYNL);
}
/* Nexthop display. */
{
vty_out (vty, "Nexthop: %s%s",
inet_ntop (AF_INET, &p->nexthop.v4, buf1, sizeof(buf1)),
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, "Nexthop global: %s%s",
inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, sizeof(buf1)),
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, "Nexthop local: %s%s",
inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, sizeof(buf1)),
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, "BGP connection: %s%s",
p->shared_network ? "shared network" : "non shared network",
- VTY_NEWLINE);
+ VTYNL);
}
}
else
{
vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s",
- p->v_connect, VTY_NEWLINE);
+ p->v_connect, VTYNL);
if (p->status == Established && p->rtt)
vty_out (vty, "Estimated round trip time: %d ms%s",
- p->rtt, VTY_NEWLINE);
+ p->rtt, VTYNL);
if (p->t_start)
vty_out (vty, "Next start timer due in %ld seconds%s",
- thread_timer_remain_second (p->t_start), VTY_NEWLINE);
+ thread_timer_remain_second (p->t_start), VTYNL);
if (p->t_connect)
vty_out (vty, "Next connect timer due in %ld seconds%s",
- thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
+ thread_timer_remain_second (p->t_connect), VTYNL);
if (p->t_routeadv)
vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s",
p->v_routeadv, thread_timer_remain_second (p->t_routeadv),
- VTY_NEWLINE);
+ VTYNL);
if (p->password)
- vty_out (vty, "Peer Authentication Enabled%s", VTY_NEWLINE);
+ vty_out (vty, "Peer Authentication Enabled%s", VTYNL);
vty_out (vty, "Read thread: %s Write thread: %s%s",
p->t_read ? "on" : "off",
p->t_write ? "on" : "off",
- VTY_NEWLINE);
+ VTYNL);
}
if (p->notify.code == BGP_NOTIFY_OPEN_ERR
bgp_capability_vty_out (vty, p, use_json, json_neigh);
if (!use_json)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
/* BFD information. */
bgp_bfd_show_info(vty, p, use_json, json_neigh);
if (use_json)
json_object_boolean_true_add(json, "bgpNoSuchNeighbor");
else
- vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
+ vty_out (vty, "%% No such neighbor%s", VTYNL);
}
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return CMD_SUCCESS;
int is_first = 1;
if (use_json)
- vty_out (vty, "{%s", VTY_NEWLINE);
+ vty_out (vty, "{%s", VTYNL);
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
{
zlog_err("Unable to allocate memory for JSON object");
vty_out (vty,
"{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
- VTY_NEWLINE);
+ VTYNL);
return;
}
? "Default" : bgp->name);
if (! is_first)
- vty_out (vty, ",%s", VTY_NEWLINE);
+ vty_out (vty, ",%s", VTYNL);
else
is_first = 0;
else
{
vty_out (vty, "%sInstance %s:%s",
- VTY_NEWLINE,
+ VTYNL,
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
? "Default" : bgp->name,
- VTY_NEWLINE);
+ VTYNL);
}
bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json);
}
if (use_json)
- vty_out (vty, "}%s", VTY_NEWLINE);
+ vty_out (vty, "}%s", VTYNL);
}
static int
{
json = json_object_new_object();
json_object_boolean_true_add(json, "bgpNoSuchInstance");
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
+ vty_out (vty, "%% No such BGP instance exist%s", VTYNL);
return CMD_WARNING;
}
BGP_SAFI_HELP_STR
"Path information\n")
{
- vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
+ vty_out (vty, "Address Refcnt Path%s", VTYNL);
aspath_print_all_vty (vty);
return CMD_SUCCESS;
}
com = (struct community *) backet->data;
vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
- community_str (com), VTY_NEWLINE);
+ community_str (com), VTYNL);
}
/* Show BGP's community internal data. */
BGP_STR
"List all bgp community information\n")
{
- vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
+ vty_out (vty, "Address Refcnt Community%s", VTYNL);
hash_iterate (community_hash (),
(void (*) (struct hash_backet *, void *))
lcom = (struct lcommunity *) backet->data;
vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, lcom->refcnt,
- lcommunity_str (lcom), VTY_NEWLINE);
+ lcommunity_str (lcom), VTYNL);
}
/* Show BGP's community internal data. */
BGP_STR
"List all bgp large-community information\n")
{
- vty_out (vty, "Address Refcnt Large-community%s", VTY_NEWLINE);
+ vty_out (vty, "Address Refcnt Large-community%s", VTYNL);
hash_iterate (lcommunity_hash (),
(void (*) (struct hash_backet *, void *))
for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
{
vty_out (vty, "%sInstance %s:%s",
- VTY_NEWLINE,
+ VTYNL,
(bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
- VTY_NEWLINE);
+ VTYNL);
update_group_show(bgp, afi, safi, vty, 0);
}
}
/* get subgroup id, if provided */
idx = argc - 1;
if (argv[idx]->type == VARIABLE_TKN)
- VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx]->arg);
+ subgrp_id = strtoull(argv[idx]->arg, NULL, 10);
return (bgp_show_update_groups(vty, vrf, afi, safi, subgrp_id));
}
int idx_safi = 3;
int idx_type = 5;
show_bgp_updgrps_adj_info_aux(vty, NULL,
- bgp_vty_afi_from_arg(argv[idx_afi]->arg),
- bgp_vty_safi_from_arg(argv[idx_safi]->arg),
+ bgp_vty_afi_from_str(argv[idx_afi]->text),
+ bgp_vty_safi_from_str(argv[idx_safi]->text),
argv[idx_type]->arg, 0);
return CMD_SUCCESS;
}
int idx_type = 5;
uint64_t subgrp_id;
- VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg);
+ subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
int idx_type = 7;
uint64_t subgrp_id;
- VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg);
+ subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
int idx_type = 6;
uint64_t subgrp_id;
- VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg);
+ subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, NULL,
- bgp_vty_afi_from_arg(argv[idx_afi]->arg),
- bgp_vty_safi_from_arg(argv[idx_safi]->arg),
+ bgp_vty_afi_from_str(argv[idx_afi]->text),
+ bgp_vty_safi_from_str(argv[idx_safi]->text),
argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
}
int idx_type = 4;
uint64_t subgrp_id;
- VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg);
+ subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
int idx_type = 6;
uint64_t subgrp_id;
- VTY_GET_ULL("subgroup-id", subgrp_id, argv[idx_subgroup_id]->arg);
+ subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP6, SAFI_UNICAST, argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
if (conf->as_type == AS_SPECIFIED ||
conf->as_type == AS_EXTERNAL) {
vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
- VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE);
+ VTYNL, group->name, conf->as, VTYNL);
} else if (conf->as_type == AS_INTERNAL) {
vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
- VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE);
+ VTYNL, group->name, group->bgp->as, VTYNL);
} else {
vty_out (vty, "%sBGP peer-group %s%s",
- VTY_NEWLINE, group->name, VTY_NEWLINE);
+ VTYNL, group->name, VTYNL);
}
if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL))
- vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE);
+ vty_out (vty, " Peer-group type is internal%s", VTYNL);
else
- vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE);
+ vty_out (vty, " Peer-group type is external%s", VTYNL);
/* Display AFs configured. */
vty_out (vty, " Configured address-families:");
}
}
if (!af_cfgd)
- vty_out (vty, " none%s", VTY_NEWLINE);
+ vty_out (vty, " none%s", VTYNL);
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
/* Display listen ranges (for dynamic neighbors), if any */
for (afi = AFI_IP; afi < AFI_MAX; afi++)
{
vty_out(vty,
" %d %s listen range(s)%s",
- lr_count, af_str, VTY_NEWLINE);
+ lr_count, af_str, VTYNL);
for (ALL_LIST_ELEMENTS (group->listen_range[afi], node,
nnode, range))
{
prefix2str(range, buf, sizeof(buf));
- vty_out(vty, " %s%s", buf, VTY_NEWLINE);
+ vty_out(vty, " %s%s", buf, VTYNL);
}
}
}
/* Display group members and their status */
if (listcount(group->peer))
{
- vty_out (vty, " Peer-group members:%s", VTY_NEWLINE);
+ vty_out (vty, " Peer-group members:%s", VTYNL);
for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
{
if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
dynamic = peer_dynamic_neighbor(peer);
vty_out (vty, " %s %s %s %s",
peer->host, dynamic ? "(dynamic)" : "",
- peer_status, VTY_NEWLINE);
+ peer_status, VTYNL);
}
}
}
if (type == show_peer_group && ! find)
- vty_out (vty, "%% No such peer-group%s", VTY_NEWLINE);
+ vty_out (vty, "%% No such peer-group%s", VTYNL);
return CMD_SUCCESS;
}
if (! bgp)
{
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
+ vty_out (vty, "%% No such BGP instance exist%s", VTYNL);
return CMD_WARNING;
}
type = proto_redistnum (AFI_IP, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
bgp_redist_add(bgp, AFI_IP, type, 0);
type = proto_redistnum (AFI_IP, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
type = proto_redistnum (AFI_IP, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, type, 0);
bgp_redistribute_metric_set(bgp, red, AFI_IP, type, metric);
type = proto_redistnum (AFI_IP, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, type, 0);
bgp_redistribute_rmap_set (red, argv[idx_word]->arg);
type = proto_redistnum (AFI_IP, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, type, 0);
bgp_redistribute_metric_set(bgp, red, AFI_IP, type, metric);
u_short instance;
u_short protocol;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
protocol = ZEBRA_ROUTE_OSPF;
else
protocol = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, protocol, instance);
bgp_redistribute_rmap_set (red, argv[idx_word]->arg);
return bgp_redistribute_set (bgp, AFI_IP, protocol, instance);
else
protocol = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
- VTY_GET_INTEGER ("metric", metric, argv[idx_number_2]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
+ metric = strtoul(argv[idx_number_2]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, protocol, instance);
bgp_redistribute_metric_set(bgp, red, AFI_IP, protocol, metric);
else
protocol = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
- VTY_GET_INTEGER ("metric", metric, argv[idx_number_2]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
+ metric = strtoul(argv[idx_number_2]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, protocol, instance);
bgp_redistribute_rmap_set (red, argv[idx_word]->arg);
else
protocol = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
- VTY_GET_INTEGER ("metric", metric, argv[idx_number_2]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
+ metric = strtoul(argv[idx_number_2]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP, protocol, instance);
bgp_redistribute_metric_set(bgp, red, AFI_IP, protocol, metric);
else
protocol = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
return bgp_redistribute_unset (bgp, AFI_IP, protocol, instance);
}
type = proto_redistnum (AFI_IP, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
return bgp_redistribute_unset (bgp, AFI_IP, type, 0);
type = proto_redistnum (AFI_IP6, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
type = proto_redistnum (AFI_IP6, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
type = proto_redistnum (AFI_IP6, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP6, type, 0);
bgp_redistribute_metric_set(bgp, red, AFI_IP6, type, metric);
type = proto_redistnum (AFI_IP6, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP6, type, 0);
bgp_redistribute_rmap_set (red, argv[idx_word]->arg);
type = proto_redistnum (AFI_IP6, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
red = bgp_redist_add(bgp, AFI_IP6, type, 0);
bgp_redistribute_metric_set(bgp, red, AFI_IP6, SAFI_UNICAST, metric);
type = proto_redistnum (AFI_IP6, argv[idx_protocol]->text);
if (type < 0)
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_out (vty, "%% Invalid route type%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, " metric %u", red->redist_metric);
if (red->rmap.name)
vty_out (vty, " route-map %s", red->rmap.name);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
}
switch (ret)
{
case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
- vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
+ vty_out (vty, "%% Can't find community-list%s", VTYNL);
break;
case COMMUNITY_LIST_ERR_MALFORMED_VAL:
- vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed community-list value%s", VTYNL);
break;
case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
- vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
+ vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTYNL);
break;
case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
- vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
+ vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTYNL);
break;
}
}
vty_out (vty, "Community %s list %s%s",
entry->style == COMMUNITY_LIST_STANDARD ?
"standard" : "(expanded) access",
- list->name, VTY_NEWLINE);
+ list->name, VTYNL);
else
vty_out (vty, "Named Community %s list %s%s",
entry->style == COMMUNITY_LIST_STANDARD ?
"standard" : "expanded",
- list->name, VTY_NEWLINE);
+ list->name, VTYNL);
}
if (entry->any)
vty_out (vty, " %s%s",
- community_direct_str (entry->direct), VTY_NEWLINE);
+ community_direct_str (entry->direct), VTYNL);
else
vty_out (vty, " %s %s%s",
community_direct_str (entry->direct),
entry->style == COMMUNITY_LIST_STANDARD
? community_str (entry->u.com) : entry->config,
- VTY_NEWLINE);
+ VTYNL);
}
}
list = community_list_lookup (bgp_clist, argv[idx_comm_list]->arg, COMMUNITY_LIST_MASTER);
if (! list)
{
- vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
+ vty_out (vty, "%% Can't find community-list%s", VTYNL);
return CMD_WARNING;
}
cl_name = argv[idx]->arg;
if (reject_all_digit_name && all_digit (cl_name))
{
- vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
+ vty_out (vty, "%% Community name cannot have all digits%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, "Large community %s list %s%s",
entry->style == EXTCOMMUNITY_LIST_STANDARD ?
"standard" : "(expanded) access",
- list->name, VTY_NEWLINE);
+ list->name, VTYNL);
else
vty_out (vty, "Named large community %s list %s%s",
entry->style == EXTCOMMUNITY_LIST_STANDARD ?
"standard" : "expanded",
- list->name, VTY_NEWLINE);
+ list->name, VTYNL);
}
if (entry->any)
vty_out (vty, " %s%s",
- community_direct_str (entry->direct), VTY_NEWLINE);
+ community_direct_str (entry->direct), VTYNL);
else
vty_out (vty, " %s %s%s",
community_direct_str (entry->direct),
entry->style == EXTCOMMUNITY_LIST_STANDARD ?
entry->u.ecom->str : entry->config,
- VTY_NEWLINE);
+ VTYNL);
}
}
list = community_list_lookup (bgp_clist, argv[3]->arg, LARGE_COMMUNITY_LIST_MASTER);
if (! list)
{
- vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
+ vty_out (vty, "%% Can't find extcommunity-list%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, "Extended community %s list %s%s",
entry->style == EXTCOMMUNITY_LIST_STANDARD ?
"standard" : "(expanded) access",
- list->name, VTY_NEWLINE);
+ list->name, VTYNL);
else
vty_out (vty, "Named extended community %s list %s%s",
entry->style == EXTCOMMUNITY_LIST_STANDARD ?
"standard" : "expanded",
- list->name, VTY_NEWLINE);
+ list->name, VTYNL);
}
if (entry->any)
vty_out (vty, " %s%s",
- community_direct_str (entry->direct), VTY_NEWLINE);
+ community_direct_str (entry->direct), VTYNL);
else
vty_out (vty, " %s %s%s",
community_direct_str (entry->direct),
entry->style == EXTCOMMUNITY_LIST_STANDARD ?
entry->u.ecom->str : entry->config,
- VTY_NEWLINE);
+ VTYNL);
}
}
list = community_list_lookup (bgp_clist, argv[idx_comm_list]->arg, EXTCOMMUNITY_LIST_MASTER);
if (! list)
{
- vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
+ vty_out (vty, "%% Can't find extcommunity-list%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, "ip community-list %s %s %s%s",
list->name, community_direct_str (entry->direct),
community_list_config_str (entry),
- VTY_NEWLINE);
+ VTYNL);
write++;
}
for (list = cm->str.head; list; list = list->next)
? "standard" : "expanded",
list->name, community_direct_str (entry->direct),
community_list_config_str (entry),
- VTY_NEWLINE);
+ VTYNL);
write++;
}
{
vty_out (vty, "ip extcommunity-list %s %s %s%s",
list->name, community_direct_str (entry->direct),
- community_list_config_str (entry), VTY_NEWLINE);
+ community_list_config_str (entry), VTYNL);
write++;
}
for (list = cm->str.head; list; list = list->next)
entry->style == EXTCOMMUNITY_LIST_STANDARD
? "standard" : "expanded",
list->name, community_direct_str (entry->direct),
- community_list_config_str (entry), VTY_NEWLINE);
+ community_list_config_str (entry), VTYNL);
write++;
}
{
vty_out (vty, "ip large-community-list %s %s %s%s",
list->name, community_direct_str (entry->direct),
- community_list_config_str (entry), VTY_NEWLINE);
+ community_list_config_str (entry), VTYNL);
write++;
}
for (list = cm->str.head; list; list = list->next)
entry->style == LARGE_COMMUNITY_LIST_STANDARD
? "standard" : "expanded",
list->name, community_direct_str (entry->direct),
- community_list_config_str (entry), VTY_NEWLINE);
+ community_list_config_str (entry), VTYNL);
write++;
}
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);
}
}
- 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)
{
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);
}
{
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. */
{
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. */
{
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)
{
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 */
{
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. */
{
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);
}
}
if_ras_printed = TRUE;
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* remote-as and peer-group */
{
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 */
/* 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);
}
}
}
|| (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 */
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);
}
}
|| ! 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);
}
}
{
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 */
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);
}
}
{
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);
}
}
{
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);
}
}
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);
}
}
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)
|| 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));
}
}
((! 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 */
((! 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) &&
(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 */
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
}
{
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' */
{
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
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,
" no neighbor %s activate%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
}
}
{
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. */
vty_out (vty, " send");
else
vty_out (vty, " receive");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* Route reflector client. */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s route-reflector-client%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* next-hop-self force */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s next-hop-self force%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* next-hop-self */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s next-hop-self%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* remove-private-AS */
{
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 */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s as-override%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* send-community print. */
{
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
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s send-community all%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
else
{
{
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) &&
{
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) &&
{
afi_header_vty_out (vty, afi, safi, write,
" no neighbor %s send-community%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
}
}
" 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. */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s soft-reconfiguration inbound%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* maximum-prefix. */
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. */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s route-server-client%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* Nexthop-local unchanged. */
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s nexthop-local unchanged%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
/* allowas-in <1-10> */
{
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);
}
}
}
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s allowas-in origin%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
}
{
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);
}
}
{
afi_header_vty_out (vty, afi, safi, write,
" neighbor %s attribute-unchanged%s",
- addr, VTY_NEWLINE);
+ addr, VTYNL);
}
else
{
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);
}
}
}
if (*write)
return;
- vty_out (vty, " !%s address-family ", VTY_NEWLINE);
+ vty_outln (vty, " !%s address-family ", VTYNL);
if (afi == AFI_IP)
{
if (safi == SAFI_EVPN)
vty_out (vty, "l2vpn evpn");
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
*write = 1;
}
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;
}
/* 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);
(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)
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);
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 */
/* 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))
{
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],
/* 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))
/* 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);
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "VNC not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "VNC not configured");
return CMD_WARNING;
}
ecomadd = ecommunity_str2com (argv[0]->arg, ECOMMUNITY_ROUTE_TARGET, 0);
if (!ecomadd)
{
- vty_out (vty, "Malformed community-list value%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed community-list value");
if (ecom)
ecommunity_free (&ecom);
return CMD_WARNING;
if (!argv[1]->arg[8] || *end)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
if (value32 > 0xffff)
{
- vty_out (vty, "%% Malformed rd (must be less than %u%s",
- 0x0ffff, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd (must be less than %u",
+ 0x0ffff);
return CMD_WARNING;
}
ret = str2prefix_rd (argv[1]->arg, &prd);
if (!ret)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
}
VTY_DECLVAR_CONTEXT(bgp, bgp);
uint8_t value = 0;
- if (!strcmp (argv[1]->arg, "auto-vn"))
+ if (strmatch(argv[1]->text, "auto-vn"))
{
value = 0;
}
value = value_l & 0xff;
if (!argv[1]->arg[0] || *end)
{
- vty_out (vty, "%% Malformed l2 nve ID \"%s\"%s", argv[1]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed l2 nve ID \"%s\"",argv[1]->arg);
return CMD_WARNING;
}
if ((value_l < 1) || (value_l > 0xff))
{
- vty_out (vty,
- "%% Malformed l2 nve id (must be greater than 0 and less than %u%s",
- 0x100, VTY_NEWLINE);
+ vty_outln (vty,
+ "%% Malformed l2 nve id (must be greater than 0 and less than %u",
+ 0x100);
return CMD_WARNING;
}
}
if (!h)
return CMD_WARNING;
- if (!strcmp (argv[1]->arg, "infinite"))
+ if (strmatch(argv[1]->text, "infinite"))
{
rspint = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Response Lifetime", rspint, argv[1]->arg);
+ rspint = strtoul(argv[1]->arg, NULL, 10);
if (rspint > INT32_MAX)
rspint = INT32_MAX; /* is really an int, not an unsigned int */
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "RFAPI not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "RFAPI not configured");
return CMD_WARNING;
}
localadmin = strtoul (argv[4]->arg, &endptr, 0);
if (!argv[4]->arg[0] || *endptr)
{
- vty_out (vty, "%% Malformed value%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed value");
return CMD_WARNING;
}
if (localadmin > 0xffff)
{
- vty_out (vty, "%% Value out of range (0-%d)%s", 0xffff, VTY_NEWLINE);
+ vty_outln (vty, "%% Value out of range (0-%d)", 0xffff);
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "RFAPI not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "RFAPI not configured");
return CMD_WARNING;
}
break;
default:
- vty_out (vty, "unknown redistribute mode%s", VTY_NEWLINE);
+ vty_outln (vty, "unknown redistribute mode");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "RFAPI not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "RFAPI not configured");
return CMD_WARNING;
}
if (rfapi_str2route_type (argv[2]->arg, argv[3]->arg, &afi, &type))
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid route type");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "RFAPI not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "RFAPI not configured");
return CMD_WARNING;
}
if (rfapi_str2route_type (argv[3]->arg, argv[4]->arg, &afi, &type))
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid route type");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "RFAPI not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "RFAPI not configured");
return CMD_WARNING;
}
if (rfapi_str2route_type (argv[2]->arg, "bgp-direct-to-nve-groups", &afi, &type))
{
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid route type");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
vnc_redistribute_prechange (bgp);
- if (!strcmp (argv[3]->arg, "infinite"))
+ if (strmatch(argv[3]->text, "infinite"))
{
bgp->rfapi_cfg->redist_lifetime = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Response Lifetime", bgp->rfapi_cfg->redist_lifetime,
- argv[3]->arg);
+ bgp->rfapi_cfg->redist_lifetime = strtoul(argv[3]->arg, NULL, 10);
}
vnc_redistribute_postchange (bgp);
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
- if (!strcmp (argv[3]->arg, "bgp-direct"))
+ if (strmatch(argv[3]->text, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
route_type = ZEBRA_ROUTE_BGP_DIRECT_EXT;
}
- if (!strcmp (argv[4]->arg, "ipv4"))
+ if (strmatch(argv[4]->text, "ipv4"))
{
afi = AFI_IP;
}
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
- if (!strcmp (argv[2]->arg, "bgp-direct"))
+ if (strmatch(argv[2]->text, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
route_type = ZEBRA_ROUTE_BGP_DIRECT_EXT;
}
- if (!strcmp (argv[3]->arg, "ipv4"))
+ if (strmatch(argv[3]->text, "ipv4"))
{
afi = AFI_IP;
}
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
- if (!strcmp (argv[3]->arg, "bgp-direct"))
+ if (strmatch(argv[3]->text, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
- if (!strcmp (argv[2]->arg, "bgp-direct"))
+ if (strmatch(argv[2]->text, "bgp-direct"))
{
route_type = ZEBRA_ROUTE_BGP_DIRECT;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- if (!strcmp (argv[3]->arg, "ipv4"))
+ if (strmatch(argv[3]->text, "ipv4"))
{
afi = AFI_IP;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- if (!strcmp (argv[2]->arg, "ipv4"))
+ if (strmatch(argv[2]->text, "ipv4"))
{
afi = AFI_IP;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "VNC not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "VNC not configured");
return CMD_WARNING;
}
newmode = BGP_VNC_CONFIG_EXPORT_BGP_MODE_RH;
break;
default:
- vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE);
+ vty_outln (vty, "Invalid mode specified");
return CMD_WARNING;
}
if (newmode == oldmode)
{
- vty_out (vty, "Mode unchanged%s", VTY_NEWLINE);
+ vty_outln (vty, "Mode unchanged");
return CMD_SUCCESS;
}
/*
* export to zebra with RH mode is not yet implemented
*/
- vty_out (vty, "Changing modes for zebra export not implemented yet%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Changing modes for zebra export not implemented yet");
return CMD_WARNING;
oldmode = bgp->rfapi_cfg->flags & BGP_VNC_CONFIG_EXPORT_ZEBRA_MODE_BITS;
}
break;
default:
- vty_out (vty, "Invalid mode%s", VTY_NEWLINE);
+ vty_outln (vty, "Invalid mode");
return CMD_WARNING;
}
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- if (!strcmp (argv[3]->arg, "ipv4"))
+ if (strmatch(argv[3]->text, "ipv4"))
{
afi = AFI_IP;
}
if (argv[2]->arg[0] == 'b')
{
if (((argc > 5)
- && !strcmp (argv[5]->arg, rfg->plist_export_bgp_name[afi]))
+ && strmatch(argv[5]->text, rfg->plist_export_bgp_name[afi]))
|| (argc <= 5))
{
else
{
if (((argc > 5)
- && !strcmp (argv[5]->arg, rfg->plist_export_zebra_name[afi]))
+ && strmatch(argv[5]->text, rfg->plist_export_zebra_name[afi]))
|| (argc <= 5))
{
if (rfg->plist_export_zebra_name[afi])
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- if (!strcmp (argv[2]->arg, "ipv4"))
+ if (strmatch(argv[2]->text, "ipv4"))
{
afi = AFI_IP;
}
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (argv[2]->arg[0] == 'b')
{
if (((argc > 4)
- && !strcmp (argv[4]->arg, rfg->routemap_export_bgp_name))
+ && strmatch(argv[4]->text, rfg->routemap_export_bgp_name))
|| (argc <= 4))
{
else
{
if (((argc > 4)
- && !strcmp (argv[4]->arg, rfg->routemap_export_zebra_name))
+ && strmatch(argv[4]->text, rfg->routemap_export_zebra_name))
|| (argc <= 4))
{
if (rfg->routemap_export_zebra_name)
if (!bgp->rfapi_cfg)
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
- if (!strcmp (argv[4]->arg, "ipv4"))
+ if (strmatch(argv[4]->text, "ipv4"))
{
afi = AFI_IP;
}
{
if (((argc > 6)
&& hc->plist_export_bgp_name[afi]
- && !strcmp (argv[6]->arg, hc->plist_export_bgp_name[afi]))
+ && strmatch(argv[6]->text, hc->plist_export_bgp_name[afi]))
|| (argc <= 6))
{
{
if (((argc > 6)
&& hc->plist_export_zebra_name[afi]
- && !strcmp (argv[6]->arg, hc->plist_export_zebra_name[afi]))
+ && strmatch(argv[6]->text, hc->plist_export_zebra_name[afi]))
|| (argc <= 6))
{
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
- if (!strcmp (argv[3]->arg, "ipv4"))
+ if (strmatch(argv[3]->text, "ipv4"))
{
afi = AFI_IP;
}
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
{
if (((argc > 5)
&& hc->routemap_export_bgp_name
- && !strcmp (argv[5]->arg, hc->routemap_export_bgp_name))
+ && strmatch(argv[5]->text, hc->routemap_export_bgp_name))
|| (argc <= 5))
{
{
if (((argc > 5)
&& hc->routemap_export_zebra_name
- && !strcmp (argv[5]->arg, hc->routemap_export_zebra_name))
+ && strmatch(argv[5]->text, hc->routemap_export_zebra_name))
|| (argc <= 5))
{
if (!(hc = bgp->rfapi_cfg))
{
- vty_out (vty, "rfapi not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "rfapi not configured");
return CMD_WARNING;
}
if (!rfg)
{
/* Error out of memory */
- vty_out (vty, "Can't allocate memory for NVE group%s", VTY_NEWLINE);
+ vty_out (vty, "Can't allocate memory for NVE group%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, " un=");
rfapiPrintRfapiIpAddr (vty, &rfd->un_addr);
if (vty)
- vty_out (vty, " to new group \"%s\"%s", rfd->rfg->name,
- VTY_NEWLINE);
+ vty_outln (vty, " to new group \"%s\"",rfd->rfg->name);
}
}
vty_out (vty, " un=");
rfapiPrintRfapiIpAddr (vty, &rfd->un_addr);
if (vty)
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
list_delete (orphaned_nves);
}
if (!rfg)
{
if (vty)
- vty_out (vty, "No NVE group named \"%s\"%s", rfg_name,
- VTY_NEWLINE);
+ vty_outln (vty, "No NVE group named \"%s\"",rfg_name);
return CMD_WARNING;
}
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!str2prefix (argv[2]->arg, &p))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", argv[2]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix \"%s\"", argv[2]->arg);
return CMD_WARNING;
}
afi = family2afi (p.family);
if (!afi)
{
- vty_out (vty, "Unsupported address family%s", VTY_NEWLINE);
+ vty_outln (vty, "Unsupported address family");
return CMD_WARNING;
}
/*
* different group name: fail
*/
- vty_out (vty, "nve group \"%s\" already has \"%s\" prefix %s%s",
+ vty_outln (vty, "nve group \"%s\" already has \"%s\" prefix %s",
((struct rfapi_nve_group_cfg *) (rn->info))->name,
- argv[1]->arg, argv[2]->arg, VTY_NEWLINE);
+ argv[1]->arg, argv[2]->arg);
return CMD_WARNING;
}
else
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- if (!strcmp (argv[1]->arg, "auto:vn"))
+ if (strmatch(argv[1]->text, "auto:vn"))
{
rfg->l2rd = 0;
}
if (!argv[1]->arg[0] || *end)
{
- vty_out (vty, "%% Malformed l2 nve ID \"%s\"%s", argv[1]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed l2 nve ID \"%s\"",argv[1]->arg);
return CMD_WARNING;
}
if ((value_l < 1) || (value_l > 0xff))
{
- vty_out (vty,
- "%% Malformed l2 nve id (must be greater than 0 and less than %u%s",
- 0x100, VTY_NEWLINE);
+ vty_outln (vty,
+ "%% Malformed l2 nve id (must be greater than 0 and less than %u",
+ 0x100);
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!argv[1]->arg[8] || *end)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
if (value32 > 0xffff)
{
- vty_out (vty, "%% Malformed rd (must be less than %u%s",
- 0x0ffff, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd (must be less than %u",
+ 0x0ffff);
return CMD_WARNING;
}
ret = str2prefix_rd (argv[1]->arg, &prd);
if (!ret)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
}
if (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- if (!strcmp (argv[1]->arg, "infinite"))
+ if (strmatch(argv[1]->text, "infinite"))
{
rspint = RFAPI_INFINITE_LIFETIME;
}
else
{
- VTY_GET_INTEGER ("Response Lifetime", rspint, argv[1]->arg);
+ rspint = strtoul(argv[1]->arg, NULL, 10);
}
rfg->response_lifetime = rspint;
if (!bgp)
{
- vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
+ vty_out (vty, "No BGP process is configured%s", VTYNL);
return CMD_WARNING;
}
if (!rfg)
{
/* Error out of memory */
- vty_out (vty, "Can't allocate memory for NVE group%s", VTY_NEWLINE);
+ vty_out (vty, "Can't allocate memory for NVE group%s", VTYNL);
return CMD_WARNING;
}
}
if (!bgp)
{
- vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
+ vty_outln (vty, "No BGP process is configured");
return CMD_WARNING;
}
return bgp_rfapi_delete_named_nve_group (vty, bgp, argv[2]->arg, RFAPI_GROUP_CFG_VRF);
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- VTY_GET_INTEGER_RANGE ("Label value", label, argv[1]->arg, 0, MPLS_LABEL_MAX);
+ label = strtoul(argv[1]->arg, NULL, 10);
if (bgp->rfapi_cfg->rfg_redist == rfg)
{
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
/* Not in list anymore */
- vty_out (vty, "Current VRF group no longer exists%s", VTY_NEWLINE);
+ vty_outln (vty, "Current VRF group no longer exists");
return CMD_WARNING;
}
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
/* Not in list anymore */
- vty_out (vty, "Current VRF no longer exists%s", VTY_NEWLINE);
+ vty_outln (vty, "Current VRF no longer exists");
return CMD_WARNING;
}
if (!str2prefix (argv[1]->arg, &p) && p.family)
{
- //vty_out (vty, "Nexthop set to self%s", VTY_NEWLINE);
+ //vty_out (vty, "Nexthop set to self%s", VTYNL);
SET_FLAG (rfg->flags, RFAPI_RFG_VPN_NH_SELF);
memset(&rfg->vn_prefix, 0, sizeof(struct prefix));
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (!*(argv[1]->arg + 5) || *end)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
if (value32 > 0xffff)
{
- vty_out (vty, "%% Malformed rd (must be less than %u%s",
- 0x0ffff, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd (must be less than %u",
+ 0x0ffff);
return CMD_WARNING;
}
ret = str2prefix_rd (argv[1]->arg, &prd);
if (!ret)
{
- vty_out (vty, "%% Malformed rd%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed rd");
return CMD_WARNING;
}
}
if (!bgp)
{
- vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
+ vty_out (vty, "No BGP process is configured%s", VTYNL);
return CMD_WARNING;
}
if (!rfg)
{
/* Error out of memory */
- vty_out (vty, "Can't allocate memory for L2 group%s", VTY_NEWLINE);
+ vty_out (vty, "Can't allocate memory for L2 group%s", VTYNL);
return CMD_WARNING;
}
rfg->name = strdup (argv[1]->arg);
if (!rfg)
{
if (vty)
- vty_out (vty, "No L2 group named \"%s\"%s", rfg_name,
- VTY_NEWLINE);
+ vty_outln (vty, "No L2 group named \"%s\"",rfg_name);
return CMD_WARNING;
}
}
if (!bgp)
{
- vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
+ vty_outln (vty, "No BGP process is configured");
return CMD_WARNING;
}
return bgp_rfapi_delete_named_l2_group (vty, bgp, argv[3]->arg);
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
- VTY_GET_INTEGER ("logical-network-id", rfg->logical_net_id, argv[1]->arg);
+ rfg->logical_net_id = strtoul(argv[1]->arg, NULL, 10);
return CMD_SUCCESS;
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
for (; argc; --argc, ++argv)
{
uint32_t label;
- VTY_GET_INTEGER_RANGE ("Label value", label, argv[0]->arg, 0, MPLS_LABEL_MAX);
+ label = strtoul(argv[0]->arg, NULL, 10);
if (!listnode_lookup (ll, (void *) (uintptr_t) label))
listnode_add (ll, (void *) (uintptr_t) label);
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
ll = rfg->labels;
if (ll == NULL)
{
- vty_out (vty, "Label no longer associated with group%s", VTY_NEWLINE);
+ vty_outln (vty, "Label no longer associated with group");
return CMD_WARNING;
}
for (; argc; --argc, ++argv)
{
uint32_t label;
- VTY_GET_INTEGER_RANGE ("Label value", label, argv[0]->arg, 0, MPLS_LABEL_MAX);
+ label = strtoul(argv[0]->arg, NULL, 10);
listnode_delete (ll, (void *) (uintptr_t) label);
}
do_export = 1;
break;
default:
- vty_out (vty, "Unknown option, %s%s", argv[1]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Unknown option, %s", argv[1]->arg);
return CMD_ERR_NO_MATCH;
}
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 (!listnode_lookup (bgp->rfapi_cfg->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 CMD_WARNING;
}
if (bgp->rfapi == NULL || hc == NULL)
return write;
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
for (ALL_LIST_ELEMENTS (hc->nve_groups_sequential, node, nnode, rfg))
if (rfg->type == RFAPI_GROUP_CFG_VRF)
{
++write;
- vty_out (vty, " vrf-policy %s%s", rfg->name, VTY_NEWLINE);
+ vty_outln (vty, " vrf-policy %s", rfg->name);
if (rfg->label <= MPLS_LABEL_MAX)
{
- vty_out (vty, " label %u%s", rfg->label, VTY_NEWLINE);
+ vty_outln (vty, " label %u", rfg->label);
}
if (CHECK_FLAG (rfg->flags, RFAPI_RFG_VPN_NH_SELF))
{
- vty_out (vty, " nexthop self%s", VTY_NEWLINE);
+ vty_outln (vty, " nexthop self");
}
else
inet_ntop(rfg->vn_prefix.family, &rfg->vn_prefix.u.prefix, buf, sizeof(buf));
if (!buf[0] || buf[BUFSIZ - 1])
{
- //vty_out (vty, "nexthop self%s", VTY_NEWLINE);
+ //vty_out (vty, "nexthop self%s", VTYNL);
}
else
{
- vty_out (vty, " nexthop %s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, " nexthop %s", buf);
}
}
}
value = ((rfg->rd.val[6] << 8) & 0x0ff00) |
(rfg->rd.val[7] & 0x0ff);
- vty_out (vty, " rd auto:nh:%d%s", value, VTY_NEWLINE);
+ vty_outln (vty, " rd auto:nh:%d", value);
}
else
!buf[0] || buf[BUFSIZ - 1])
{
- vty_out (vty, "!Error: Can't convert rd%s", VTY_NEWLINE);
+ vty_outln (vty, "!Error: Can't convert rd");
}
else
{
- vty_out (vty, " rd %s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, " rd %s", buf);
}
}
}
{
char *b = ecommunity_ecom2str (rfg->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt both %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt both %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
else
{
char *b = ecommunity_ecom2str (rfg->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt import %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt import %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
if (rfg->rt_export_list)
{
char *b = ecommunity_ecom2str (rfg->rt_export_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt export %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt export %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
}
if (rfg->plist_export_bgp_name[afi])
{
- vty_out (vty, " export bgp %s prefix-list %s%s",
- afistr, rfg->plist_export_bgp_name[afi],
- VTY_NEWLINE);
+ vty_outln (vty, " export bgp %s prefix-list %s",
+ afistr,rfg->plist_export_bgp_name[afi]);
}
if (rfg->plist_export_zebra_name[afi])
{
- vty_out (vty, " export zebra %s prefix-list %s%s",
- afistr, rfg->plist_export_zebra_name[afi],
- VTY_NEWLINE);
+ vty_outln (vty, " export zebra %s prefix-list %s",
+ afistr,rfg->plist_export_zebra_name[afi]);
}
/*
* currently we only support redist plists for bgp-direct.
*/
if (rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi])
{
- vty_out (vty, " redistribute bgp-direct %s prefix-list %s%s",
+ vty_outln (vty, " redistribute bgp-direct %s prefix-list %s",
afistr,
- rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi],
- VTY_NEWLINE);
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
}
if (rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT][afi])
{
- vty_out (vty,
- " redistribute bgp-direct-to-nve-groups %s prefix-list %s%s",
+ vty_outln (vty,
+ " redistribute bgp-direct-to-nve-groups %s prefix-list %s",
afistr,
- rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT]
- [afi], VTY_NEWLINE);
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT][afi]);
}
}
if (rfg->routemap_export_bgp_name)
{
- vty_out (vty, " export bgp route-map %s%s",
- rfg->routemap_export_bgp_name, VTY_NEWLINE);
+ vty_outln (vty, " export bgp route-map %s",
+ rfg->routemap_export_bgp_name);
}
if (rfg->routemap_export_zebra_name)
{
- vty_out (vty, " export zebra route-map %s%s",
- rfg->routemap_export_zebra_name, VTY_NEWLINE);
+ vty_outln (vty, " export zebra route-map %s",
+ rfg->routemap_export_zebra_name);
}
if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT])
{
- vty_out (vty, " redistribute bgp-direct route-map %s%s",
- rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT],
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute bgp-direct route-map %s",
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
}
if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT])
{
- vty_out (vty,
- " redistribute bgp-direct-to-nve-groups route-map %s%s",
- rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT],
- VTY_NEWLINE);
+ vty_outln (vty,
+ " redistribute bgp-direct-to-nve-groups route-map %s",
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT]);
}
- vty_out (vty, " exit-vrf-policy%s", VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, " exit-vrf-policy");
+ vty_outln (vty, "!");
}
if (hc->flags & BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP)
{
- vty_out (vty, " vnc advertise-un-method encap-safi%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc advertise-un-method encap-safi");
write++;
}
write += (bgp->rfapi->rfp_methods.cfg_cb) (vty, bgp->rfapi->rfp);
if (write)
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
if (hc->l2_groups)
{
struct listnode *lnode;
void *data;
++write;
- vty_out (vty, " vnc l2-group %s%s", rfg->name, VTY_NEWLINE);
+ vty_outln (vty, " vnc l2-group %s", rfg->name);
if (rfg->logical_net_id != 0)
- vty_out (vty, " logical-network-id %u%s", rfg->logical_net_id,
- VTY_NEWLINE);
+ vty_outln (vty, " logical-network-id %u",
+ rfg->logical_net_id);
if (rfg->labels != NULL && listhead (rfg->labels) != NULL)
{
vty_out (vty, " labels ");
{
vty_out (vty, "%hu ", (uint16_t) ((uintptr_t) data));
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (rfg->rt_import_list && rfg->rt_export_list &&
{
char *b = ecommunity_ecom2str (rfg->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt both %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt both %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
else
{
char *b = ecommunity_ecom2str (rfg->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt import %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt import %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
if (rfg->rt_export_list)
{
char *b = ecommunity_ecom2str (rfg->rt_export_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt export %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt export %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
}
RFAPI_RFP_CFG_GROUP_L2,
rfg->name,
rfg->rfp_cfg);
- vty_out (vty, " exit-vnc%s", VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, " exit-vnc");
+ vty_outln (vty, "!");
}
}
++write;
- vty_out (vty, " vnc defaults%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc defaults");
if (hc->default_rd.prefixlen)
{
value = ((hc->default_rd.val[6] << 8) & 0x0ff00) |
(hc->default_rd.val[7] & 0x0ff);
- vty_out (vty, " rd auto:vn:%d%s", value, VTY_NEWLINE);
+ vty_outln (vty, " rd auto:vn:%d", value);
}
else
!buf[0] || buf[BUFSIZ - 1])
{
- vty_out (vty, "!Error: Can't convert rd%s", VTY_NEWLINE);
+ vty_outln (vty, "!Error: Can't convert rd");
}
else
{
- vty_out (vty, " rd %s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, " rd %s", buf);
}
}
}
vty_out (vty, "%d", hc->default_response_lifetime);
else
vty_out (vty, "infinite");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (hc->default_rt_import_list && hc->default_rt_export_list &&
ecommunity_cmp (hc->default_rt_import_list,
{
char *b = ecommunity_ecom2str (hc->default_rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt both %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt both %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
else
{
char *b = ecommunity_ecom2str (hc->default_rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt import %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt import %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
if (hc->default_rt_export_list)
{
char *b = ecommunity_ecom2str (hc->default_rt_export_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt export %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt export %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
}
RFAPI_RFP_CFG_GROUP_DEFAULT,
NULL,
bgp->rfapi_cfg->default_rfp_cfg);
- vty_out (vty, " exit-vnc%s", VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, " exit-vnc");
+ vty_outln (vty, "!");
}
for (ALL_LIST_ELEMENTS (hc->nve_groups_sequential, node, nnode, rfg))
if (rfg->type == RFAPI_GROUP_CFG_NVE)
{
++write;
- vty_out (vty, " vnc nve-group %s%s", rfg->name, VTY_NEWLINE);
+ vty_outln (vty, " vnc nve-group %s", rfg->name);
if (rfg->vn_prefix.family && rfg->vn_node)
{
prefix2str (&rfg->vn_prefix, buf, BUFSIZ);
if (!buf[0] || buf[BUFSIZ - 1])
{
- vty_out (vty, "!Error: Can't convert prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "!Error: Can't convert prefix");
}
else
{
- vty_out (vty, " prefix %s %s%s", "vn", buf, VTY_NEWLINE);
+ vty_outln (vty, " prefix %s %s", "vn", buf);
}
}
prefix2str (&rfg->un_prefix, buf, BUFSIZ);
if (!buf[0] || buf[BUFSIZ - 1])
{
- vty_out (vty, "!Error: Can't convert prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "!Error: Can't convert prefix");
}
else
{
- vty_out (vty, " prefix %s %s%s", "un", buf, VTY_NEWLINE);
+ vty_outln (vty, " prefix %s %s", "un", buf);
}
}
value = ((rfg->rd.val[6] << 8) & 0x0ff00) |
(rfg->rd.val[7] & 0x0ff);
- vty_out (vty, " rd auto:vn:%d%s", value, VTY_NEWLINE);
+ vty_outln (vty, " rd auto:vn:%d", value);
}
else
!buf[0] || buf[BUFSIZ - 1])
{
- vty_out (vty, "!Error: Can't convert rd%s", VTY_NEWLINE);
+ vty_outln (vty, "!Error: Can't convert rd");
}
else
{
- vty_out (vty, " rd %s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, " rd %s", buf);
}
}
}
vty_out (vty, "%d", rfg->response_lifetime);
else
vty_out (vty, "infinite");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (rfg->rt_import_list && rfg->rt_export_list &&
char *b = ecommunity_ecom2str (rfg->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP,
ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt both %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt both %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
else
char *b = ecommunity_ecom2str (rfg->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP,
ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt import %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt import %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
if (rfg->rt_export_list)
{
char *b = ecommunity_ecom2str (rfg->rt_export_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, ECOMMUNITY_ROUTE_TARGET);
- vty_out (vty, " rt export %s%s", b, VTY_NEWLINE);
+ vty_outln (vty, " rt export %s", b);
XFREE (MTYPE_ECOMMUNITY_STR, b);
}
}
if (rfg->plist_export_bgp_name[afi])
{
- vty_out (vty, " export bgp %s prefix-list %s%s",
- afistr, rfg->plist_export_bgp_name[afi],
- VTY_NEWLINE);
+ vty_outln (vty, " export bgp %s prefix-list %s",
+ afistr,rfg->plist_export_bgp_name[afi]);
}
if (rfg->plist_export_zebra_name[afi])
{
- vty_out (vty, " export zebra %s prefix-list %s%s",
- afistr, rfg->plist_export_zebra_name[afi],
- VTY_NEWLINE);
+ vty_outln (vty, " export zebra %s prefix-list %s",
+ afistr,rfg->plist_export_zebra_name[afi]);
}
/*
* currently we only support redist plists for bgp-direct.
*/
if (rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi])
{
- vty_out (vty, " redistribute bgp-direct %s prefix-list %s%s",
+ vty_outln (vty, " redistribute bgp-direct %s prefix-list %s",
afistr,
- rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi],
- VTY_NEWLINE);
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
}
if (rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT][afi])
{
- vty_out (vty,
- " redistribute bgp-direct-to-nve-groups %s prefix-list %s%s",
+ vty_outln (vty,
+ " redistribute bgp-direct-to-nve-groups %s prefix-list %s",
afistr,
- rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT]
- [afi], VTY_NEWLINE);
+ rfg->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT][afi]);
}
}
if (rfg->routemap_export_bgp_name)
{
- vty_out (vty, " export bgp route-map %s%s",
- rfg->routemap_export_bgp_name, VTY_NEWLINE);
+ vty_outln (vty, " export bgp route-map %s",
+ rfg->routemap_export_bgp_name);
}
if (rfg->routemap_export_zebra_name)
{
- vty_out (vty, " export zebra route-map %s%s",
- rfg->routemap_export_zebra_name, VTY_NEWLINE);
+ vty_outln (vty, " export zebra route-map %s",
+ rfg->routemap_export_zebra_name);
}
if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT])
{
- vty_out (vty, " redistribute bgp-direct route-map %s%s",
- rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT],
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute bgp-direct route-map %s",
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
}
if (rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT])
{
- vty_out (vty,
- " redistribute bgp-direct-to-nve-groups route-map %s%s",
- rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT],
- VTY_NEWLINE);
+ vty_outln (vty,
+ " redistribute bgp-direct-to-nve-groups route-map %s",
+ rfg->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT_EXT]);
}
if (bgp->rfapi->rfp_methods.cfg_group_cb)
write +=
bgp->rfapi->rfp,
RFAPI_RFP_CFG_GROUP_NVE,
rfg->name, rfg->rfp_cfg);
- vty_out (vty, " exit-vnc%s", VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, " exit-vnc");
+ vty_outln (vty, "!");
}
} /* have listen ports */
*/
if (VNC_EXPORT_BGP_GRP_ENABLED (hc))
{
- vty_out (vty, " vnc export bgp mode group-nve%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc export bgp mode group-nve");
}
else if (VNC_EXPORT_BGP_RH_ENABLED (hc))
{
- vty_out (vty, " vnc export bgp mode registering-nve%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc export bgp mode registering-nve");
}
else if (VNC_EXPORT_BGP_CE_ENABLED (hc))
{
- vty_out (vty, " vnc export bgp mode ce%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc export bgp mode ce");
}
if (VNC_EXPORT_ZEBRA_GRP_ENABLED (hc))
{
- vty_out (vty, " vnc export zebra mode group-nve%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc export zebra mode group-nve");
}
else if (VNC_EXPORT_ZEBRA_RH_ENABLED (hc))
{
- vty_out (vty, " vnc export zebra mode registering-nve%s", VTY_NEWLINE);
+ vty_outln (vty, " vnc export zebra mode registering-nve");
}
if (hc->rfg_export_direct_bgp_l)
for (ALL_LIST_ELEMENTS (hc->rfg_export_direct_bgp_l, node, nnode, rfgn))
{
- vty_out (vty, " vnc export bgp group-nve group %s%s",
- rfgn->name, VTY_NEWLINE);
+ vty_outln (vty, " vnc export bgp group-nve group %s",
+ rfgn->name);
}
}
for (ALL_LIST_ELEMENTS (hc->rfg_export_zebra_l, node, nnode, rfgn))
{
- vty_out (vty, " vnc export zebra group-nve group %s%s",
- rfgn->name, VTY_NEWLINE);
+ vty_outln (vty, " vnc export zebra group-nve group %s",
+ rfgn->name);
}
}
if (hc->rfg_redist_name)
{
- vty_out (vty, " vnc redistribute nve-group %s%s",
- hc->rfg_redist_name, VTY_NEWLINE);
+ vty_outln (vty, " vnc redistribute nve-group %s",
+ hc->rfg_redist_name);
}
if (hc->redist_lifetime)
{
- vty_out (vty, " vnc redistribute lifetime %d%s",
- hc->redist_lifetime, VTY_NEWLINE);
+ vty_outln (vty, " vnc redistribute lifetime %d",
+ hc->redist_lifetime);
}
if (hc->resolve_nve_roo_local_admin !=
BGP_VNC_CONFIG_RESOLVE_NVE_ROO_LOCAL_ADMIN_DEFAULT)
{
- vty_out (vty, " vnc redistribute resolve-nve roo-ec-local-admin %d%s",
- hc->resolve_nve_roo_local_admin, VTY_NEWLINE);
+ vty_outln (vty, " vnc redistribute resolve-nve roo-ec-local-admin %d",
+ hc->resolve_nve_roo_local_admin);
}
if (hc->redist_mode) /* ! default */
}
if (s)
{
- vty_out (vty, " vnc redistribute mode %s%s", s, VTY_NEWLINE);
+ vty_outln (vty, " vnc redistribute mode %s", s);
}
}
if (hc->plist_export_bgp_name[afi])
{
- vty_out (vty, " vnc export bgp %s prefix-list %s%s",
- afistr, hc->plist_export_bgp_name[afi], VTY_NEWLINE);
+ vty_outln (vty, " vnc export bgp %s prefix-list %s",
+ afistr, hc->plist_export_bgp_name[afi]);
}
if (hc->plist_export_zebra_name[afi])
{
- vty_out (vty, " vnc export zebra %s prefix-list %s%s",
- afistr, hc->plist_export_zebra_name[afi], VTY_NEWLINE);
+ vty_outln (vty, " vnc export zebra %s prefix-list %s",
+ afistr, hc->plist_export_zebra_name[afi]);
}
if (hc->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi])
{
- vty_out (vty, " vnc redistribute bgp-direct %s prefix-list %s%s",
- afistr, hc->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi],
- VTY_NEWLINE);
+ vty_outln (vty, " vnc redistribute bgp-direct %s prefix-list %s",
+ afistr,hc->plist_redist_name[ZEBRA_ROUTE_BGP_DIRECT][afi]);
}
}
if (hc->routemap_export_bgp_name)
{
- vty_out (vty, " vnc export bgp route-map %s%s",
- hc->routemap_export_bgp_name, VTY_NEWLINE);
+ vty_outln (vty, " vnc export bgp route-map %s",
+ hc->routemap_export_bgp_name);
}
if (hc->routemap_export_zebra_name)
{
- vty_out (vty, " vnc export zebra route-map %s%s",
- hc->routemap_export_zebra_name, VTY_NEWLINE);
+ vty_outln (vty, " vnc export zebra route-map %s",
+ hc->routemap_export_zebra_name);
}
if (hc->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT])
{
- vty_out (vty, " vnc redistribute bgp-direct route-map %s%s",
- hc->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT], VTY_NEWLINE);
+ vty_outln (vty, " vnc redistribute bgp-direct route-map %s",
+ hc->routemap_redist_name[ZEBRA_ROUTE_BGP_DIRECT]);
}
for (afi = AFI_IP; afi < AFI_MAX; ++afi)
if (type == ZEBRA_ROUTE_BGP_DIRECT_EXT &&
hc->redist_bgp_exterior_view_name)
{
- vty_out (vty, " vnc redistribute %s %s view %s%s",
+ vty_outln (vty, " vnc redistribute %s %s view %s",
((afi == AFI_IP) ? "ipv4" : "ipv6"),
zebra_route_string (type),
- hc->redist_bgp_exterior_view_name, VTY_NEWLINE);
+ hc->redist_bgp_exterior_view_name);
}
else
{
- vty_out (vty, " vnc redistribute %s %s%s",
+ vty_outln (vty, " vnc redistribute %s %s",
((afi == AFI_IP) ? "ipv4" : "ipv6"),
- zebra_route_string (type), VTY_NEWLINE);
+ zebra_route_string(type));
}
}
}
if (hc == NULL)
return;
- vty_out (vty, "%-39s %-19s %s%s", "VNC Advertise method:",
+ vty_outln (vty, "%-39s %-19s %s", "VNC Advertise method:",
(hc->flags & BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP
? "Encapsulation SAFI" : "Tunnel Encap attribute"),
- ((hc->flags & BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP) ==
- (BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP &
- BGP_VNC_CONFIG_FLAGS_DEFAULT) ? "(default)" : ""), VTY_NEWLINE);
+ ((hc->flags & BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP) == (BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP & BGP_VNC_CONFIG_FLAGS_DEFAULT) ? "(default)" : ""));
/* export */
vty_out (vty, "%-39s ", "Export from VNC:");
/*
vty_out (vty, "%sToZebra {Registering NVE}", (redist == 1 ? "" : " "));
/* note filters, route-maps not shown */
}
- vty_out (vty, "%-19s %s%s", (redist ? "" : "Off"),
- (redist ? "" : "(default)"), VTY_NEWLINE);
+ vty_outln (vty, "%-19s %s", (redist ? "" : "Off"),
+ (redist ? "" : "(default)"));
/* Redistribution */
redist = 0;
}
}
}
- vty_out (vty, "%-19s %s%s", (redist ? "" : "Off"),
- (redist ? "" : "(default)"), VTY_NEWLINE);
+ vty_outln (vty, "%-19s %s", (redist ? "" : "Off"),
+ (redist ? "" : "(default)"));
- vty_out (vty, "%-39s %3u%-16s %s%s", "RFP Registration Hold-Down Factor:",
+ vty_outln (vty, "%-39s %3u%-16s %s", "RFP Registration Hold-Down Factor:",
hc->rfp_cfg.holddown_factor, "%",
- (hc->rfp_cfg.holddown_factor ==
- RFAPI_RFP_CFG_DEFAULT_HOLDDOWN_FACTOR ? "(default)" : ""),
- VTY_NEWLINE);
- vty_out (vty, "%-39s %-19s %s%s", "RFP Updated responses:",
+ (hc->rfp_cfg.holddown_factor == RFAPI_RFP_CFG_DEFAULT_HOLDDOWN_FACTOR ? "(default)" : ""));
+ vty_outln (vty, "%-39s %-19s %s", "RFP Updated responses:",
(hc->rfp_cfg.use_updated_response == 0 ? "Off" : "On"),
- (hc->rfp_cfg.use_updated_response == 0 ? "(default)" : ""),
- VTY_NEWLINE);
- vty_out (vty, "%-39s %-19s %s%s", "RFP Removal responses:",
+ (hc->rfp_cfg.use_updated_response == 0 ? "(default)" : ""));
+ vty_outln (vty, "%-39s %-19s %s", "RFP Removal responses:",
(hc->rfp_cfg.use_removes == 0 ? "Off" : "On"),
- (hc->rfp_cfg.use_removes == 0 ? "(default)" : ""), VTY_NEWLINE);
- vty_out (vty, "%-39s %-19s %s%s", "RFP Full table download:",
+ (hc->rfp_cfg.use_removes == 0 ? "(default)" : ""));
+ vty_outln (vty, "%-39s %-19s %s", "RFP Full table download:",
(hc->rfp_cfg.download_type ==
RFAPI_RFP_DOWNLOAD_FULL ? "On" : "Off"),
- (hc->rfp_cfg.download_type ==
- RFAPI_RFP_DOWNLOAD_PARTIAL ? "(default)" : ""), VTY_NEWLINE);
+ (hc->rfp_cfg.download_type == RFAPI_RFP_DOWNLOAD_PARTIAL ? "(default)" : ""));
sprintf (tmp, "%u seconds", hc->rfp_cfg.ftd_advertisement_interval);
- vty_out (vty, "%-39s %-19s %s%s", " Advertisement Interval:", tmp,
- (hc->rfp_cfg.ftd_advertisement_interval ==
- RFAPI_RFP_CFG_DEFAULT_FTD_ADVERTISEMENT_INTERVAL
- ? "(default)" : ""), VTY_NEWLINE);
- vty_out (vty, "%-39s %d seconds%s", "Default RFP response lifetime:",
- hc->default_response_lifetime, VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "%-39s %-19s %s", " Advertisement Interval:", tmp,
+ (hc->rfp_cfg.ftd_advertisement_interval == RFAPI_RFP_CFG_DEFAULT_FTD_ADVERTISEMENT_INTERVAL ? "(default)" : ""));
+ vty_outln (vty, "%-39s %d seconds", "Default RFP response lifetime:",
+ hc->default_response_lifetime);
+ vty_out (vty, VTYNL);
return;
}
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;
}
fp (out, "Nexthops Callback, Target=(");
//rfapiPrintRfapiIpAddr(stream, target);
- fp (out, ")%s", VTY_NEWLINE);
+ fp (out, ")%s", VTYNL);
rfapiPrintNhl (stream, next_hops);
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;
}
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;
}
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;
}
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;
}
*/
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;
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;
}
*/
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;
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;
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;
}
*/
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 (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;
}
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
{
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;
}
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 */
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
{
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;
}
*/
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;
}
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;
}
{
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);
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);
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;
}
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);
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;
}
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)
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:",
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))
}
fp (out, "%-8s %-8u ", "Active:", nves_with_nonempty_ribs);
fp (out, "%-8s %-8u", "Total:", nves);
- fp (out, "%s", VTY_NEWLINE);
+ fp (out, "%s", VTYNL);
}
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;
++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",
#else
"Remaining",
#endif
- VTY_NEWLINE);
+ VTYNL);
}
if (!printednve)
{
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,
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);
}
}
/* Fake out for debug logging */
static struct vty vty_dummy_zlog;
static struct vty vty_dummy_stdio;
-#define HVTY_NEWLINE ((vty == &vty_dummy_zlog)? "": VTY_NEWLINE)
+#define HVTYNL ((vty == &vty_dummy_zlog)? "": VTYNL)
static const char *
str_vty_newline (struct vty *vty)
{
if (vty == &vty_dummy_zlog)
return "";
- return VTY_NEWLINE;
+ return VTYNL;
}
int
if (!stream)
{
- vty_dummy_zlog.type = VTY_SHELL; /* for VTY_NEWLINE */
+ vty_dummy_zlog.type = VTY_SHELL; /* for VTYNL */
*vty = &vty_dummy_zlog;
*fp = (int (*)(void *, const char *,...)) rfapiDebugPrintf;
*outstream = NULL;
((uintptr_t) stream == (uintptr_t) 2))
{
- vty_dummy_stdio.type = VTY_SHELL; /* for VTY_NEWLINE */
+ vty_dummy_stdio.type = VTY_SHELL; /* for VTYNL */
*vty = &vty_dummy_stdio;
*fp = (int (*)(void *, const char *,...)) rfapiStdioPrintf;
*outstream = stream;
if (stream)
{
- *vty = stream; /* VTY_NEWLINE requires vty to be legit */
+ *vty = stream; /* VTYNL requires vty to be legit */
*fp = (int (*)(void *, const char *,...)) vty_out;
*outstream = stream;
*vty_newline = str_vty_newline (*vty);
vty_out (vty, " type=%s, subtype=%d",
zebra_route_string (bi->type), bi->sub_type);
- vty_out (vty, "%s", HVTY_NEWLINE);
+ vty_out (vty, "%s", HVTYNL);
}
void
if (rfapiStream2Vty (stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- fp (out, "Attr[%p]:%s", attr, HVTY_NEWLINE);
+ fp (out, "Attr[%p]:%s", attr, HVTYNL);
if (!attr)
return;
/* IPv4 Nexthop */
inet_ntop (AF_INET, &attr->nexthop, buf, BUFSIZ);
- fp (out, " nexthop=%s%s", buf, HVTY_NEWLINE);
+ fp (out, " nexthop=%s%s", buf, HVTYNL);
fp (out, " aspath=%p, refcnt=%d%s", attr->aspath,
- (attr->aspath ? attr->aspath->refcnt : 0), HVTY_NEWLINE);
+ (attr->aspath ? attr->aspath->refcnt : 0), HVTYNL);
fp (out, " community=%p, refcnt=%d%s", attr->community,
- (attr->community ? attr->community->refcnt : 0), HVTY_NEWLINE);
+ (attr->community ? attr->community->refcnt : 0), HVTYNL);
if ((ae = attr->extra))
{
fp (out, " ecommunity=%p, refcnt=%d%s", ae->ecommunity,
- (ae->ecommunity ? ae->ecommunity->refcnt : 0), HVTY_NEWLINE);
+ (ae->ecommunity ? ae->ecommunity->refcnt : 0), HVTYNL);
fp (out, " cluster=%p, refcnt=%d%s", ae->cluster,
- (ae->cluster ? ae->cluster->refcnt : 0), HVTY_NEWLINE);
+ (ae->cluster ? ae->cluster->refcnt : 0), HVTYNL);
fp (out, " transit=%p, refcnt=%d%s", ae->transit,
- (ae->transit ? ae->transit->refcnt : 0), HVTY_NEWLINE);
+ (ae->transit ? ae->transit->refcnt : 0), HVTYNL);
}
}
snprintf (p, REMAIN, " %c:%u", zebra_route_char (bi->type), bi->sub_type);
INCP;
- fp (out, "%s%s", line, HVTY_NEWLINE);
+ fp (out, "%s%s", line, HVTYNL);
if (has_macaddr)
{
macaddr.octet[0],
macaddr.octet[1],
macaddr.octet[2],
- macaddr.octet[3], macaddr.octet[4], macaddr.octet[5], HVTY_NEWLINE);
+ macaddr.octet[3], macaddr.octet[4], macaddr.octet[5], HVTYNL);
}
if (!rfapiGetL2o (bi->attr, &l2o_buf))
l2o_buf.macaddr.octet[0], l2o_buf.macaddr.octet[1],
l2o_buf.macaddr.octet[2], l2o_buf.macaddr.octet[3],
l2o_buf.macaddr.octet[4], l2o_buf.macaddr.octet[5], l2o_buf.label,
- l2o_buf.logical_net_id, l2o_buf.local_nve_id, HVTY_NEWLINE);
+ l2o_buf.logical_net_id, l2o_buf.local_nve_id, HVTYNL);
}
if (bi->extra && bi->extra->vnc.import.aux_prefix.family)
{
buf[BUFSIZ - 1] = 0;
if (sp)
{
- fp (out, " IP: %s%s", sp, HVTY_NEWLINE);
+ fp (out, " IP: %s%s", sp, HVTYNL);
}
}
{
return;
rfapiMonitorVpn2Str (m, buf, BUFSIZ);
- fp (out, " Mon %s%s", buf, HVTY_NEWLINE);
+ fp (out, " Mon %s%s", buf, HVTYNL);
}
static void
return;
fp (out, " Mon m=%p, next=%p, node=%p, bi=%p%s",
- m, m->next, m->node, m->bi, HVTY_NEWLINE);
+ m, m->next, m->node, m->bi, HVTYNL);
}
void
fp (out, "%s/%d @%p #%d%s",
rfapi_ntop (rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
- rn->p.prefixlen, rn, rn->lock, HVTY_NEWLINE);
+ rn->p.prefixlen, rn, rn->lock, HVTYNL);
for (bi = rn->info; bi; bi = bi->next)
{
if (rfapiStream2Vty (stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- fp (out, "Import Table [%s]%s", label, HVTY_NEWLINE);
+ fp (out, "Import Table [%s]%s", label, HVTYNL);
for (rn = route_top (rt); rn; rn = route_next (rn))
{
}
fp (out, "%s/%d @%p #%d%s", buf, rn->p.prefixlen, rn, rn->lock - 1, /* account for loop iterator locking */
- HVTY_NEWLINE);
+ HVTYNL);
for (bi = rn->info; bi; bi = bi->next)
{
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;
}
if (!printedheader)
{
++printedheader;
- fp (out, "%s", VTY_NEWLINE);
+ fp (out, "%s", VTYNL);
fp (out, "%-15s %-15s %-15s %-10s%s",
"VN Address", "UN Address",
- "Target", "Remaining", VTY_NEWLINE);
+ "Target", "Remaining", VTYNL);
}
if (!printedquerier)
}
fp (out, " %-15s %-10s%s",
inet_ntop (m->p.family, &m->p.u.prefix, buf_pfx, BUFSIZ),
- buf_remain, VTY_NEWLINE);
+ buf_remain, VTYNL);
}
}
if (!printedheader)
{
++printedheader;
- fp (out, "%s", VTY_NEWLINE);
+ fp (out, "%s", VTYNL);
fp (out, "%-15s %-15s %-17s %10s %-10s%s",
"VN Address", "UN Address",
- "Target", "LNI", "Remaining", VTY_NEWLINE);
+ "Target", "LNI", "Remaining", VTYNL);
}
if (!printedquerier)
fp (out, " %-17s %10d %-10s%s",
rfapi_ntop (pfx_mac.family, &pfx_mac.u.prefix, buf_pfx,
BUFSIZ), mon_eth->logical_net_id, buf_remain,
- VTY_NEWLINE);
+ VTYNL);
}
}
}
if (queries_total)
{
- fp (out, "%s", VTY_NEWLINE);
+ fp (out, "%s", VTYNL);
fp (out, "Displayed %d out of %d total queries%s",
- queries_displayed, queries_total, VTY_NEWLINE);
+ queries_displayed, queries_total, VTYNL);
}
return CMD_SUCCESS;
}
}
fp (out, "%-10s ", buf_age);
}
- fp (out, "%s", HVTY_NEWLINE);
+ fp (out, "%s", HVTYNL);
if (rn->p.family == AF_ETHERNET)
{
}
}
if (nlines > 1)
- fp (out, "%s", HVTY_NEWLINE);
+ fp (out, "%s", HVTYNL);
return 1;
}
if (pLni)
{
fp (out, "%s[%s] L2VPN Network 0x%x (%u) RT={%s}",
- HVTY_NEWLINE, type, *pLni, (*pLni & 0xfff), s);
+ HVTYNL, type, *pLni, (*pLni & 0xfff), s);
}
else
{
fp (out, "%s[%s] Prefix RT={%s}",
- HVTY_NEWLINE, type, s);
+ HVTYNL, type, s);
}
XFREE (MTYPE_ECOMMUNITY_STR, s);
"VRF" : "NVE group"),
it->rfg->name);
}
- fp (out, "%s", HVTY_NEWLINE);
+ fp (out, "%s", HVTYNL);
if (show_expiring)
{
#if RFAPI_REGISTRATIONS_REPORT_AGE
fp (out, "%-20s %-15s %-15s %4s %-10s %-10s%s",
(pLni ? "L2 Address/IP" : "Prefix"),
"VN Address", "UN Address", "Cost",
- "Lifetime", agetype, HVTY_NEWLINE);
+ "Lifetime", agetype, HVTYNL);
}
printed += rfapiPrintRemoteRegBi (bgp, stream, rn, bi);
}
}
fp (out, "Displayed %d out of %d %s%s",
- printed, total, type, HVTY_NEWLINE);
+ printed, total, type, HVTYNL);
#if DEBUG_SHOW_EXTRA
- fp(out, "IT table above: it=%p%s", it, HVTY_NEWLINE);
+ fp(out, "IT table above: it=%p%s", it, HVTYNL);
#endif
}
return printed;
}
bn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, prd);
- vty_out (vty, " bn=%p%s", bn, HVTY_NEWLINE);
+ vty_out (vty, " bn=%p%s", bn, HVTYNL);
for (bi = bn->info; bi; bi = bi->next)
{
if (!printed)
{
- vty_out (vty, " --?--%s", HVTY_NEWLINE);
+ vty_out (vty, " --?--%s", HVTYNL);
return;
}
rfapiPrintRd (vty, &rfd->rd);
vty_out (vty, " %d", rfd->response_lifetime);
vty_out (vty, " %s", (rfd->rfg ? rfd->rfg->name : "<orphaned>"));
- vty_out (vty, "%s", HVTY_NEWLINE);
+ vty_out (vty, "%s", HVTYNL);
- vty_out (vty, " Peer %p #%d%s", rfd->peer, rfd->peer->lock, HVTY_NEWLINE);
+ vty_out (vty, " Peer %p #%d%s", rfd->peer, rfd->peer->lock, HVTYNL);
/* export RT list */
if (rfd->rt_export_list)
s =
ecommunity_ecom2str (rfd->rt_export_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out (vty, " Export %s%s", s, HVTY_NEWLINE);
+ vty_out (vty, " Export %s%s", s, HVTYNL);
XFREE (MTYPE_ECOMMUNITY_STR, s);
}
else
{
- vty_out (vty, " Export (nil)%s", HVTY_NEWLINE);
+ vty_out (vty, " Export (nil)%s", HVTYNL);
}
/* import RT list */
{
s = ecommunity_ecom2str (rfd->import_table->rt_import_list,
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out (vty, " Import %s%s", s, HVTY_NEWLINE);
+ vty_out (vty, " Import %s%s", s, HVTYNL);
XFREE (MTYPE_ECOMMUNITY_STR, s);
}
else
{
- vty_out (vty, " Import (nil)%s", HVTY_NEWLINE);
+ vty_out (vty, " Import (nil)%s", HVTYNL);
}
for (afi = AFI_IP; afi < AFI_MAX; ++afi)
prefix2str (&adb->u.s.prefix_ip, buf, BUFSIZ);
buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
- vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE);
+ vty_out (vty, " Adv Pfx: %s%s", buf, HVTYNL);
rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip);
}
}
prefix2str (&adb->u.s.prefix_eth, buf, BUFSIZ);
buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */
- vty_out (vty, " Adv Pfx: %s%s", buf, HVTY_NEWLINE);
+ vty_out (vty, " Adv Pfx: %s%s", buf, HVTYNL);
/* TBD update the following function to print ethernet info */
/* Also need to pass/use rd */
rfapiPrintAdvertisedInfo (vty, rfd, SAFI_MPLS_VPN, &adb->u.s.prefix_ip);
}
- vty_out (vty, "%s", HVTY_NEWLINE);
+ vty_out (vty, "%s", HVTYNL);
}
/*
vty_out (vty,
"%s %s %s %s %s %s %s %s%s",
"descriptor", "un-addr", "vn-addr", "callback", "cookie",
- "RD", "lifetime", "group", HVTY_NEWLINE);
+ "RD", "lifetime", "group", HVTYNL);
}
rfapiPrintDescriptor (vty, rfd);
printed = 1;
{
if (!str2prefix (str, p))
{
- vty_out (vty, "Malformed address \"%s\"%s", str, HVTY_NEWLINE);
+ vty_out (vty, "Malformed address \"%s\"%s", str, HVTYNL);
return CMD_WARNING;
}
switch (p->family)
case AF_INET:
if (p->prefixlen != 32)
{
- vty_out (vty, "Not a host address: \"%s\"%s", str, HVTY_NEWLINE);
+ vty_out (vty, "Not a host address: \"%s\"%s", str, HVTYNL);
return CMD_WARNING;
}
break;
case AF_INET6:
if (p->prefixlen != 128)
{
- vty_out (vty, "Not a host address: \"%s\"%s", str, HVTY_NEWLINE);
+ vty_out (vty, "Not a host address: \"%s\"%s", str, HVTYNL);
return CMD_WARNING;
}
break;
default:
- vty_out (vty, "Invalid address \"%s\"%s", str, HVTY_NEWLINE);
+ vty_out (vty, "Invalid address \"%s\"%s", str, HVTYNL);
return CMD_WARNING;
}
return 0;
truncate:
line[BUFSIZ - 1] = 0;
- fp (out, "%s%s", line, HVTY_NEWLINE);
+ fp (out, "%s%s", line, HVTYNL);
/*
* options
fp (out, "%sL2 %s LBL=0x%06x NETID=0x%06x NVEID=%d%s",
offset, pbuf, (vo->v.l2addr.label & 0x00ffffff),
(vo->v.l2addr.logical_net_id & 0x00ffffff),
- vo->v.l2addr.local_nve_id, HVTY_NEWLINE);
+ vo->v.l2addr.local_nve_id, HVTYNL);
break;
case RFAPI_VN_OPTION_TYPE_LOCAL_NEXTHOP:
prefix2str (&vo->v.local_nexthop.addr, pbuf, sizeof (pbuf));
fp (out, "%sLNH %s cost=%d%s",
- offset, pbuf, vo->v.local_nexthop.cost, HVTY_NEWLINE);
+ offset, pbuf, vo->v.local_nexthop.cost, HVTYNL);
break;
default:
fp (out, "%svn option type %d (unknown)%s",
- offset, vo->type, HVTY_NEWLINE);
+ offset, vo->type, HVTYNL);
break;
}
}
if (!bgp)
{
if (vty)
- vty_out (vty, "BGP not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "BGP not configured");
return CMD_WARNING;
}
if (!h || !rfapi_cfg)
{
if (vty)
- vty_out (vty, "RFAPI not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "RFAPI not configured");
return CMD_WARNING;
}
for (; argc; --argc, ++argv)
{
- if (!strcmp (argv[0]->arg, "local-next-hop"))
+ if (strmatch(argv[0]->text, "local-next-hop"))
{
if (arg_lnh)
{
- vty_out (vty, "local-next-hop specified more than once%s",
- VTY_NEWLINE);
+ vty_outln (vty,"local-next-hop specified more than once");
return CMD_WARNING;
}
if (argc <= 1)
{
- vty_out (vty, "Missing parameter for local-next-hop%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Missing parameter for local-next-hop");
return CMD_WARNING;
}
++argv, --argc;
arg_lnh = argv[0]->arg;
}
- if (!strcmp (argv[0]->arg, "local-cost"))
+ if (strmatch(argv[0]->text, "local-cost"))
{
if (arg_lnh_cost)
{
- vty_out (vty, "local-cost specified more than once%s",
- VTY_NEWLINE);
+ vty_outln (vty,"local-cost specified more than once");
return CMD_WARNING;
}
if (argc <= 1)
{
- vty_out (vty, "Missing parameter for local-cost%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Missing parameter for local-cost");
return CMD_WARNING;
}
++argv, --argc;
arg_prefix = "0::0/128";
break;
default:
- vty_out (vty, "Internal error, unknown VN address family%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Internal error, unknown VN address family");
return CMD_WARNING;
}
if (!str2prefix (arg_prefix, &pfx))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", arg_prefix,
- VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix \"%s\"",arg_prefix);
goto fail;
}
if (pfx.family != AF_INET
&& pfx.family != AF_INET6)
{
- vty_out (vty, "prefix \"%s\" has invalid address family%s",
- arg_prefix, VTY_NEWLINE);
+ vty_outln (vty, "prefix \"%s\" has invalid address family",
+ arg_prefix);
goto fail;
}
cost = strtoul (arg_cost, &endptr, 10);
if (*endptr != '\0' || cost > 255)
{
- vty_out (vty, "%% Invalid %s value%s", "cost", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid %s value", "cost");
goto fail;
}
}
lifetime = strtoul (arg_lifetime, &endptr, 10);
if (*endptr != '\0')
{
- vty_out (vty, "%% Invalid %s value%s", "lifetime",
- VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid %s value","lifetime");
goto fail;
}
}
{
if (!arg_lnh)
{
- vty_out (vty,
- "%% %s may only be specified with local-next-hop%s",
- "local-cost", VTY_NEWLINE);
+ vty_outln (vty,
+ "%% %s may only be specified with local-next-hop",
+ "local-cost");
goto fail;
}
endptr = NULL;
lnh_cost = strtoul (arg_lnh_cost, &endptr, 10);
if (*endptr != '\0' || lnh_cost > 255)
{
- vty_out (vty, "%% Invalid %s value%s", "local-cost",
- VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid %s value","local-cost");
goto fail;
}
}
{
if (!arg_prefix)
{
- vty_out (vty, "%% %s may only be specified with prefix%s",
- "local-next-hop", VTY_NEWLINE);
+ vty_outln (vty, "%% %s may only be specified with prefix",
+ "local-next-hop");
goto fail;
}
if ((rc = rfapiCliGetPrefixAddr (vty, arg_lnh,
if (arg_vni && !arg_macaddr)
{
- vty_out (vty, "%% %s may only be specified with mac address%s",
- "virtual-network-identifier", VTY_NEWLINE);
+ vty_outln (vty, "%% %s may only be specified with mac address",
+ "virtual-network-identifier");
goto fail;
}
{
if (!arg_vni)
{
- vty_out (vty,
- "Missing \"vni\" parameter (mandatory with mac)%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Missing \"vni\" parameter (mandatory with mac)");
return CMD_WARNING;
}
- VTY_GET_INTEGER ("Logical Network ID",
- optary[opt_next].v.l2addr.logical_net_id,
- arg_vni);
+ optary[opt_next].v.l2addr.logical_net_id = strtoul(arg_vni, NULL,
+ 10);
if ((rc = rfapiStr2EthAddr (arg_macaddr,
&optary[opt_next].v.l2addr.macaddr)))
{
- vty_out (vty, "Invalid %s value%s", "mac address",
- VTY_NEWLINE);
+ vty_outln (vty, "Invalid %s value","mac address");
goto fail;
}
/* TBD label, NVE ID */
&rfd);
if (rc)
{
- vty_out (vty, "Can't open session for this NVE: %s%s",
- rfapi_error_str (rc), VTY_NEWLINE);
+ vty_outln (vty, "Can't open session for this NVE: %s",
+ rfapi_error_str(rc));
rc = CMD_WARNING;
goto fail;
}
}
else
{
- vty_out (vty, "Can't find session for this NVE: %s%s",
- rfapi_error_str (rc), VTY_NEWLINE);
+ vty_outln (vty, "Can't find session for this NVE: %s",
+ rfapi_error_str(rc));
goto fail;
}
}
}
vnc_zlog_debug_verbose ("%s: rfapi_register failed", __func__);
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "Registration failed.%s", VTY_NEWLINE);
- vty_out (vty,
- "Confirm that either the VN or UN address matches a configured NVE group.%s",
- VTY_NEWLINE);
+ vty_out (vty, VTYNL);
+ vty_outln (vty, "Registration failed.");
+ vty_outln (vty,
+ "Confirm that either the VN or UN address matches a configured NVE group.");
return CMD_WARNING;
fail:
if (!str2prefix (arg_prefix, &rcdarg->prefix))
{
- vty_out (vty, "Malformed prefix \"%s\"%s", arg_prefix, VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix \"%s\"", arg_prefix);
return rc;
}
}
{
if (!arg_vni)
{
- vty_out (vty, "Missing VNI%s", VTY_NEWLINE);
+ vty_outln (vty, "Missing VNI");
return rc;
}
if (strcmp (arg_l2addr, "*"))
{
if ((rc = rfapiStr2EthAddr (arg_l2addr, &rcdarg->l2o.o.macaddr)))
{
- vty_out (vty, "Malformed L2 Address \"%s\"%s",
- arg_l2addr, VTY_NEWLINE);
+ vty_outln (vty, "Malformed L2 Address \"%s\"",
+ arg_l2addr);
return rc;
}
rcdarg->l2o.flags |= RFAPI_L2O_MACADDR;
}
if (strcmp (arg_vni, "*"))
{
- VTY_GET_INTEGER ("Logical Network ID",
- rcdarg->l2o.o.logical_net_id, arg_vni);
+ rcdarg->l2o.o.logical_net_id = strtoul(arg_vni, NULL, 10);
rcdarg->l2o.flags |= RFAPI_L2O_LNI;
}
}
{
if (!str2prefix_rd (arg_rd, &rcdarg->rd))
{
- vty_out (vty, "Malformed RD \"%s\"%s",
- arg_rd, VTY_NEWLINE);
+ vty_outln (vty, "Malformed RD \"%s\"",
+ arg_rd);
return rc;
}
}
static void
print_cleared_stats (struct rfapi_local_reg_delete_arg *cda)
{
- struct vty *vty = cda->vty; /* for benefit of VTY_NEWLINE */
+ struct vty *vty = cda->vty; /* for benefit of VTYNL */
/* Our special element-deleting function counts nves */
if (cda->nves)
cda->nves = NULL;
}
if (cda->failed_pfx_count)
- vty_out (vty, "Failed to delete %d prefixes%s",
- cda->failed_pfx_count, VTY_NEWLINE);
+ vty_outln (vty, "Failed to delete %d prefixes",
+ cda->failed_pfx_count);
/* left as "prefixes" even in single case for ease of machine parsing */
- vty_out (vty,
- "[Local] Cleared %u registrations, %u prefixes, %u responses from %d NVEs%s",
- cda->reg_count, cda->pfx_count, cda->query_count, cda->nve_count,
- VTY_NEWLINE);
+ vty_outln (vty,
+ "[Local] Cleared %u registrations, %u prefixes, %u responses from %d NVEs",
+ cda->reg_count, cda->pfx_count, cda->query_count,cda->nve_count);
/*
* We don't currently allow deletion of active remote prefixes from
* the command line
*/
- vty_out (vty, "[Holddown] Cleared %u prefixes from %u NVEs%s",
- cda->remote_holddown_pfx_count, cda->remote_holddown_nve_count,
- VTY_NEWLINE);
+ vty_outln (vty, "[Holddown] Cleared %u prefixes from %u NVEs",
+ cda->remote_holddown_pfx_count,cda->remote_holddown_nve_count);
}
/*
if (vty)
{
- vty_out (vty,
- "VNC is not configured. (There are no configured BGP VPN SAFI peers.)%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "VNC is not configured. (There are no configured BGP VPN SAFI peers.)");
}
return 0; /* not running */
}
h->stat.count_registrations_failed);
vty_out (vty, "%-8s %-8u", "Total:",
h->stat.count_registrations);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
vty_out (vty, "%-24s ", "Prefixes registered:");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
rfapiCountAllItRoutes (&active_local_routes,
&active_remote_routes,
{
vty_out (vty, " %-20s ", "Locally:");
vty_out (vty, "%-8s %-8u ", "Active:", active_local_routes);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
vty_out (vty, " %-20s ", "Remotely:");
vty_out (vty, "%-8s %-8u", "Active:", active_remote_routes);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, " %-20s ", "In Holddown:");
vty_out (vty, "%-8s %-8u", "Active:", holddown_remote_routes);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, " %-20s ", "Imported:");
vty_out (vty, "%-8s %-8u", "Active:", imported_remote_routes);
break;
default:
break;
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return 0;
notcfg:
- vty_out (vty, "VNC is not configured.%s", VTY_NEWLINE);
+ vty_outln (vty, "VNC is not configured.");
return CMD_WARNING;
}
if (!printed)
{
/* print out a header */
- vty_out (vty, " "
- "Active Next Hops%s", VTY_NEWLINE);
- vty_out (vty, "%-15s %-15s %-5s %-5s %-6s %-6s %s%s",
+ vty_outln (vty,
+ " " "Active Next Hops");
+ vty_outln (vty, "%-15s %-15s %-5s %-5s %-6s %-6s %s",
"VN Address",
"UN Address",
- "Regis", "Resps", "Reach", "Remove", "Age", VTY_NEWLINE);
+ "Regis", "Resps", "Reach", "Remove", "Age");
}
++printed;
- vty_out (vty, "%-15s %-15s %-5u %-5u %-6u %-6u %s%s",
+ vty_outln (vty, "%-15s %-15s %-5u %-5u %-6u %-6u %s",
vn_addr_buf,
un_addr_buf,
rfapiApCount (rfd),
rfapi_monitor_count (rfd),
rfd->stat_count_nh_reachable,
rfd->stat_count_nh_removal,
- rfapiFormatAge (rfd->open_time, age, 10), VTY_NEWLINE);
+ rfapiFormatAge(rfd->open_time, age, 10));
}
if (printed > 0 || vn_prefix || un_prefix)
- vty_out (vty, "Displayed %d out of %d active NVEs%s",
- printed, total, VTY_NEWLINE);
+ vty_outln (vty, "Displayed %d out of %d active NVEs",
+ printed, total);
return 0;
notcfg:
- vty_out (vty, "VNC is not configured.%s", VTY_NEWLINE);
+ vty_outln (vty, "VNC is not configured.");
return CMD_WARNING;
}
if (!check_and_display_is_vnc_running (vty))
return CMD_SUCCESS;
bgp_rfapi_show_summary (bgp_get_default (), vty);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
rfapi_vty_show_nve_summary (vty, SHOW_NVE_SUMMARY_ACTIVE_NVES);
rfapi_vty_show_nve_summary (vty, SHOW_NVE_SUMMARY_QUERIES);
rfapi_vty_show_nve_summary (vty, SHOW_NVE_SUMMARY_RESPONSES);
if (!str2prefix (argv[4]->arg, &pfx))
{
- vty_out (vty, "Malformed address \"%s\"%s", argv[4]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Malformed address \"%s\"", argv[4]->arg);
return CMD_WARNING;
}
if (pfx.family != AF_INET && pfx.family != AF_INET6)
{
- vty_out (vty, "Invalid address \"%s\"%s", argv[4]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid address \"%s\"", argv[4]->arg);
return CMD_WARNING;
}
}
if (!printed)
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
{
if (!str2prefix (argv[3]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[3]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid prefix: %s", argv[3]->arg);
return CMD_SUCCESS;
}
else
{
if (!str2prefix (argv[4]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[4]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid prefix: %s", argv[4]->arg);
return CMD_SUCCESS;
}
else
{
if (!str2prefix (argv[3]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[3]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid prefix: %s", argv[3]->arg);
return CMD_SUCCESS;
}
else
{
if (!str2prefix (argv[4]->arg, &p))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[4]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid prefix: %s", argv[4]->arg);
return CMD_SUCCESS;
}
else
{
if (!str2prefix (argv[3]->arg, &pfx))
{
- vty_out (vty, "Invalid prefix: %s%s", argv[3]->arg, VTY_NEWLINE);
+ vty_outln (vty, "Invalid prefix: %s", argv[3]->arg);
return CMD_WARNING;
}
p = &pfx;
return CMD_SUCCESS;
notcfg:
- vty_out (vty, "VNC is not configured.%s", VTY_NEWLINE);
+ vty_outln (vty, "VNC is not configured.");
return CMD_WARNING;
}
bgp = bgp_get_default (); /* assume main instance for now */
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 || !bgp->rfapi_cfg)
{
- vty_out (vty, "VRF support not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "VRF support not configured");
return CMD_WARNING;
}
/* arg checks */
if (!rfg)
{
- vty_out (vty, "VRF \"%s\" appears not to be configured.%s",
- arg_vrf, VTY_NEWLINE);
+ vty_outln (vty, "VRF \"%s\" appears not to be configured.",
+ arg_vrf);
return CMD_WARNING;
}
if (!rfg->rt_export_list || !rfg->rfapi_import_table)
{
- vty_out (vty, "VRF \"%s\" is missing RT import/export RT configuration.%s",
- arg_vrf, VTY_NEWLINE);
+ vty_outln (vty, "VRF \"%s\" is missing RT import/export RT configuration.",
+ arg_vrf);
return CMD_WARNING;
}
if (!rfg->rd.family && !arg_rd)
{
- vty_out (vty, "VRF \"%s\" isn't configured with an RD, so RD must be provided.%s",
- arg_vrf, VTY_NEWLINE);
+ vty_outln (vty, "VRF \"%s\" isn't configured with an RD, so RD must be provided.",
+ arg_vrf);
return CMD_WARNING;
}
if (rfg->label > MPLS_LABEL_MAX && !arg_label)
{
- vty_out (vty, "VRF \"%s\" isn't configured with a default labels, so a label must be provided.%s",
- arg_vrf, VTY_NEWLINE);
+ vty_outln (vty, "VRF \"%s\" isn't configured with a default labels, so a label must be provided.",
+ arg_vrf);
return CMD_WARNING;
}
if (!str2prefix (arg_prefix, &pfx))
{
- vty_out (vty, "Malformed prefix \"%s\"%s",
- arg_prefix, VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix \"%s\"",
+ arg_prefix);
return CMD_WARNING;
}
rfapiQprefix2Rprefix (&pfx, &rpfx);
opt->type = RFAPI_VN_OPTION_TYPE_INTERNAL_RD;
if (!str2prefix_rd (arg_rd, &opt->v.internal_rd))
{
- vty_out (vty, "Malformed RD \"%s\"%s",
- arg_rd, VTY_NEWLINE);
+ vty_outln (vty, "Malformed RD \"%s\"",
+ arg_rd);
return CMD_WARNING;
}
}
if (arg_label)
{
int32_t label;
- VTY_GET_INTEGER_RANGE ("Label value", label, arg_label, 0, MPLS_LABEL_MAX);
+ label = strtoul(arg_label, NULL, 10);
l2o->label = label;
}
else
pref = strtoul (arg_pref, &endptr, 10);
if (*endptr != '\0')
{
- vty_out (vty, "%% Invalid local-preference value \"%s\"%s", arg_pref, VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid local-preference value \"%s\"",
+ arg_pref);
return CMD_WARNING;
}
}
}
vnc_zlog_debug_verbose ("%s: rfapi_register failed", __func__);
- vty_out (vty, "Add failed.%s", VTY_NEWLINE);
+ vty_outln (vty, "Add failed.");
return CMD_WARNING;
}
bgp = bgp_get_default (); /* assume main instance for now */
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 || !bgp->rfapi_cfg)
{
- vty_out (vty, "VRF support not configured%s", VTY_NEWLINE);
+ vty_outln (vty, "VRF support not configured");
return CMD_WARNING;
}
rfg = bgp_rfapi_cfg_match_byname (bgp, arg_vrf, RFAPI_GROUP_CFG_VRF);
/* arg checks */
if (!rfg)
{
- vty_out (vty, "VRF \"%s\" appears not to be configured.%s",
- arg_vrf, VTY_NEWLINE);
+ vty_outln (vty, "VRF \"%s\" appears not to be configured.",
+ arg_vrf);
return CMD_WARNING;
}
rc = parse_deleter_args (vty, bgp, arg_prefix, NULL, NULL, NULL, NULL,
start_count = rfapi_cfg_group_it_count(rfg);
clear_vnc_prefix (&cda);
clear_vnc_vrf_closer (rfg);
- vty_out (vty, "Cleared %u out of %d prefixes.%s",
- cda.pfx_count, start_count, VTY_NEWLINE);
+ vty_outln (vty, "Cleared %u out of %d prefixes.",
+ cda.pfx_count, start_count);
return CMD_SUCCESS;
}
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)
{
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;
}
{
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)
{
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;
}
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;
}
{
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;
}
{
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++;
}
}
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;
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++;
}
# 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.
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.
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])
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.
#
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
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)
redhat/Makefile
tools/Makefile
pkgsrc/Makefile
+ python/Makefile
fpm/Makefile
redhat/frr.spec
snapcraft/Makefile
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
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`
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
@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
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
@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},
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;
}
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
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
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)
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));
}
}
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
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);
}
}
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));
+ }
}
{
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++)
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" : "");
}
}
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 */
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
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;
}
}
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;
}
}
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
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;
}
}
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;
}
}
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;
}
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));
}
}
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;
}
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;
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;
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++;
{
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. */
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
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;
}
/* 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;
}
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;
}
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;
}
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;
}
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;
}
/* 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;
}
&& (listcount(eigrp_om->eigrp) == 0))
{
if (zclient)
- zclient_free (zclient);
-
+ {
+ zclient_stop (zclient);
+ zclient_free (zclient);
+ }
exit(0);
}
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
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))
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",
(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;
}
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)
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
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
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;
}
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 */
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
/* 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++;
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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;
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;
}
}
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
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);
{
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));
}
}
}
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));
}
}
}
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 */
{
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;
}
}
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 */
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 */
{
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 */
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 */
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 */
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 */
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;
}
static __attribute__((__noreturn__)) void
terminate (int i)
{
+ isis_zebra_stop ();
exit (i);
}
{
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++;
}
}
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++;
}
}
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)
{
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);
}
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);
}
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));
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);
}
}
continue;
}
- XFREE(MTYPE_ISIS, rn->info);
+ XFREE(MTYPE_ISIS_EXT_INFO, rn->info);
route_unlock_node(rn);
}
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"
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);
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"
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"
{
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;
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);
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++;
}
}
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++;
}
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) {
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 ",
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)",
vty_out (vty, " NULL ");
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
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;
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->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;
{
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);
}
{
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
{
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);
}
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);
}
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);
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);
int i;
if (vty != NULL)
- vty_out (vty, " Unreserved Bandwidth:%s",VTY_NEWLINE);
+ vty_outln (vty, " Unreserved Bandwidth:");
else
zlog_debug (" Unreserved Bandwidth:");
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);
}
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);
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);
}
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);
}
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);
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);
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);
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);
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);
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);
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);
{
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++)
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
{
{
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;
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;
}
"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;
}
"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;
}
{
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;
}
{
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);
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;
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);
}
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;
}
{
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
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);
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
if (! area)
{
- vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
+ vty_outln (vty, "ISIS area is invalid");
return CMD_ERR_AMBIGUOUS;
}
(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;
}
}
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;
}
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;
}
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;
}
}
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);
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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));
ifindex = 0;
api.type = stream_getc(stream);
+ api.instance = stream_getw(stream);
api.flags = stream_getl(stream);
api.message = stream_getc(stream);
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 */
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
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);
}
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
return;
}
+
+void
+isis_zebra_stop (void)
+{
+ zclient_stop (zclient);
+ zclient_free (zclient);
+}
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 */
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;
}
/* 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;
}
#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;
}
*/
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;
}
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;
}
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;
}
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)
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;
}
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);
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))
{
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;
}
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);
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,
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;
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);
{
if (!isis)
{
- vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
+ vty_outln (vty, "ISIS is not running");
return CMD_SUCCESS;
}
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");
}
}
}
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));
}
}
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;
}
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++)
{
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)
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);
}
}
}
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;
}
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;
}
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)
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++;
}
}
* 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);
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
}
{
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++;
}
{
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++;
}
}
{
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++;
}
}
/* 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++;
}
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)
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)
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)
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++;
}
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);
}
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
* 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);
}
tnbr_del(leconf, adj->source.target);
return (0);
}
- adj->source.target->adj = NULL;
}
adj_del(adj, S_HOLDTIME_EXP);
__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))
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:
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);
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);
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);
}
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;
}
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);
}
}
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') {
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' ||
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) {
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' ||
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
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);
}
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
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);
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
}
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);
}
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);
}
}
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 (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);
}
}
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);
}
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);
}
}
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);
}
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);
}
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);
}
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);
}
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;
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;
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
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;
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;
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;
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);
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;
}
}
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;
}
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);
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
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;
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;
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;
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;
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;
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;
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);
}
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, ¶ms));
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,
/* 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,
"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);
}
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, ¶ms));
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);
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);
}
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);
command_parse.h
refix
grammar_sandbox
+clippy
+defun_lex.c
+plist_clippy.c
## 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)/\"
@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
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 \
config_write_agentx (struct vty *vty)
{
if (agentx_enabled)
- vty_out (vty, "agentx%s", VTY_NEWLINE);
+ vty_outln (vty, "agentx");
return 1;
}
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;
}
"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;
}
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;
}
}
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);
}
}
}
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);
}
}
}
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);
if (use_json)
json_object_object_add(json_obj, "peerBfdInfo", json_bfd);
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/*
--- /dev/null
+/*
+ * 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();
+}
--- /dev/null
+/*
+ * 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 */
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))
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)
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)
{
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;
}
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;
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;
}
"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\
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;
}
}
if (gn == start)
vty_out (vty, "...");
- vty_out (vty, VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
else
{
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;
}
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");
}
}
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;
/* 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;
}
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;
}
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)
}
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:
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;
}
cp++;
*cp = '\0';
- vty_out (vty, "%s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, "%s", buf);
}
fclose (confp);
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;
}
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;
}
}
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;
}
{
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;
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)
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)
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) ||
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;
}
"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;
}
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) \
#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 */
* struct parser_ctx is needed for the bison forward decls.
*/
%code requires {
+ #include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
varname_token: '$' WORD
{
- $$ = XSTRDUP (MTYPE_LEX, $2);
+ $$ = $2;
}
| /* empty */
{
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+%{
+/*
+ * 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;
+}
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;
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)
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");
}
}
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)
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;
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++;
}
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++;
}
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
}
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)
{
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;
}
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);
}
}
}
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;
}
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);
}
}
}
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);
}
}
}
p->prefixlen,
filter->exact ? " exact-match" : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
static int
{
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++;
}
{
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++;
}
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);
// 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++)
vector_free (comps);
}
else
- vty_out (vty, "%% No match%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No match");
// free resources
list_delete (completions);
// 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);
}
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;
}
}
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);
{
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;
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;
}
if (stackpos == MAXDEPTH)
{
- vty_out(vty, " -aborting! (depth limit)%s", VTY_NEWLINE);
+ vty_outln (vty, " -aborting! (depth limit)");
return;
}
stack[stackpos++] = start;
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);
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)
}
}
else
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
static void
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");
}
{
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);
/* 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);
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);
}
else
{
- if_update (ifp, name, namelen, vrf_id);
+ if_update_to_new_vrf (ifp, vrf_id);
return ifp;
}
}
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;
}
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);
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;
}
if (p->family == AF_INET)
vty_out (vty, "%s/%d%s", inet_ntoa (p->u.prefix4), p->prefixlen,
- VTY_NEWLINE);
+ VTYNL);
}
}
return CMD_SUCCESS;
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))
{
if (p->family == AF_INET)
vty_out (vty, "%s/%d%s", inet_ntoa (p->u.prefix4), p->prefixlen,
- VTY_NEWLINE);
+ VTYNL);
}
}
}
/* 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);
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;
}
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;
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++;
}
}
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;
}
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));
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);
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;
}
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);
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;
}
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;
}
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;
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;
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)
{
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)
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;
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)
);
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");
}
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");
}
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 */
{
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;
{
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
{
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;
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;
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;
}
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;
}
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;
}
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;
}
static int
vty_invalid_prefix_range (struct vty *vty, const char *prefix)
{
- vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s",
- prefix, VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value",
+ prefix);
return CMD_WARNING;
}
type = PREFIX_DENY;
else
{
- vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE);
+ vty_outln (vty, "%% prefix type must be permit or deny");
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 prefix");
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv6 prefix");
return CMD_WARNING;
}
break;
case AFI_L2VPN:
default:
- vty_out (vty, "%% Unrecognized AFI (%d)%s", afi, VTY_NEWLINE);
+ vty_outln (vty, "%% Unrecognized AFI (%d)", afi);
return CMD_WARNING;
break;
}
plist = prefix_list_lookup (afi, name);
if (! plist)
{
- vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find specified prefix-list");
return CMD_WARNING;
}
/* We must have, at a minimum, both the type and prefix here */
if ((typestr == NULL) || (prefix == NULL))
{
- vty_out (vty, "%% Both prefix and type required%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Both prefix and type required");
return CMD_WARNING;
}
type = PREFIX_DENY;
else
{
- vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE);
+ vty_outln (vty, "%% prefix type must be permit or deny");
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 prefix");
return CMD_WARNING;
}
}
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv6 prefix");
return CMD_WARNING;
}
}
if (pentry == NULL)
{
- vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find specified prefix-list");
return CMD_WARNING;
}
plist = prefix_list_lookup (afi, name);
if (! plist)
{
- vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find specified prefix-list");
return CMD_WARNING;
}
if (dtype == normal_display)
{
- vty_out (vty, "ip%s prefix-list %s: %d entries%s",
+ vty_outln (vty, "ip%s prefix-list %s: %d entries",
afi == AFI_IP ? "" : "v6",
- plist->name, plist->count, VTY_NEWLINE);
+ plist->name, plist->count);
if (plist->desc)
- vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE);
+ vty_outln (vty, " Description: %s", plist->desc);
}
else if (dtype == summary_display || dtype == detail_display)
{
- vty_out (vty, "ip%s prefix-list %s:%s",
- afi == AFI_IP ? "" : "v6", plist->name, VTY_NEWLINE);
+ vty_outln (vty, "ip%s prefix-list %s:",
+ afi == AFI_IP ? "" : "v6", plist->name);
if (plist->desc)
- vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE);
+ vty_outln (vty, " Description: %s", plist->desc);
- vty_out (vty, " count: %d, range entries: %d, sequences: %u - %u%s",
+ vty_outln (vty, " count: %d, range entries: %d, sequences: %u - %u",
plist->count, plist->rangecount,
plist->head ? plist->head->seq : 0,
- plist->tail ? plist->tail->seq : 0,
- VTY_NEWLINE);
+ plist->tail ? plist->tail->seq : 0);
}
if (dtype != summary_display)
vty_out (vty, " (hit count: %ld, refcount: %ld)",
pentry->hitcnt, pentry->refcnt);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
}
plist = prefix_list_lookup (afi, name);
if (! plist)
{
- vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find specified prefix-list");
return CMD_WARNING;
}
vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum);
if (dtype == detail_display || dtype == summary_display)
{
if (master->recent)
- vty_out (vty, "Prefix-list with the last deletion/insertion: %s%s",
- master->recent->name, VTY_NEWLINE);
+ vty_outln (vty, "Prefix-list with the last deletion/insertion: %s",
+ master->recent->name);
}
for (plist = master->num.head; plist; plist = plist->next)
plist = prefix_list_lookup (afi, name);
if (! plist)
{
- vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find specified prefix-list");
return CMD_WARNING;
}
ret = str2prefix (prefix, &p);
if (ret <= 0)
{
- vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% prefix is malformed");
return CMD_WARNING;
}
vty_out (vty, " (hit count: %ld, refcount: %ld)",
pentry->hitcnt, pentry->refcnt);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
if (type == first_match_display)
return CMD_SUCCESS;
plist = prefix_list_lookup (afi, name);
if (! plist)
{
- vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find specified prefix-list");
return CMD_WARNING;
}
ret = str2prefix (prefix, &p);
if (ret <= 0)
{
- vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% prefix is malformed");
return CMD_WARNING;
}
}
return CMD_SUCCESS;
}
-DEFUN (ip_prefix_list,
- ip_prefix_list_cmd,
- "ip prefix-list WORD <deny|permit> <A.B.C.D/M|any>",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv4_any = 4;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL,
- argv[idx_permit_deny]->arg, argv[idx_ipv4_any]->arg, NULL, NULL);
-}
-
-DEFUN (ip_prefix_list_ge,
- ip_prefix_list_ge_cmd,
- "ip prefix-list WORD <deny|permit> A.B.C.D/M ge (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv4_prefixlen = 4;
- int idx_number = 6;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL);
-}
-
-DEFUN (ip_prefix_list_ge_le,
- ip_prefix_list_ge_le_cmd,
- "ip prefix-list WORD <deny|permit> A.B.C.D/M ge (0-32) le (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv4_prefixlen = 4;
- int idx_number = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg);
-}
-
-DEFUN (ip_prefix_list_le,
- ip_prefix_list_le_cmd,
- "ip prefix-list WORD <deny|permit> A.B.C.D/M le (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv4_prefixlen = 4;
- int idx_number = 6;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg);
-}
-
-DEFUN (ip_prefix_list_le_ge,
- ip_prefix_list_le_ge_cmd,
- "ip prefix-list WORD <deny|permit> A.B.C.D/M le (0-32) ge (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv4_prefixlen = 4;
- int idx_number = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg);
-}
-
-DEFUN (ip_prefix_list_seq,
- ip_prefix_list_seq_cmd,
- "ip prefix-list WORD seq (1-4294967295) <deny|permit> <A.B.C.D/M|any>",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv4_any = 6;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_any]->arg, NULL, NULL);
-}
-
-DEFUN (ip_prefix_list_seq_ge,
- ip_prefix_list_seq_ge_cmd,
- "ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M ge (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv4_prefixlen = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL);
-}
-
-DEFUN (ip_prefix_list_seq_ge_le,
- ip_prefix_list_seq_ge_le_cmd,
- "ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M ge (0-32) le (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv4_prefixlen = 6;
- int idx_number_2 = 8;
- int idx_number_3 = 10;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg);
-}
-
-DEFUN (ip_prefix_list_seq_le,
- ip_prefix_list_seq_le_cmd,
- "ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M le (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv4_prefixlen = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg);
-}
-
-DEFUN (ip_prefix_list_seq_le_ge,
- ip_prefix_list_seq_le_ge_cmd,
- "ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M le (0-32) ge (0-32)",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv4_prefixlen = 6;
- int idx_number_2 = 8;
- int idx_number_3 = 10;
- return vty_prefix_list_install (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg);
-}
-
-DEFUN (no_ip_prefix_list,
- no_ip_prefix_list_cmd,
- "no ip prefix-list WORD",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n")
-{
- int idx_word = 3;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, NULL,
- NULL, NULL, NULL);
-}
-
-DEFUN (no_ip_prefix_list_prefix,
- no_ip_prefix_list_prefix_cmd,
- "no ip prefix-list WORD <deny|permit> <A.B.C.D/M|any>",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
-{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv4_any = 5;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_any]->arg, NULL, NULL);
-}
-
-DEFUN (no_ip_prefix_list_ge,
- no_ip_prefix_list_ge_cmd,
- "no ip prefix-list WORD <deny|permit> A.B.C.D/M ge (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv4_prefixlen = 5;
- int idx_number = 7;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, NULL);
-}
-
-DEFUN (no_ip_prefix_list_ge_le,
- no_ip_prefix_list_ge_le_cmd,
- "no ip prefix-list WORD <deny|permit> A.B.C.D/M ge (0-32) le (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv4_prefixlen = 5;
- int idx_number = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg);
-}
-
-DEFUN (no_ip_prefix_list_le,
- no_ip_prefix_list_le_cmd,
- "no ip prefix-list WORD <deny|permit> A.B.C.D/M le (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv4_prefixlen = 5;
- int idx_number = 7;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number]->arg);
-}
-
-DEFUN (no_ip_prefix_list_le_ge,
- no_ip_prefix_list_le_ge_cmd,
- "no ip prefix-list WORD <deny|permit> A.B.C.D/M le (0-32) ge (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv4_prefixlen = 5;
- int idx_number = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg);
-}
-
-DEFUN (no_ip_prefix_list_seq,
- no_ip_prefix_list_seq_cmd,
- "no ip prefix-list WORD seq (1-4294967295) <deny|permit> <A.B.C.D/M|any>",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv4_any = 7;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_any]->arg, NULL, NULL);
-}
-
-DEFUN (no_ip_prefix_list_seq_ge,
- no_ip_prefix_list_seq_ge_cmd,
- "no ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M ge (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv4_prefixlen = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, NULL);
-}
-
-DEFUN (no_ip_prefix_list_seq_ge_le,
- no_ip_prefix_list_seq_ge_le_cmd,
- "no ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M ge (0-32) le (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv4_prefixlen = 7;
- int idx_number_2 = 9;
- int idx_number_3 = 11;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg);
-}
-
-DEFUN (no_ip_prefix_list_seq_le,
- no_ip_prefix_list_seq_le_cmd,
- "no ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M le (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv4_prefixlen = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, NULL, argv[idx_number_2]->arg);
-}
-
-DEFUN (no_ip_prefix_list_seq_le_ge,
- no_ip_prefix_list_seq_le_ge_cmd,
- "no ip prefix-list WORD seq (1-4294967295) <deny|permit> A.B.C.D/M le (0-32) ge (0-32)",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv4_prefixlen = 7;
- int idx_number_2 = 9;
- int idx_number_3 = 11;
- return vty_prefix_list_uninstall (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv4_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg);
-}
-
-DEFUN (ip_prefix_list_sequence_number,
- ip_prefix_list_sequence_number_cmd,
- "ip prefix-list sequence-number",
- IP_STR
- PREFIX_LIST_STR
- "Include/exclude sequence numbers in NVGEN\n")
-{
- prefix_master_ipv4.seqnum = 1;
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_prefix_list_sequence_number,
- no_ip_prefix_list_sequence_number_cmd,
- "no ip prefix-list sequence-number",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Include/exclude sequence numbers in NVGEN\n")
-{
- prefix_master_ipv4.seqnum = 0;
- return CMD_SUCCESS;
-}
-
-DEFUN (ip_prefix_list_description,
- ip_prefix_list_description_cmd,
- "ip prefix-list WORD description LINE...",
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Prefix-list specific description\n"
- "Up to 80 characters describing this prefix-list\n")
-{
- int idx_word = 2;
- int idx_line = 4;
- struct prefix_list *plist;
-
- plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg);
-
- if (plist->desc)
- {
- XFREE (MTYPE_TMP, plist->desc);
- plist->desc = NULL;
- }
- plist->desc = argv_concat(argv, argc, idx_line);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ip_prefix_list_description,
- no_ip_prefix_list_description_cmd,
- "no ip prefix-list WORD description",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Prefix-list specific description\n")
-{
- int idx_word = 3;
- return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg);
-}
-
-/* ALIAS_FIXME */
-DEFUN (no_ip_prefix_list_description_comment,
- no_ip_prefix_list_description_comment_cmd,
- "no ip prefix-list WORD description LINE...",
- NO_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Prefix-list specific description\n"
- "Up to 80 characters describing this prefix-list\n")
-{
- return no_ip_prefix_list_description (self, vty, argc, argv);
-}
-
-DEFUN (show_ip_prefix_list,
- show_ip_prefix_list_cmd,
- "show ip prefix-list",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR)
-{
- return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, normal_display);
-}
-
-DEFUN (show_ip_prefix_list_name,
- show_ip_prefix_list_name_cmd,
- "show ip prefix-list WORD",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n")
-{
- int idx_word = 3;
- return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, normal_display);
-}
-
-DEFUN (show_ip_prefix_list_name_seq,
- show_ip_prefix_list_name_seq_cmd,
- "show ip prefix-list WORD seq (1-4294967295)",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display);
-}
-
-DEFUN (show_ip_prefix_list_prefix,
- show_ip_prefix_list_prefix_cmd,
- "show ip prefix-list WORD A.B.C.D/M",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
-{
- int idx_word = 3;
- int idx_ipv4_prefixlen = 4;
- return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, normal_display);
-}
-
-DEFUN (show_ip_prefix_list_prefix_longer,
- show_ip_prefix_list_prefix_longer_cmd,
- "show ip prefix-list WORD A.B.C.D/M longer",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "Lookup longer prefix\n")
-{
- int idx_word = 3;
- int idx_ipv4_prefixlen = 4;
- return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, longer_display);
-}
-
-DEFUN (show_ip_prefix_list_prefix_first_match,
- show_ip_prefix_list_prefix_first_match_cmd,
- "show ip prefix-list WORD A.B.C.D/M first-match",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "First matched prefix\n")
-{
- int idx_word = 3;
- int idx_ipv4_prefixlen = 4;
- return vty_show_prefix_list_prefix (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg, first_match_display);
-}
-
-DEFUN (show_ip_prefix_list_summary,
- show_ip_prefix_list_summary_cmd,
- "show ip prefix-list summary",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Summary of prefix lists\n")
-{
- return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, summary_display);
-}
-
-DEFUN (show_ip_prefix_list_summary_name,
- show_ip_prefix_list_summary_name_cmd,
- "show ip prefix-list summary WORD",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Summary of prefix lists\n"
- "Name of a prefix list\n")
-{
- int idx_word = 4;
- return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, summary_display);
-}
-
-
-DEFUN (show_ip_prefix_list_detail,
- show_ip_prefix_list_detail_cmd,
- "show ip prefix-list detail",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Detail of prefix lists\n")
-{
- return vty_show_prefix_list (vty, AFI_IP, NULL, NULL, detail_display);
-}
-
-DEFUN (show_ip_prefix_list_detail_name,
- show_ip_prefix_list_detail_name_cmd,
- "show ip prefix-list detail WORD",
- SHOW_STR
- IP_STR
- PREFIX_LIST_STR
- "Detail of prefix lists\n"
- "Name of a prefix list\n")
-{
- int idx_word = 4;
- return vty_show_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL, detail_display);
-}
-
-DEFUN (clear_ip_prefix_list,
- clear_ip_prefix_list_cmd,
- "clear ip prefix-list",
- CLEAR_STR
- IP_STR
- PREFIX_LIST_STR)
-{
- return vty_clear_prefix_list (vty, AFI_IP, NULL, NULL);
-}
-
-DEFUN (clear_ip_prefix_list_name,
- clear_ip_prefix_list_name_cmd,
- "clear ip prefix-list WORD",
- CLEAR_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n")
-{
- int idx_word = 3;
- return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, NULL);
-}
-
-DEFUN (clear_ip_prefix_list_name_prefix,
- clear_ip_prefix_list_name_prefix_cmd,
- "clear ip prefix-list WORD A.B.C.D/M",
- CLEAR_STR
- IP_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
-{
- int idx_word = 3;
- int idx_ipv4_prefixlen = 4;
- return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg);
-}
-
-DEFUN (ipv6_prefix_list,
- ipv6_prefix_list_cmd,
- "ipv6 prefix-list WORD <deny|permit> <X:X::X:X/M|any>",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Any prefix match. Same as \"::0/0 le 128\"\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv6_any = 4;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL,
- argv[idx_permit_deny]->arg, argv[idx_ipv6_any]->arg, NULL, NULL);
-}
-
-DEFUN (ipv6_prefix_list_ge,
- ipv6_prefix_list_ge_cmd,
- "ipv6 prefix-list WORD <deny|permit> X:X::X:X/M ge (0-128)",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv6_prefixlen = 4;
- int idx_number = 6;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL);
-}
-
-DEFUN (ipv6_prefix_list_ge_le,
- ipv6_prefix_list_ge_le_cmd,
- "ipv6 prefix-list WORD <deny|permit> X:X::X:X/M ge (0-128) le (0-128)",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv6_prefixlen = 4;
- int idx_number = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg);
-}
-
-DEFUN (ipv6_prefix_list_le,
- ipv6_prefix_list_le_cmd,
- "ipv6 prefix-list WORD <deny|permit> X:X::X:X/M le (0-128)",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv6_prefixlen = 4;
- int idx_number = 6;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg);
-}
-
-DEFUN (ipv6_prefix_list_le_ge,
- ipv6_prefix_list_le_ge_cmd,
- "ipv6 prefix-list WORD <deny|permit> X:X::X:X/M le (0-128) ge (0-128)",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_permit_deny = 3;
- int idx_ipv6_prefixlen = 4;
- int idx_number = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg);
-}
-
-DEFUN (ipv6_prefix_list_seq,
- ipv6_prefix_list_seq_cmd,
- "ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> <X:X::X:X/M|any>",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Any prefix match. Same as \"::0/0 le 128\"\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv6_any = 6;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_any]->arg, NULL, NULL);
-}
-
-DEFUN (ipv6_prefix_list_seq_ge,
- ipv6_prefix_list_seq_ge_cmd,
- "ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M ge (0-128)",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv6_prefixlen = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL);
-}
-
-DEFUN (ipv6_prefix_list_seq_ge_le,
- ipv6_prefix_list_seq_ge_le_cmd,
- "ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M ge (0-128) le (0-128)",
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
-{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv6_prefixlen = 6;
- int idx_number_2 = 8;
- int idx_number_3 = 10;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg);
-}
-
-DEFUN (ipv6_prefix_list_seq_le,
- ipv6_prefix_list_seq_le_cmd,
- "ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M le (0-128)",
- IPV6_STR
+#ifndef VTYSH_EXTRACT_PL
+#include "plist_clippy.c"
+#endif
+
+DEFPY (ip_prefix_list,
+ ip_prefix_list_cmd,
+ "ip prefix-list WORD [seq (1-4294967295)] <deny|permit>$action <any$dest|A.B.C.D/M$dest [{ge (0-32)|le (0-32)}]>",
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
"sequence number of an entry\n"
"Sequence number\n"
"Specify packets to reject\n"
"Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
+ "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Minimum prefix length to be matched\n"
+ "Minimum prefix length\n"
"Maximum prefix length to be matched\n"
"Maximum prefix length\n")
{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv6_prefixlen = 6;
- int idx_number_2 = 8;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg);
+ return vty_prefix_list_install (vty, AFI_IP, prefix_list, seq_str, action,
+ dest, ge_str, le_str);
}
-DEFUN (ipv6_prefix_list_seq_le_ge,
- ipv6_prefix_list_seq_le_ge_cmd,
- "ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M le (0-128) ge (0-128)",
- IPV6_STR
+DEFPY (no_ip_prefix_list,
+ no_ip_prefix_list_cmd,
+ "no ip prefix-list WORD [seq (1-4294967295)] <deny|permit>$action <any$dest|A.B.C.D/M$dest [{ge (0-32)|le (0-32)}]>",
+ NO_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
"sequence number of an entry\n"
"Sequence number\n"
"Specify packets to reject\n"
"Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
+ "Any prefix match. Same as \"0.0.0.0/0 le 32\"\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
"Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
+ "Minimum prefix length\n"
+ "Maximum prefix length to be matched\n"
+ "Maximum prefix length\n")
{
- int idx_word = 2;
- int idx_number = 4;
- int idx_permit_deny = 5;
- int idx_ipv6_prefixlen = 6;
- int idx_number_2 = 8;
- int idx_number_3 = 10;
- return vty_prefix_list_install (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg);
+ return vty_prefix_list_uninstall (vty, AFI_IP, prefix_list, seq_str, action,
+ dest, ge_str, le_str);
}
-DEFUN (no_ipv6_prefix_list,
- no_ipv6_prefix_list_cmd,
- "no ipv6 prefix-list WORD",
+DEFPY (no_ip_prefix_list_all,
+ no_ip_prefix_list_all_cmd,
+ "no ip prefix-list WORD",
NO_STR
- IPV6_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n")
{
- int idx_word = 3;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, NULL,
+ return vty_prefix_list_uninstall (vty, AFI_IP, prefix_list, NULL, NULL,
NULL, NULL, NULL);
}
-DEFUN (no_ipv6_prefix_list_prefix,
- no_ipv6_prefix_list_prefix_cmd,
- "no ipv6 prefix-list WORD <deny|permit> <X:X::X:X/M|any>",
+DEFPY (ip_prefix_list_sequence_number,
+ ip_prefix_list_sequence_number_cmd,
+ "[no] ip prefix-list sequence-number",
NO_STR
- IPV6_STR
+ IP_STR
PREFIX_LIST_STR
- "Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Any prefix match. Same as \"::0/0 le 128\"\n")
+ "Include/exclude sequence numbers in NVGEN\n")
{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv6_any = 5;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_any]->arg, NULL, NULL);
+ prefix_master_ipv4.seqnum = no ? 0 : 1;
+ return CMD_SUCCESS;
}
-DEFUN (no_ipv6_prefix_list_ge,
- no_ipv6_prefix_list_ge_cmd,
- "no ipv6 prefix-list WORD <deny|permit> X:X::X:X/M ge (0-128)",
- NO_STR
- IPV6_STR
+DEFUN (ip_prefix_list_description,
+ ip_prefix_list_description_cmd,
+ "ip prefix-list WORD description LINE...",
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
+ "Prefix-list specific description\n"
+ "Up to 80 characters describing this prefix-list\n")
{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv6_prefixlen = 5;
- int idx_number = 7;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, NULL);
+ int idx_word = 2;
+ int idx_line = 4;
+ struct prefix_list *plist;
+
+ plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg);
+
+ if (plist->desc)
+ {
+ XFREE (MTYPE_TMP, plist->desc);
+ plist->desc = NULL;
+ }
+ plist->desc = argv_concat(argv, argc, idx_line);
+
+ return CMD_SUCCESS;
}
-DEFUN (no_ipv6_prefix_list_ge_le,
- no_ipv6_prefix_list_ge_le_cmd,
- "no ipv6 prefix-list WORD <deny|permit> X:X::X:X/M ge (0-128) le (0-128)",
+DEFUN (no_ip_prefix_list_description,
+ no_ip_prefix_list_description_cmd,
+ "no ip prefix-list WORD description",
NO_STR
- IPV6_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
+ "Prefix-list specific description\n")
{
int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv6_prefixlen = 5;
- int idx_number = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number]->arg, argv[idx_number_2]->arg);
+ return vty_prefix_list_desc_unset (vty, AFI_IP, argv[idx_word]->arg);
}
-DEFUN (no_ipv6_prefix_list_le,
- no_ipv6_prefix_list_le_cmd,
- "no ipv6 prefix-list WORD <deny|permit> X:X::X:X/M le (0-128)",
+/* ALIAS_FIXME */
+DEFUN (no_ip_prefix_list_description_comment,
+ no_ip_prefix_list_description_comment_cmd,
+ "no ip prefix-list WORD description LINE...",
NO_STR
- IPV6_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
+ "Prefix-list specific description\n"
+ "Up to 80 characters describing this prefix-list\n")
{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv6_prefixlen = 5;
- int idx_number = 7;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number]->arg);
+ return no_ip_prefix_list_description (self, vty, argc, argv);
}
-DEFUN (no_ipv6_prefix_list_le_ge,
- no_ipv6_prefix_list_le_ge_cmd,
- "no ipv6 prefix-list WORD <deny|permit> X:X::X:X/M le (0-128) ge (0-128)",
- NO_STR
- IPV6_STR
+DEFPY (show_ip_prefix_list,
+ show_ip_prefix_list_cmd,
+ "show ip prefix-list [WORD [seq$dseq (1-4294967295)$arg]]",
+ SHOW_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
+ "sequence number of an entry\n"
+ "Sequence number\n")
{
- int idx_word = 3;
- int idx_permit_deny = 4;
- int idx_ipv6_prefixlen = 5;
- int idx_number = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, NULL, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number]->arg);
+ enum display_type dtype = normal_display;
+ if (dseq)
+ dtype = sequential_display;
+
+ return vty_show_prefix_list (vty, AFI_IP, prefix_list, arg_str, dtype);
}
-DEFUN (no_ipv6_prefix_list_seq,
- no_ipv6_prefix_list_seq_cmd,
- "no ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> <X:X::X:X/M|any>",
- NO_STR
- IPV6_STR
+DEFPY (show_ip_prefix_list_prefix,
+ show_ip_prefix_list_prefix_cmd,
+ "show ip prefix-list WORD A.B.C.D/M$prefix [longer$dl|first-match$dfm]",
+ SHOW_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Any prefix match. Same as \"::0/0 le 128\"\n")
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Lookup longer prefix\n"
+ "First matched prefix\n")
{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv6_any = 7;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_any]->arg, NULL, NULL);
+ enum display_type dtype = normal_display;
+ if (dl)
+ dtype = longer_display;
+ else if (dfm)
+ dtype = first_match_display;
+
+ return vty_show_prefix_list_prefix (vty, AFI_IP, prefix_list, prefix_str, dtype);
}
-DEFUN (no_ipv6_prefix_list_seq_ge,
- no_ipv6_prefix_list_seq_ge_cmd,
- "no ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M ge (0-128)",
- NO_STR
- IPV6_STR
+DEFPY (show_ip_prefix_list_summary,
+ show_ip_prefix_list_summary_cmd,
+ "show ip prefix-list summary [WORD$prefix_list]",
+ SHOW_STR
+ IP_STR
PREFIX_LIST_STR
- "Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n")
+ "Summary of prefix lists\n"
+ "Name of a prefix list\n")
{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv6_prefixlen = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, NULL);
+ return vty_show_prefix_list (vty, AFI_IP, prefix_list, NULL, summary_display);
}
-DEFUN (no_ipv6_prefix_list_seq_ge_le,
- no_ipv6_prefix_list_seq_ge_le_cmd,
- "no ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M ge (0-128) le (0-128)",
- NO_STR
- IPV6_STR
+DEFPY (show_ip_prefix_list_detail,
+ show_ip_prefix_list_detail_cmd,
+ "show ip prefix-list detail [WORD$prefix_list]",
+ SHOW_STR
+ IP_STR
+ PREFIX_LIST_STR
+ "Detail of prefix lists\n"
+ "Name of a prefix list\n")
+{
+ return vty_show_prefix_list (vty, AFI_IP, prefix_list, NULL, detail_display);
+}
+
+DEFPY (clear_ip_prefix_list,
+ clear_ip_prefix_list_cmd,
+ "clear ip prefix-list [WORD [A.B.C.D/M$prefix]]",
+ CLEAR_STR
+ IP_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
- "sequence number of an entry\n"
- "Sequence number\n"
- "Specify packets to reject\n"
- "Specify packets to forward\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Minimum prefix length to be matched\n"
- "Minimum prefix length\n"
- "Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv6_prefixlen = 7;
- int idx_number_2 = 9;
- int idx_number_3 = 11;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg);
-}
-
-DEFUN (no_ipv6_prefix_list_seq_le,
- no_ipv6_prefix_list_seq_le_cmd,
- "no ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M le (0-128)",
- NO_STR
+ return vty_clear_prefix_list (vty, AFI_IP, prefix_list, prefix_str);
+}
+
+DEFPY (ipv6_prefix_list,
+ ipv6_prefix_list_cmd,
+ "ipv6 prefix-list WORD [seq (1-4294967295)] <deny|permit>$action <any$dest|X:X::X:X/M$dest [{ge (0-128)|le (0-128)}]>",
IPV6_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
"Sequence number\n"
"Specify packets to reject\n"
"Specify packets to forward\n"
+ "Any prefix match. Same as \"::0/0 le 128\"\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
"Maximum prefix length to be matched\n"
- "Maximum prefix length\n")
+ "Maximum prefix length\n"
+ "Minimum prefix length to be matched\n"
+ "Minimum prefix length\n")
{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv6_prefixlen = 7;
- int idx_number_2 = 9;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, NULL, argv[idx_number_2]->arg);
+ return vty_prefix_list_install (vty, AFI_IP6, prefix_list, seq_str, action,
+ dest, ge_str, le_str);
}
-DEFUN (no_ipv6_prefix_list_seq_le_ge,
- no_ipv6_prefix_list_seq_le_ge_cmd,
- "no ipv6 prefix-list WORD seq (1-4294967295) <deny|permit> X:X::X:X/M le (0-128) ge (0-128)",
+DEFPY (no_ipv6_prefix_list,
+ no_ipv6_prefix_list_cmd,
+ "no ipv6 prefix-list WORD [seq (1-4294967295)] <deny|permit>$action <any$dest|X:X::X:X/M$dest [{ge (0-128)|le (0-128)}]>",
NO_STR
IPV6_STR
PREFIX_LIST_STR
"Sequence number\n"
"Specify packets to reject\n"
"Specify packets to forward\n"
+ "Any prefix match. Same as \"::0/0 le 128\"\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
"Maximum prefix length to be matched\n"
"Maximum prefix length\n"
"Minimum prefix length to be matched\n"
"Minimum prefix length\n")
{
- int idx_word = 3;
- int idx_number = 5;
- int idx_permit_deny = 6;
- int idx_ipv6_prefixlen = 7;
- int idx_number_2 = 9;
- int idx_number_3 = 11;
- return vty_prefix_list_uninstall (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, argv[idx_permit_deny]->arg,
- argv[idx_ipv6_prefixlen]->arg, argv[idx_number_3]->arg, argv[idx_number_2]->arg);
+ return vty_prefix_list_uninstall (vty, AFI_IP6, prefix_list, seq_str, action,
+ dest, ge_str, le_str);
}
-DEFUN (ipv6_prefix_list_sequence_number,
- ipv6_prefix_list_sequence_number_cmd,
- "ipv6 prefix-list sequence-number",
+DEFPY (no_ipv6_prefix_list_all,
+ no_ipv6_prefix_list_all_cmd,
+ "no ipv6 prefix-list WORD",
+ NO_STR
IPV6_STR
PREFIX_LIST_STR
- "Include/exclude sequence numbers in NVGEN\n")
+ "Name of a prefix list\n")
{
- prefix_master_ipv6.seqnum = 1;
- return CMD_SUCCESS;
+ return vty_prefix_list_uninstall (vty, AFI_IP6, prefix_list, NULL, NULL,
+ NULL, NULL, NULL);
}
-DEFUN (no_ipv6_prefix_list_sequence_number,
- no_ipv6_prefix_list_sequence_number_cmd,
- "no ipv6 prefix-list sequence-number",
+DEFPY (ipv6_prefix_list_sequence_number,
+ ipv6_prefix_list_sequence_number_cmd,
+ "[no] ipv6 prefix-list sequence-number",
NO_STR
IPV6_STR
PREFIX_LIST_STR
"Include/exclude sequence numbers in NVGEN\n")
{
- prefix_master_ipv6.seqnum = 0;
+ prefix_master_ipv6.seqnum = no ? 0 : 1;
return CMD_SUCCESS;
}
}
-DEFUN (show_ipv6_prefix_list,
+DEFPY (show_ipv6_prefix_list,
show_ipv6_prefix_list_cmd,
- "show ipv6 prefix-list",
- SHOW_STR
- IPV6_STR
- PREFIX_LIST_STR)
-{
- return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, normal_display);
-}
-
-DEFUN (show_ipv6_prefix_list_name,
- show_ipv6_prefix_list_name_cmd,
- "show ipv6 prefix-list WORD",
- SHOW_STR
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n")
-{
- int idx_word = 3;
- return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, normal_display);
-}
-
-DEFUN (show_ipv6_prefix_list_name_seq,
- show_ipv6_prefix_list_name_seq_cmd,
- "show ipv6 prefix-list WORD seq (1-4294967295)",
+ "show ipv6 prefix-list [WORD [seq$dseq (1-4294967295)$arg]]",
SHOW_STR
IPV6_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
"sequence number of an entry\n"
- "Sequence number\n")
-{
- int idx_word = 3;
- int idx_number = 5;
- return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_number]->arg, sequential_display);
-}
-
-DEFUN (show_ipv6_prefix_list_prefix,
- show_ipv6_prefix_list_prefix_cmd,
- "show ipv6 prefix-list WORD X:X::X:X/M",
- SHOW_STR
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
+ "Sequence number\n"
+ "Lookup longer prefix\n"
+ "First matched prefix\n")
{
- int idx_word = 3;
- int idx_ipv6_prefixlen = 4;
- return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, normal_display);
-}
+ enum display_type dtype = normal_display;
+ if (dseq)
+ dtype = sequential_display;
-DEFUN (show_ipv6_prefix_list_prefix_longer,
- show_ipv6_prefix_list_prefix_longer_cmd,
- "show ipv6 prefix-list WORD X:X::X:X/M longer",
- SHOW_STR
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
- "Lookup longer prefix\n")
-{
- int idx_word = 3;
- int idx_ipv6_prefixlen = 4;
- return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, longer_display);
+ return vty_show_prefix_list (vty, AFI_IP6, prefix_list, arg_str, dtype);
}
-DEFUN (show_ipv6_prefix_list_prefix_first_match,
- show_ipv6_prefix_list_prefix_first_match_cmd,
- "show ipv6 prefix-list WORD X:X::X:X/M first-match",
+DEFPY (show_ipv6_prefix_list_prefix,
+ show_ipv6_prefix_list_prefix_cmd,
+ "show ipv6 prefix-list WORD X:X::X:X/M$prefix [longer$dl|first-match$dfm]",
SHOW_STR
IPV6_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
+ "Lookup longer prefix\n"
"First matched prefix\n")
{
- int idx_word = 3;
- int idx_ipv6_prefixlen = 4;
- return vty_show_prefix_list_prefix (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg, first_match_display);
-}
+ enum display_type dtype = normal_display;
+ if (dl)
+ dtype = longer_display;
+ else if (dfm)
+ dtype = first_match_display;
-DEFUN (show_ipv6_prefix_list_summary,
- show_ipv6_prefix_list_summary_cmd,
- "show ipv6 prefix-list summary",
- SHOW_STR
- IPV6_STR
- PREFIX_LIST_STR
- "Summary of prefix lists\n")
-{
- return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, summary_display);
+ return vty_show_prefix_list_prefix (vty, AFI_IP6, prefix_list, prefix_str, dtype);
}
-DEFUN (show_ipv6_prefix_list_summary_name,
- show_ipv6_prefix_list_summary_name_cmd,
- "show ipv6 prefix-list summary WORD",
+DEFPY (show_ipv6_prefix_list_summary,
+ show_ipv6_prefix_list_summary_cmd,
+ "show ipv6 prefix-list summary [WORD$prefix-list]",
SHOW_STR
IPV6_STR
PREFIX_LIST_STR
"Summary of prefix lists\n"
"Name of a prefix list\n")
{
- int idx_word = 4;
- return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, summary_display);
+ return vty_show_prefix_list (vty, AFI_IP6, prefix_list, NULL, summary_display);
}
-DEFUN (show_ipv6_prefix_list_detail,
+DEFPY (show_ipv6_prefix_list_detail,
show_ipv6_prefix_list_detail_cmd,
- "show ipv6 prefix-list detail",
- SHOW_STR
- IPV6_STR
- PREFIX_LIST_STR
- "Detail of prefix lists\n")
-{
- return vty_show_prefix_list (vty, AFI_IP6, NULL, NULL, detail_display);
-}
-
-DEFUN (show_ipv6_prefix_list_detail_name,
- show_ipv6_prefix_list_detail_name_cmd,
- "show ipv6 prefix-list detail WORD",
+ "show ipv6 prefix-list detail [WORD$prefix-list]",
SHOW_STR
IPV6_STR
PREFIX_LIST_STR
"Detail of prefix lists\n"
"Name of a prefix list\n")
{
- int idx_word = 4;
- return vty_show_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL, detail_display);
+ return vty_show_prefix_list (vty, AFI_IP6, prefix_list, NULL, detail_display);
}
-DEFUN (clear_ipv6_prefix_list,
+DEFPY (clear_ipv6_prefix_list,
clear_ipv6_prefix_list_cmd,
- "clear ipv6 prefix-list",
- CLEAR_STR
- IPV6_STR
- PREFIX_LIST_STR)
-{
- return vty_clear_prefix_list (vty, AFI_IP6, NULL, NULL);
-}
-
-DEFUN (clear_ipv6_prefix_list_name,
- clear_ipv6_prefix_list_name_cmd,
- "clear ipv6 prefix-list WORD",
- CLEAR_STR
- IPV6_STR
- PREFIX_LIST_STR
- "Name of a prefix list\n")
-{
- int idx_word = 3;
- return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, NULL);
-}
-
-DEFUN (clear_ipv6_prefix_list_name_prefix,
- clear_ipv6_prefix_list_name_prefix_cmd,
- "clear ipv6 prefix-list WORD X:X::X:X/M",
+ "clear ipv6 prefix-list [WORD [X:X::X:X/M$prefix]]",
CLEAR_STR
IPV6_STR
PREFIX_LIST_STR
"Name of a prefix list\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
{
- int idx_word = 3;
- int idx_ipv6_prefixlen = 4;
- return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg);
+ return vty_clear_prefix_list (vty, AFI_IP6, prefix_list, prefix_str);
}
/* Configuration write function. */
if (! master->seqnum)
{
- vty_out (vty, "no ip%s prefix-list sequence-number%s",
- afi == AFI_IP ? "" : "v6", VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "no ip%s prefix-list sequence-number",
+ afi == AFI_IP ? "" : "v6");
+ vty_outln (vty, "!");
}
for (plist = master->num.head; plist; plist = plist->next)
{
if (plist->desc)
{
- vty_out (vty, "ip%s prefix-list %s description %s%s",
+ vty_outln (vty, "ip%s prefix-list %s description %s",
afi == AFI_IP ? "" : "v6",
- plist->name, plist->desc, VTY_NEWLINE);
+ plist->name, plist->desc);
write++;
}
if (pentry->le)
vty_out (vty, " le %d", pentry->le);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
write++;
}
- /* vty_out (vty, "!%s", VTY_NEWLINE); */
+ /* vty_out (vty, "!%s", VTYNL); */
}
for (plist = master->str.head; plist; plist = plist->next)
{
if (plist->desc)
{
- vty_out (vty, "ip%s prefix-list %s description %s%s",
+ vty_outln (vty, "ip%s prefix-list %s description %s",
afi == AFI_IP ? "" : "v6",
- plist->name, plist->desc, VTY_NEWLINE);
+ plist->name, plist->desc);
write++;
}
if (pentry->le)
vty_out (vty, " le %d", pentry->le);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
write++;
}
}
else
json_object_object_add(json, "ipv6PrefixList", json_prefix);
- 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
{
- vty_out (vty, "ip%s prefix-list %s: %d entries%s",
+ vty_outln (vty, "ip%s prefix-list %s: %d entries",
afi == AFI_IP ? "" : "v6",
- plist->name, plist->count, VTY_NEWLINE);
+ plist->name, plist->count);
for (pentry = plist->head; pentry; pentry = pentry->next)
{
if (pentry->le)
vty_out (vty, " le %d", pentry->le);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
return plist->count;
install_node (&prefix_node, config_write_prefix_ipv4);
install_element (CONFIG_NODE, &ip_prefix_list_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_ge_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_ge_le_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_le_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_le_ge_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_seq_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_seq_ge_le_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_seq_le_cmd);
- install_element (CONFIG_NODE, &ip_prefix_list_seq_le_ge_cmd);
-
install_element (CONFIG_NODE, &no_ip_prefix_list_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_prefix_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_ge_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_ge_le_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_le_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_le_ge_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_seq_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_seq_ge_le_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_seq_le_ge_cmd);
+ install_element (CONFIG_NODE, &no_ip_prefix_list_all_cmd);
install_element (CONFIG_NODE, &ip_prefix_list_description_cmd);
install_element (CONFIG_NODE, &no_ip_prefix_list_description_cmd);
install_element (CONFIG_NODE, &no_ip_prefix_list_description_comment_cmd);
install_element (CONFIG_NODE, &ip_prefix_list_sequence_number_cmd);
- install_element (CONFIG_NODE, &no_ip_prefix_list_sequence_number_cmd);
install_element (VIEW_NODE, &show_ip_prefix_list_cmd);
- install_element (VIEW_NODE, &show_ip_prefix_list_name_cmd);
- install_element (VIEW_NODE, &show_ip_prefix_list_name_seq_cmd);
install_element (VIEW_NODE, &show_ip_prefix_list_prefix_cmd);
- install_element (VIEW_NODE, &show_ip_prefix_list_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ip_prefix_list_prefix_first_match_cmd);
install_element (VIEW_NODE, &show_ip_prefix_list_summary_cmd);
- install_element (VIEW_NODE, &show_ip_prefix_list_summary_name_cmd);
install_element (VIEW_NODE, &show_ip_prefix_list_detail_cmd);
- install_element (VIEW_NODE, &show_ip_prefix_list_detail_name_cmd);
install_element (ENABLE_NODE, &clear_ip_prefix_list_cmd);
- install_element (ENABLE_NODE, &clear_ip_prefix_list_name_cmd);
- install_element (ENABLE_NODE, &clear_ip_prefix_list_name_prefix_cmd);
}
/* Prefix-list node. */
install_node (&prefix_ipv6_node, config_write_prefix_ipv6);
install_element (CONFIG_NODE, &ipv6_prefix_list_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_ge_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_ge_le_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_le_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_le_ge_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_seq_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_seq_ge_le_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_cmd);
- install_element (CONFIG_NODE, &ipv6_prefix_list_seq_le_ge_cmd);
-
install_element (CONFIG_NODE, &no_ipv6_prefix_list_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_prefix_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_ge_le_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_le_ge_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_ge_le_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_seq_le_ge_cmd);
+ install_element (CONFIG_NODE, &no_ipv6_prefix_list_all_cmd);
install_element (CONFIG_NODE, &ipv6_prefix_list_description_cmd);
install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_cmd);
install_element (CONFIG_NODE, &no_ipv6_prefix_list_description_comment_cmd);
install_element (CONFIG_NODE, &ipv6_prefix_list_sequence_number_cmd);
- install_element (CONFIG_NODE, &no_ipv6_prefix_list_sequence_number_cmd);
install_element (VIEW_NODE, &show_ipv6_prefix_list_cmd);
- install_element (VIEW_NODE, &show_ipv6_prefix_list_name_cmd);
- install_element (VIEW_NODE, &show_ipv6_prefix_list_name_seq_cmd);
install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_cmd);
- install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_longer_cmd);
- install_element (VIEW_NODE, &show_ipv6_prefix_list_prefix_first_match_cmd);
install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_cmd);
- install_element (VIEW_NODE, &show_ipv6_prefix_list_summary_name_cmd);
install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_cmd);
- install_element (VIEW_NODE, &show_ipv6_prefix_list_detail_name_cmd);
install_element (ENABLE_NODE, &clear_ipv6_prefix_list_cmd);
- install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_cmd);
- install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_prefix_cmd);
}
void
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)
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 *);
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);
}
switch (ret)
{
case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Can't find rule.", frr_protonameinst);
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.",
+ frr_protonameinst);
return CMD_WARNING;
}
}
switch (ret)
{
case RMAP_RULE_MISSING:
- vty_out (vty, "%% BGP Can't find rule.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Can't find rule.", frr_protonameinst);
break;
case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% BGP Argument is malformed.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.",
+ frr_protonameinst);
break;
}
if (dep_name)
switch (ret)
{
case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Can't find rule.", frr_protonameinst);
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.",
+ frr_protonameinst);
return CMD_WARNING;
}
}
switch (ret)
{
case RMAP_RULE_MISSING:
- vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Can't find rule.", frr_protonameinst);
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.",
+ frr_protonameinst);
return CMD_WARNING;
}
}
struct route_map_index *index;
struct route_map_rule *rule;
- vty_out (vty, "%s:%s", frr_protonameinst, VTY_NEWLINE);
+ vty_outln (vty, "%s:", frr_protonameinst);
for (index = map->head; index; index = index->next)
{
- vty_out (vty, "route-map %s, %s, sequence %d%s",
+ vty_outln (vty, "route-map %s, %s, sequence %d",
map->name, route_map_type_str (index->type),
- index->pref, VTY_NEWLINE);
+ index->pref);
/* Description */
if (index->description)
- vty_out (vty, " Description:%s %s%s", VTY_NEWLINE,
- index->description, VTY_NEWLINE);
+ vty_outln (vty, " Description:%s %s", VTYNL,
+ index->description);
/* Match clauses */
- vty_out (vty, " Match clauses:%s", VTY_NEWLINE);
+ vty_outln (vty, " Match clauses:");
for (rule = index->match_list.head; rule; rule = rule->next)
- vty_out (vty, " %s %s%s",
- rule->cmd->str, rule->rule_str, VTY_NEWLINE);
+ vty_outln (vty, " %s %s",
+ rule->cmd->str, rule->rule_str);
- vty_out (vty, " Set clauses:%s", VTY_NEWLINE);
+ vty_outln (vty, " Set clauses:");
for (rule = index->set_list.head; rule; rule = rule->next)
- vty_out (vty, " %s %s%s",
- rule->cmd->str, rule->rule_str, VTY_NEWLINE);
+ vty_outln (vty, " %s %s",
+ rule->cmd->str, rule->rule_str);
/* Call clause */
- vty_out (vty, " Call clause:%s", VTY_NEWLINE);
+ vty_outln (vty, " Call clause:");
if (index->nextrm)
- vty_out (vty, " Call %s%s", index->nextrm, VTY_NEWLINE);
+ vty_outln (vty, " Call %s", index->nextrm);
/* Exit Policy */
- vty_out (vty, " Action:%s", VTY_NEWLINE);
+ vty_outln (vty, " Action:");
if (index->exitpolicy == RMAP_GOTO)
- vty_out (vty, " Goto %d%s", index->nextpref, VTY_NEWLINE);
+ vty_outln (vty, " Goto %d", index->nextpref);
else if (index->exitpolicy == RMAP_NEXT)
- vty_out (vty, " Continue to next entry%s", VTY_NEWLINE);
+ vty_outln (vty, " Continue to next entry");
else if (index->exitpolicy == RMAP_EXIT)
- vty_out (vty, " Exit routemap%s", VTY_NEWLINE);
+ vty_outln (vty, " Exit routemap");
}
}
}
else
{
- vty_out (vty, "%s: 'route-map %s' not found%s", frr_protonameinst,
- name, VTY_NEWLINE);
+ vty_outln (vty, "%s: 'route-map %s' not found", frr_protonameinst,
+ name);
return CMD_SUCCESS;
}
}
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
if (ret < 0)
{
- vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed nexthop address");
return CMD_WARNING;
}
if (su.sin.sin_addr.s_addr == 0 ||
IPV4_CLASS_DE(su.sin.sin_addr.s_addr))
{
- vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast "
- "or reserved%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "%% nexthop address cannot be 0.0.0.0, multicast " "or reserved");
return CMD_WARNING;
}
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_LINKLOCAL(&addr))
{
- vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid link-local nexthop address");
return CMD_WARNING;
}
int idx_number = 2;
VTY_DECLVAR_CONTEXT (route_map_index, index);
+ const char *pass = (argv[idx_number]->type == RANGE_TKN) ?
+ argv[idx_number]->arg : argv[idx_number]->text;
+
if (rmap_match_set_hook.set_metric)
- return rmap_match_set_hook.set_metric (vty, index, "metric", argv[idx_number]->arg);
+ return rmap_match_set_hook.set_metric (vty, index, "metric", pass);
return CMD_SUCCESS;
}
map = route_map_lookup_by_name (mapname);
if (map == NULL)
{
- vty_out (vty, "%% Could not find route-map %s%s", mapname, VTY_NEWLINE);
+ vty_outln (vty, "%% Could not find route-map %s", mapname);
return CMD_WARNING;
}
struct route_map *map;
struct route_map_index *index;
char *endptr = NULL;
- int permit = argv[idx_permit_deny]->arg[0] == 'p' ? RMAP_PERMIT : RMAP_DENY;
+ int permit = strmatch (argv[idx_permit_deny]->text, "permit") ?
+ RMAP_PERMIT : RMAP_DENY;
const char *prefstr = argv[idx_number]->arg;
const char *mapname = argv[idx_word]->arg;
unsigned long pref = strtoul (prefstr, &endptr, 10);
map = route_map_lookup_by_name (mapname);
if (map == NULL)
{
- vty_out (vty, "%% Could not find route-map %s%s", mapname, VTY_NEWLINE);
+ vty_outln (vty, "%% Could not find route-map %s", mapname);
return CMD_WARNING;
}
index = route_map_index_lookup (map, permit, pref);
if (index == NULL)
{
- vty_out (vty, "%% Could not find route-map entry %s %s%s",
- mapname, prefstr, VTY_NEWLINE);
+ vty_outln (vty, "%% Could not find route-map entry %s %s",
+ mapname, prefstr);
return CMD_WARNING;
}
if (index->type == RMAP_DENY)
{
/* Under a deny clause, match means it's finished. No need to set next */
- vty_out (vty, "on-match next not supported under route-map deny%s",
- VTY_NEWLINE);
+ vty_outln (vty,"on-match next not supported under route-map deny");
return CMD_WARNING;
}
index->exitpolicy = RMAP_NEXT;
if (index->type == RMAP_DENY)
{
/* Under a deny clause, match means it's finished. No need to go anywhere */
- vty_out (vty, "on-match goto not supported under route-map deny%s",
- VTY_NEWLINE);
+ vty_outln (vty,"on-match goto not supported under route-map deny");
return CMD_WARNING;
}
if (num)
- VTY_GET_INTEGER_RANGE("route-map index", d, num, 1, 65535);
+ d = strtoul(num, NULL, 10);
else
d = index->pref + 1;
if (d <= index->pref)
{
/* Can't allow you to do that, Dave */
- vty_out (vty, "can't jump backwards in route-maps%s", VTY_NEWLINE);
+ vty_outln (vty, "can't jump backwards in route-maps");
return CMD_WARNING;
}
else
for (index = map->head; index; index = index->next)
{
if (!first)
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
else
first = 0;
- vty_out (vty, "route-map %s %s %d%s",
+ vty_outln (vty, "route-map %s %s %d",
map->name,
route_map_type_str (index->type),
- index->pref, VTY_NEWLINE);
+ index->pref);
if (index->description)
- vty_out (vty, " description %s%s", index->description, VTY_NEWLINE);
+ vty_outln (vty, " description %s", index->description);
for (rule = index->match_list.head; rule; rule = rule->next)
- vty_out (vty, " match %s %s%s", rule->cmd->str,
- rule->rule_str ? rule->rule_str : "",
- VTY_NEWLINE);
+ vty_outln (vty, " match %s %s", rule->cmd->str,
+ rule->rule_str ? rule->rule_str : "");
for (rule = index->set_list.head; rule; rule = rule->next)
- vty_out (vty, " set %s %s%s", rule->cmd->str,
- rule->rule_str ? rule->rule_str : "",
- VTY_NEWLINE);
+ vty_outln (vty, " set %s %s", rule->cmd->str,
+ rule->rule_str ? rule->rule_str : "");
if (index->nextrm)
- vty_out (vty, " call %s%s", index->nextrm, VTY_NEWLINE);
+ vty_outln (vty, " call %s", index->nextrm);
if (index->exitpolicy == RMAP_GOTO)
- vty_out (vty, " on-match goto %d%s", index->nextpref, VTY_NEWLINE);
+ vty_outln (vty, " on-match goto %d", index->nextpref);
if (index->exitpolicy == RMAP_NEXT)
- vty_out (vty," on-match next%s", VTY_NEWLINE);
+ vty_outln (vty," on-match next");
write++;
}
if (!l)
l = skiplist_last_created;
- vty_out(vty, "Skiplist %p has max level %d%s", l, l->level, VTY_NEWLINE);
+ vty_outln (vty, "Skiplist %p has max level %d", l, l->level);
for (i = l->level; i >= 0; --i)
- vty_out(vty, " @%d: %ld%s",
- i, (long)((l->stats->forward[i]) - (struct skiplistnode *)NULL),
- VTY_NEWLINE);
+ vty_outln (vty, " @%d: %ld",
+ i,(long)((l->stats->forward[i]) - (struct skiplistnode *)NULL));
}
static void *
ret = smux_str2oid (oid_str, oid, &oid_len);
if (ret != 0)
{
- vty_out (vty, "object ID malformed%s", VTY_NEWLINE);
+ vty_out (vty, "object ID malformed%s", VTYNL);
return CMD_WARNING;
}
vty_out (vty, "%s%d", first ? "" : ".", (int) smux_oid[i]);
first = 0;
}
- vty_out (vty, " %s%s", smux_passwd, VTY_NEWLINE);
+ vty_outln (vty, " %s", smux_passwd);
}
return 0;
}
spf_backoff_show(struct spf_backoff *backoff, struct vty *vty,
const char *prefix)
{
- vty_out(vty, "%sCurrent state: %s%s", prefix,
- spf_backoff_state2str(backoff->state), VTY_NEWLINE);
- vty_out(vty, "%sInit timer: %ld msec%s", prefix,
- backoff->init_delay, VTY_NEWLINE);
- vty_out(vty, "%sShort timer: %ld msec%s", prefix,
- backoff->short_delay, VTY_NEWLINE);
- vty_out(vty, "%sLong timer: %ld msec%s", prefix,
- backoff->long_delay, VTY_NEWLINE);
- vty_out(vty, "%sHolddown timer: %ld msec%s", prefix,
- backoff->holddown, VTY_NEWLINE);
+ vty_outln (vty, "%sCurrent state: %s", prefix,
+ spf_backoff_state2str(backoff->state));
+ vty_outln (vty, "%sInit timer: %ld msec", prefix,
+ backoff->init_delay);
+ vty_outln (vty, "%sShort timer: %ld msec", prefix,
+ backoff->short_delay);
+ vty_outln (vty, "%sLong timer: %ld msec", prefix,
+ backoff->long_delay);
+ vty_outln (vty, "%sHolddown timer: %ld msec", prefix,
+ backoff->holddown);
if (backoff->t_holddown)
{
struct timeval remain = thread_timer_remain(backoff->t_holddown);
- vty_out(vty, "%s Still runs for %ld msec%s",
- prefix, remain.tv_sec * 1000 + remain.tv_usec/1000, VTY_NEWLINE);
+ vty_outln (vty, "%s Still runs for %ld msec",
+ prefix, remain.tv_sec * 1000 + remain.tv_usec / 1000);
}
else
{
- vty_out(vty, "%s Inactive%s", prefix, VTY_NEWLINE);
+ vty_outln (vty, "%s Inactive", prefix);
}
- vty_out(vty, "%sTimeToLearn timer: %ld msec%s", prefix,
- backoff->timetolearn, VTY_NEWLINE);
+ vty_outln (vty, "%sTimeToLearn timer: %ld msec", prefix,
+ backoff->timetolearn);
if (backoff->t_timetolearn)
{
struct timeval remain = thread_timer_remain(backoff->t_timetolearn);
- vty_out(vty, "%s Still runs for %ld msec%s",
- prefix, remain.tv_sec * 1000 + remain.tv_usec/1000, VTY_NEWLINE);
+ vty_outln (vty, "%s Still runs for %ld msec",
+ prefix, remain.tv_sec * 1000 + remain.tv_usec / 1000);
}
else
{
- vty_out(vty, "%s Inactive%s", prefix, VTY_NEWLINE);
+ vty_outln (vty, "%s Inactive", prefix);
}
- vty_out(vty, "%sFirst event: %s%s", prefix,
- timeval_format(&backoff->first_event_time), VTY_NEWLINE);
- vty_out(vty, "%sLast event: %s%s", prefix,
- timeval_format(&backoff->last_event_time), VTY_NEWLINE);
+ vty_outln (vty, "%sFirst event: %s", prefix,
+ timeval_format(&backoff->first_event_time));
+ vty_outln (vty, "%sLast event: %s", prefix,
+ timeval_format(&backoff->last_event_time));
}
DEFUN(spf_backoff_debug,
if (debug_spf_backoff)
{
- vty_out(vty, "debug spf-delay-ietf%s", VTY_NEWLINE);
+ vty_outln (vty, "debug spf-delay-ietf");
written++;
}
write (m->io_pipe[1], &wakebyte, 1); \
} while (0);
-static pthread_mutex_t cpu_record_mtx = PTHREAD_MUTEX_INITIALIZER;
-static struct hash *cpu_record = NULL;
+/* control variable for initializer */
+pthread_once_t init_once = PTHREAD_ONCE_INIT;
+pthread_key_t thread_current;
+
+pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER;
+static struct list *masters;
-static unsigned long
-timeval_elapsed (struct timeval a, struct timeval b)
-{
- return (((a.tv_sec - b.tv_sec) * TIMER_SECOND_MICRO)
- + (a.tv_usec - b.tv_usec));
-}
+/* CLI start ---------------------------------------------------------------- */
static unsigned int
cpu_record_hash_key (struct cpu_thread_history *a)
{
a->total_active, a->cpu.total/1000, a->cpu.total%1000, a->total_calls,
a->cpu.total/a->total_calls, a->cpu.max,
a->real.total/a->total_calls, a->real.max);
- vty_out(vty, " %c%c%c%c%c %s%s",
+ vty_outln (vty, " %c%c%c%c%c %s",
a->types & (1 << THREAD_READ) ? 'R':' ',
a->types & (1 << THREAD_WRITE) ? 'W':' ',
a->types & (1 << THREAD_TIMER) ? 'T':' ',
a->types & (1 << THREAD_EVENT) ? 'E':' ',
a->types & (1 << THREAD_EXECUTE) ? 'X':' ',
- a->funcname, VTY_NEWLINE);
+ a->funcname);
}
static void
-cpu_record_hash_print(struct hash_backet *bucket,
- void *args[])
+cpu_record_hash_print(struct hash_backet *bucket, void *args[])
{
struct cpu_thread_history *totals = args[0];
struct vty *vty = args[1];
thread_type *filter = args[2];
+
struct cpu_thread_history *a = bucket->data;
if ( !(a->types & *filter) )
{
struct cpu_thread_history tmp;
void *args[3] = {&tmp, vty, &filter};
+ struct thread_master *m;
+ struct listnode *ln;
memset(&tmp, 0, sizeof tmp);
tmp.funcname = "TOTAL";
tmp.types = filter;
- vty_out(vty, "%21s %18s %18s%s",
- "", "CPU (user+system):", "Real (wall-clock):", VTY_NEWLINE);
- vty_out(vty, "Active Runtime(ms) Invoked Avg uSec Max uSecs");
- vty_out(vty, " Avg uSec Max uSecs");
- vty_out(vty, " Type Thread%s", VTY_NEWLINE);
-
- pthread_mutex_lock (&cpu_record_mtx);
+ pthread_mutex_lock (&masters_mtx);
{
- hash_iterate(cpu_record,
- (void(*)(struct hash_backet*,void*))cpu_record_hash_print,
- args);
+ for (ALL_LIST_ELEMENTS_RO (masters, ln, m)) {
+ const char *name = m->name ? m->name : "main";
+
+ char underline[strlen(name) + 1];
+ memset (underline, '-', sizeof (underline));
+ underline[sizeof(underline)] = '\0';
+
+ vty_out (vty, VTYNL);
+ vty_outln(vty, "Showing statistics for pthread %s", name);
+ vty_outln(vty, "-------------------------------%s", underline);
+ vty_outln(vty, "%21s %18s %18s", "", "CPU (user+system):", "Real (wall-clock):");
+ vty_out(vty, "Active Runtime(ms) Invoked Avg uSec Max uSecs");
+ vty_out(vty, " Avg uSec Max uSecs");
+ vty_outln(vty, " Type Thread");
+
+ if (m->cpu_record->count)
+ hash_iterate(m->cpu_record,
+ (void (*)(struct hash_backet *, void *))
+ cpu_record_hash_print,
+ args);
+ else
+ vty_outln(vty, "No data to display yet.");
+
+ vty_out(vty, VTYNL);
+ }
}
- pthread_mutex_unlock (&cpu_record_mtx);
+ pthread_mutex_unlock (&masters_mtx);
+
+ vty_out(vty, VTYNL);
+ vty_outln(vty, "Total thread statistics");
+ vty_outln(vty, "-------------------------");
+ vty_outln(vty, "%21s %18s %18s", "", "CPU (user+system):", "Real (wall-clock):");
+ vty_out(vty, "Active Runtime(ms) Invoked Avg uSec Max uSecs");
+ vty_out(vty, " Avg uSec Max uSecs");
+ vty_outln(vty, " Type Thread");
if (tmp.total_calls > 0)
vty_out_cpu_thread_history(vty, &tmp);
}
-DEFUN (show_thread_cpu,
- show_thread_cpu_cmd,
- "show thread cpu [FILTER]",
- SHOW_STR
- "Thread information\n"
- "Thread CPU usage\n"
- "Display filter (rwtexb)\n")
-{
- int idx_filter = 3;
- int i = 0;
- thread_type filter = (thread_type) -1U;
-
- if (argc > 3)
- {
- filter = 0;
- while (argv[idx_filter]->arg[i] != '\0')
- {
- switch ( argv[idx_filter]->arg[i] )
- {
- case 'r':
- case 'R':
- filter |= (1 << THREAD_READ);
- break;
- case 'w':
- case 'W':
- filter |= (1 << THREAD_WRITE);
- break;
- case 't':
- case 'T':
- filter |= (1 << THREAD_TIMER);
- break;
- case 'e':
- case 'E':
- filter |= (1 << THREAD_EVENT);
- break;
- case 'x':
- case 'X':
- filter |= (1 << THREAD_EXECUTE);
- break;
- default:
- break;
- }
- ++i;
- }
- if (filter == 0)
- {
- vty_out(vty, "Invalid filter \"%s\" specified,"
- " must contain at least one of 'RWTEXB'%s",
- argv[idx_filter]->arg, VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
-
- cpu_record_print(vty, filter);
- return CMD_SUCCESS;
-}
-
static void
-cpu_record_hash_clear (struct hash_backet *bucket,
- void *args)
+cpu_record_hash_clear (struct hash_backet *bucket, void *args[])
{
- thread_type *filter = args;
+ thread_type *filter = args[0];
+ struct hash *cpu_record = args[1];
+
struct cpu_thread_history *a = bucket->data;
if ( !(a->types & *filter) )
return;
- pthread_mutex_lock (&cpu_record_mtx);
- {
- hash_release (cpu_record, bucket->data);
- }
- pthread_mutex_unlock (&cpu_record_mtx);
+ hash_release (cpu_record, bucket->data);
}
static void
cpu_record_clear (thread_type filter)
{
thread_type *tmp = &filter;
+ struct thread_master *m;
+ struct listnode *ln;
- pthread_mutex_lock (&cpu_record_mtx);
+ pthread_mutex_lock (&masters_mtx);
{
- hash_iterate (cpu_record,
- (void (*) (struct hash_backet*,void*)) cpu_record_hash_clear,
- tmp);
+ for (ALL_LIST_ELEMENTS_RO (masters, ln, m)) {
+ pthread_mutex_lock (&m->mtx);
+ {
+ void *args[2] = { tmp, m->cpu_record };
+ hash_iterate (m->cpu_record,
+ (void (*) (struct hash_backet*,void*))
+ cpu_record_hash_clear,
+ args);
+ }
+ pthread_mutex_unlock (&m->mtx);
+ }
}
- pthread_mutex_unlock (&cpu_record_mtx);
+ pthread_mutex_unlock (&masters_mtx);
+}
+
+static thread_type
+parse_filter (const char *filterstr)
+{
+ int i = 0;
+ int filter = 0;
+
+ while (filterstr[i] != '\0')
+ {
+ switch (filterstr[i])
+ {
+ case 'r':
+ case 'R':
+ filter |= (1 << THREAD_READ);
+ break;
+ case 'w':
+ case 'W':
+ filter |= (1 << THREAD_WRITE);
+ break;
+ case 't':
+ case 'T':
+ filter |= (1 << THREAD_TIMER);
+ break;
+ case 'e':
+ case 'E':
+ filter |= (1 << THREAD_EVENT);
+ break;
+ case 'x':
+ case 'X':
+ filter |= (1 << THREAD_EXECUTE);
+ break;
+ default:
+ break;
+ }
+ ++i;
+ }
+ return filter;
+}
+
+DEFUN (show_thread_cpu,
+ show_thread_cpu_cmd,
+ "show thread cpu [FILTER]",
+ SHOW_STR
+ "Thread information\n"
+ "Thread CPU usage\n"
+ "Display filter (rwtexb)\n")
+{
+ thread_type filter = (thread_type) -1U;
+ int idx = 0;
+
+ if (argv_find (argv, argc, "FILTER", &idx)) {
+ filter = parse_filter (argv[idx]->arg);
+ if (!filter) {
+ vty_outln(vty, "Invalid filter \"%s\" specified; must contain at least"
+ "one of 'RWTEXB'%s", argv[idx]->arg);
+ return CMD_WARNING;
+ }
+ }
+
+ cpu_record_print(vty, filter);
+ return CMD_SUCCESS;
}
DEFUN (clear_thread_cpu,
clear_thread_cpu_cmd,
"clear thread cpu [FILTER]",
- "Clear stored data\n"
+ "Clear stored data in all pthreads\n"
"Thread information\n"
"Thread CPU usage\n"
"Display filter (rwtexb)\n")
{
- int idx_filter = 3;
- int i = 0;
thread_type filter = (thread_type) -1U;
-
- if (argc > 3)
- {
- filter = 0;
- while (argv[idx_filter]->arg[i] != '\0')
- {
- switch ( argv[idx_filter]->arg[i] )
- {
- case 'r':
- case 'R':
- filter |= (1 << THREAD_READ);
- break;
- case 'w':
- case 'W':
- filter |= (1 << THREAD_WRITE);
- break;
- case 't':
- case 'T':
- filter |= (1 << THREAD_TIMER);
- break;
- case 'e':
- case 'E':
- filter |= (1 << THREAD_EVENT);
- break;
- case 'x':
- case 'X':
- filter |= (1 << THREAD_EXECUTE);
- break;
- default:
- break;
- }
- ++i;
- }
- if (filter == 0)
- {
- vty_out(vty, "Invalid filter \"%s\" specified,"
- " must contain at least one of 'RWTEXB'%s",
- argv[idx_filter]->arg, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ int idx = 0;
+
+ if (argv_find (argv, argc, "FILTER", &idx)) {
+ filter = parse_filter (argv[idx]->arg);
+ if (!filter) {
+ vty_outln(vty, "Invalid filter \"%s\" specified; must contain at least"
+ "one of 'RWTEXB'%s", argv[idx]->arg);
+ return CMD_WARNING;
}
+ }
cpu_record_clear (filter);
return CMD_SUCCESS;
install_element (VIEW_NODE, &show_thread_cpu_cmd);
install_element (ENABLE_NODE, &clear_thread_cpu_cmd);
}
+/* CLI end ------------------------------------------------------------------ */
+
static int
thread_timer_cmp(void *a, void *b)
thread->index = actual_position;
}
+static void
+cancelreq_del (void *cr)
+{
+ XFREE (MTYPE_TMP, cr);
+}
+
+/* initializer, only ever called once */
+static void initializer ()
+{
+ if (!masters)
+ masters = list_new();
+
+ pthread_key_create (&thread_current, NULL);
+}
+
/* Allocate new thread master. */
struct thread_master *
-thread_master_create (void)
+thread_master_create (const char *name)
{
struct thread_master *rv;
struct rlimit limit;
- getrlimit(RLIMIT_NOFILE, &limit);
-
- pthread_mutex_lock (&cpu_record_mtx);
- {
- if (cpu_record == NULL)
- cpu_record = hash_create ((unsigned int (*) (void *))cpu_record_hash_key,
- (int (*) (const void *, const void *))
- cpu_record_hash_cmp);
- }
- pthread_mutex_unlock (&cpu_record_mtx);
+ pthread_once (&init_once, &initializer);
rv = XCALLOC (MTYPE_THREAD_MASTER, sizeof (struct thread_master));
if (rv == NULL)
return NULL;
+ /* Initialize master mutex */
pthread_mutex_init (&rv->mtx, NULL);
+ pthread_cond_init (&rv->cancel_cond, NULL);
+
+ /* Set name */
+ rv->name = name ? XSTRDUP (MTYPE_THREAD_MASTER, name) : NULL;
+ /* Initialize I/O task data structures */
+ getrlimit(RLIMIT_NOFILE, &limit);
rv->fd_limit = (int)limit.rlim_cur;
rv->read = XCALLOC (MTYPE_THREAD, sizeof (struct thread *) * rv->fd_limit);
if (rv->read == NULL)
XFREE (MTYPE_THREAD_MASTER, rv);
return NULL;
}
-
rv->write = XCALLOC (MTYPE_THREAD, sizeof (struct thread *) * rv->fd_limit);
if (rv->write == NULL)
{
return NULL;
}
+ rv->cpu_record = hash_create ((unsigned int (*) (void *))cpu_record_hash_key,
+ (int (*) (const void *, const void *))
+ cpu_record_hash_cmp);
+
+
/* Initialize the timer queues */
rv->timer = pqueue_create();
rv->timer->cmp = thread_timer_cmp;
rv->timer->update = thread_timer_update;
+
+ /* Initialize thread_fetch() settings */
rv->spin = true;
rv->handle_signals = true;
+
+ /* Set pthread owner, should be updated by actual owner */
rv->owner = pthread_self();
+ rv->cancel_req = list_new ();
+ rv->cancel_req->del = cancelreq_del;
+ rv->canceled = true;
+
+ /* Initialize pipe poker */
pipe (rv->io_pipe);
set_nonblocking (rv->io_pipe[0]);
set_nonblocking (rv->io_pipe[1]);
+ /* Initialize data structures for poll() */
rv->handler.pfdsize = rv->fd_limit;
rv->handler.pfdcount = 0;
rv->handler.pfds = XCALLOC (MTYPE_THREAD_MASTER,
rv->handler.copy = XCALLOC (MTYPE_THREAD_MASTER,
sizeof (struct pollfd) * rv->handler.pfdsize);
+ /* add to list */
+ pthread_mutex_lock (&masters_mtx);
+ {
+ listnode_add (masters, rv);
+ }
+ pthread_mutex_unlock (&masters_mtx);
+
return rv;
}
pthread_mutex_destroy (&m->mtx);
close (m->io_pipe[0]);
close (m->io_pipe[1]);
+ list_delete (m->cancel_req);
+
+ hash_clean (m->cpu_record, cpu_record_hash_free);
+ hash_free (m->cpu_record);
+ m->cpu_record = NULL;
XFREE (MTYPE_THREAD_MASTER, m->handler.pfds);
XFREE (MTYPE_THREAD_MASTER, m->handler.copy);
XFREE (MTYPE_THREAD_MASTER, m);
-
- pthread_mutex_lock (&cpu_record_mtx);
- {
- if (cpu_record)
- {
- hash_clean (cpu_record, cpu_record_hash_free);
- hash_free (cpu_record);
- cpu_record = NULL;
- }
- }
- pthread_mutex_unlock (&cpu_record_mtx);
}
/* Return remain time in second. */
{
tmp.func = func;
tmp.funcname = funcname;
- pthread_mutex_lock (&cpu_record_mtx);
- {
- thread->hist = hash_get (cpu_record, &tmp,
- (void * (*) (void *))cpu_record_hash_alloc);
- }
- pthread_mutex_unlock (&cpu_record_mtx);
+ thread->hist = hash_get (m->cpu_record, &tmp,
+ (void * (*) (void *))cpu_record_hash_alloc);
}
thread->hist->total_active++;
thread->func = func;
static int
fd_poll (struct thread_master *m, struct pollfd *pfds, nfds_t pfdsize,
- nfds_t count, struct timeval *timer_wait)
+ nfds_t count, const struct timeval *timer_wait)
{
/* If timer_wait is null here, that means poll() should block indefinitely,
* unless the thread_master has overriden it by setting ->selectpoll_timeout.
num = poll (pfds, count + 1, timeout);
- static unsigned char trash[64];
+ unsigned char trash[64];
if (num > 0 && pfds[count].revents != 0 && num--)
while (read (m->io_pipe[0], &trash, sizeof (trash)) > 0);
return thread;
}
+/* Thread cancellation ------------------------------------------------------ */
+
+/**
+ * NOT's out the .events field of pollfd corresponding to the given file
+ * descriptor. The event to be NOT'd is passed in the 'state' parameter.
+ *
+ * This needs to happen for both copies of pollfd's. See 'thread_fetch'
+ * implementation for details.
+ *
+ * @param master
+ * @param fd
+ * @param state the event to cancel. One or more (OR'd together) of the
+ * following:
+ * - POLLIN
+ * - POLLOUT
+ */
static void
-thread_cancel_read_or_write (struct thread *thread, short int state)
+thread_cancel_rw (struct thread_master *master, int fd, short state)
{
- for (nfds_t i = 0; i < thread->master->handler.pfdcount; ++i)
- if (thread->master->handler.pfds[i].fd == thread->u.fd)
- {
- thread->master->handler.pfds[i].events &= ~(state);
+ /* Cancel POLLHUP too just in case some bozo set it */
+ state |= POLLHUP;
- /* remove thread fds from pfd list */
- if (thread->master->handler.pfds[i].events == 0)
- {
- memmove(thread->master->handler.pfds+i,
- thread->master->handler.pfds+i+1,
- (thread->master->handler.pfdsize-i-1) * sizeof(struct pollfd));
- thread->master->handler.pfdcount--;
- return;
- }
- }
+ /* find the index of corresponding pollfd */
+ nfds_t i;
+
+ for (i = 0; i < master->handler.pfdcount; i++)
+ if (master->handler.pfds[i].fd == fd)
+ break;
+
+ /* NOT out event. */
+ master->handler.pfds[i].events &= ~(state);
+
+ /* If all events are canceled, delete / resize the pollfd array. */
+ if (master->handler.pfds[i].events == 0)
+ {
+ memmove(master->handler.pfds + i, master->handler.pfds + i + 1,
+ (master->handler.pfdcount - i - 1) * sizeof (struct pollfd));
+ master->handler.pfdcount--;
+ }
+
+ /* If we have the same pollfd in the copy, perform the same operations,
+ * otherwise return. */
+ if (i >= master->handler.copycount)
+ return;
+
+ master->handler.copy[i].events &= ~(state);
+
+ if (master->handler.copy[i].events == 0)
+ {
+ memmove(master->handler.copy + i, master->handler.copy + i + 1,
+ (master->handler.copycount - i - 1) * sizeof (struct pollfd));
+ master->handler.copycount--;
+ }
}
/**
- * Cancel thread from scheduler.
+ * Process cancellation requests.
*
- * This function is *NOT* MT-safe. DO NOT call it from any other pthread except
- * the one which owns thread->master. You will crash.
+ * This may only be run from the pthread which owns the thread_master.
+ *
+ * @param master the thread master to process
+ * @REQUIRE master->mtx
*/
-void
-thread_cancel (struct thread *thread)
+static void
+do_thread_cancel (struct thread_master *master)
{
struct thread_list *list = NULL;
struct pqueue *queue = NULL;
struct thread **thread_array = NULL;
+ struct thread *thread;
- pthread_mutex_lock (&thread->mtx);
- pthread_mutex_lock (&thread->master->mtx);
+ struct cancel_req *cr;
+ struct listnode *ln;
+ for (ALL_LIST_ELEMENTS_RO (master->cancel_req, ln, cr))
+ {
+ /* If this is an event object cancellation, linear search through event
+ * list deleting any events which have the specified argument. We also
+ * need to check every thread in the ready queue. */
+ if (cr->eventobj)
+ {
+ struct thread *t;
+ thread = master->event.head;
+
+ while (thread)
+ {
+ t = thread;
+ thread = t->next;
+
+ if (t->arg == cr->eventobj)
+ {
+ thread_list_delete (&master->event, t);
+ if (t->ref)
+ *t->ref = NULL;
+ thread_add_unuse (master, t);
+ }
+ }
- assert (pthread_self() == thread->master->owner);
+ thread = master->ready.head;
+ while (thread)
+ {
+ t = thread;
+ thread = t->next;
+
+ if (t->arg == cr->eventobj)
+ {
+ thread_list_delete (&master->ready, t);
+ if (t->ref)
+ *t->ref = NULL;
+ thread_add_unuse (master, t);
+ }
+ }
+ continue;
+ }
- switch (thread->type)
- {
- case THREAD_READ:
- thread_cancel_read_or_write (thread, POLLIN | POLLHUP);
- thread_array = thread->master->read;
- break;
- case THREAD_WRITE:
- thread_cancel_read_or_write (thread, POLLOUT | POLLHUP);
- thread_array = thread->master->write;
- break;
- case THREAD_TIMER:
- queue = thread->master->timer;
- break;
- case THREAD_EVENT:
- list = &thread->master->event;
- break;
- case THREAD_READY:
- list = &thread->master->ready;
- break;
- default:
- goto done;
- break;
- }
+ /* The pointer varies depending on whether the cancellation request was
+ * made asynchronously or not. If it was, we need to check whether the
+ * thread even exists anymore before cancelling it. */
+ thread = (cr->thread) ? cr->thread : *cr->threadref;
- if (queue)
- {
- assert(thread->index >= 0);
- pqueue_remove (thread, queue);
- }
- else if (list)
- {
- thread_list_delete (list, thread);
- }
- else if (thread_array)
- {
- thread_array[thread->u.fd] = NULL;
- }
- else
- {
- assert(!"Thread should be either in queue or list or array!");
+ if (!thread)
+ continue;
+
+ /* Determine the appropriate queue to cancel the thread from */
+ switch (thread->type)
+ {
+ case THREAD_READ:
+ thread_cancel_rw (master, thread->u.fd, POLLIN);
+ thread_array = master->read;
+ break;
+ case THREAD_WRITE:
+ thread_cancel_rw (master, thread->u.fd, POLLOUT);
+ thread_array = master->write;
+ break;
+ case THREAD_TIMER:
+ queue = master->timer;
+ break;
+ case THREAD_EVENT:
+ list = &master->event;
+ break;
+ case THREAD_READY:
+ list = &master->ready;
+ break;
+ default:
+ continue;
+ break;
+ }
+
+ if (queue)
+ {
+ assert(thread->index >= 0);
+ pqueue_remove (thread, queue);
+ }
+ else if (list)
+ {
+ thread_list_delete (list, thread);
+ }
+ else if (thread_array)
+ {
+ thread_array[thread->u.fd] = NULL;
+ }
+ else
+ {
+ assert(!"Thread should be either in queue or list or array!");
+ }
+
+ if (thread->ref)
+ *thread->ref = NULL;
+
+ thread_add_unuse (thread->master, thread);
}
- if (thread->ref)
- *thread->ref = NULL;
+ /* Delete and free all cancellation requests */
+ list_delete_all_node (master->cancel_req);
+
+ /* Wake up any threads which may be blocked in thread_cancel_async() */
+ master->canceled = true;
+ pthread_cond_broadcast (&master->cancel_cond);
+}
- thread_add_unuse (thread->master, thread);
+/**
+ * Cancel any events which have the specified argument.
+ *
+ * MT-Unsafe
+ *
+ * @param m the thread_master to cancel from
+ * @param arg the argument passed when creating the event
+ */
+void
+thread_cancel_event (struct thread_master *master, void *arg)
+{
+ assert (master->owner == pthread_self());
-done:
+ pthread_mutex_lock (&master->mtx);
+ {
+ struct cancel_req *cr = XCALLOC (MTYPE_TMP, sizeof (struct cancel_req));
+ cr->eventobj = arg;
+ listnode_add (master->cancel_req, cr);
+ do_thread_cancel(master);
+ }
+ pthread_mutex_unlock (&master->mtx);
+}
+
+/**
+ * Cancel a specific task.
+ *
+ * MT-Unsafe
+ *
+ * @param thread task to cancel
+ */
+void
+thread_cancel (struct thread *thread)
+{
+ assert (thread->master->owner == pthread_self());
+
+ pthread_mutex_lock (&thread->master->mtx);
+ {
+ struct cancel_req *cr = XCALLOC (MTYPE_TMP, sizeof (struct cancel_req));
+ cr->thread = thread;
+ listnode_add (thread->master->cancel_req, cr);
+ do_thread_cancel (thread->master);
+ }
pthread_mutex_unlock (&thread->master->mtx);
- pthread_mutex_unlock (&thread->mtx);
}
-/* Delete all events which has argument value arg. */
-unsigned int
-thread_cancel_event (struct thread_master *m, void *arg)
+/**
+ * Asynchronous cancellation.
+ *
+ * Called with either a struct thread ** or void * to an event argument,
+ * this function posts the correct cancellation request and blocks until it is
+ * serviced.
+ *
+ * If the thread is currently running, execution blocks until it completes.
+ *
+ * The last two parameters are mutually exclusive, i.e. if you pass one the
+ * other must be NULL.
+ *
+ * When the cancellation procedure executes on the target thread_master, the
+ * thread * provided is checked for nullity. If it is null, the thread is
+ * assumed to no longer exist and the cancellation request is a no-op. Thus
+ * users of this API must pass a back-reference when scheduling the original
+ * task.
+ *
+ * MT-Safe
+ *
+ * @param master the thread master with the relevant event / task
+ * @param thread pointer to thread to cancel
+ * @param eventobj the event
+ */
+void
+thread_cancel_async (struct thread_master *master, struct thread **thread,
+ void *eventobj)
{
- unsigned int ret = 0;
- struct thread *thread;
- struct thread *t;
+ assert (!(thread && eventobj) && (thread || eventobj));
+ assert (master->owner != pthread_self());
- pthread_mutex_lock (&m->mtx);
+ pthread_mutex_lock (&master->mtx);
{
- thread = m->event.head;
- while (thread)
- {
- t = thread;
- pthread_mutex_lock (&t->mtx);
- {
- thread = t->next;
+ master->canceled = false;
- if (t->arg == arg)
- {
- ret++;
- thread_list_delete (&m->event, t);
- if (t->ref)
- *t->ref = NULL;
- thread_add_unuse (m, t);
- }
- }
- pthread_mutex_unlock (&t->mtx);
+ if (thread)
+ {
+ struct cancel_req *cr =
+ XCALLOC (MTYPE_TMP, sizeof (struct cancel_req));
+ cr->threadref = thread;
+ listnode_add (master->cancel_req, cr);
}
-
- /* thread can be on the ready list too */
- thread = m->ready.head;
- while (thread)
+ else if (eventobj)
{
- t = thread;
- pthread_mutex_lock (&t->mtx);
- {
- thread = t->next;
-
- if (t->arg == arg)
- {
- ret++;
- thread_list_delete (&m->ready, t);
- if (t->ref)
- *t->ref = NULL;
- thread_add_unuse (m, t);
- }
- }
- pthread_mutex_unlock (&t->mtx);
+ struct cancel_req *cr =
+ XCALLOC (MTYPE_TMP, sizeof (struct cancel_req));
+ cr->eventobj = eventobj;
+ listnode_add (master->cancel_req, cr);
}
+ AWAKEN (master);
+
+ while (!master->canceled)
+ pthread_cond_wait (&master->cancel_cond, &master->mtx);
}
- pthread_mutex_unlock (&m->mtx);
- return ret;
+ pthread_mutex_unlock (&master->mtx);
}
+/* ------------------------------------------------------------------------- */
static struct timeval *
thread_timer_wait (struct pqueue *queue, struct timeval *timer_val)
return 1;
}
+/**
+ * Process I/O events.
+ *
+ * Walks through file descriptor array looking for those pollfds whose .revents
+ * field has something interesting. Deletes any invalid file descriptors.
+ *
+ * @param m the thread master
+ * @param num the number of active file descriptors (return value of poll())
+ */
static void
-thread_process_io (struct thread_master *m, struct pollfd *pfds,
- unsigned int num, unsigned int count)
+thread_process_io (struct thread_master *m, unsigned int num)
{
unsigned int ready = 0;
+ struct pollfd *pfds = m->handler.copy;
- for (nfds_t i = 0; i < count && ready < num ; ++i)
+ for (nfds_t i = 0; i < m->handler.copycount && ready < num ; ++i)
{
/* no event for current fd? immediately continue */
if (pfds[i].revents == 0)
m->handler.pfdcount--;
memmove (pfds + i, pfds + i + 1,
- (count - i - 1) * sizeof(struct pollfd));
- count--;
+ (m->handler.copycount - i - 1) * sizeof(struct pollfd));
+ m->handler.copycount--;
+
i--;
}
}
struct thread *
thread_fetch (struct thread_master *m, struct thread *fetch)
{
- struct thread *thread;
+ struct thread *thread = NULL;
struct timeval now;
- struct timeval timer_val = { .tv_sec = 0, .tv_usec = 0 };
- struct timeval *timer_wait = &timer_val;
+ struct timeval zerotime = { 0, 0 };
+ struct timeval tv;
+ struct timeval *tw = NULL;
+
+ int num = 0;
+
+ do {
+ /* Handle signals if any */
+ if (m->handle_signals)
+ quagga_sigevent_process ();
+
+ pthread_mutex_lock (&m->mtx);
+
+ /* Process any pending cancellation requests */
+ do_thread_cancel (m);
+
+ /* Post events to ready queue. This must come before the following block
+ * since events should occur immediately */
+ thread_process (&m->event);
+
+ /* If there are no tasks on the ready queue, we will poll() until a timer
+ * expires or we receive I/O, whichever comes first. The strategy for doing
+ * this is:
+ *
+ * - If there are events pending, set the poll() timeout to zero
+ * - If there are no events pending, but there are timers pending, set the
+ * timeout to the smallest remaining time on any timer
+ * - If there are neither timers nor events pending, but there are file
+ * descriptors pending, block indefinitely in poll()
+ * - If nothing is pending, it's time for the application to die
+ *
+ * In every case except the last, we need to hit poll() at least once per
+ * loop to avoid starvation by events */
+
+ if (m->ready.count == 0)
+ tw = thread_timer_wait (m->timer, &tv);
+
+ if (m->ready.count != 0 || (tw && !timercmp (tw, &zerotime, >)))
+ tw = &zerotime;
+
+ if (!tw && m->handler.pfdcount == 0)
+ { /* die */
+ pthread_mutex_unlock (&m->mtx);
+ fetch = NULL;
+ break;
+ }
- do
+ /* Copy pollfd array + # active pollfds in it. Not necessary to copy
+ * the array size as this is fixed. */
+ m->handler.copycount = m->handler.pfdcount;
+ memcpy (m->handler.copy, m->handler.pfds,
+ m->handler.copycount * sizeof (struct pollfd));
+
+ pthread_mutex_unlock (&m->mtx);
{
- int num = 0;
+ num = fd_poll (m, m->handler.copy, m->handler.pfdsize,
+ m->handler.copycount, tw);
+ }
+ pthread_mutex_lock (&m->mtx);
- /* Signals pre-empt everything */
- if (m->handle_signals)
- quagga_sigevent_process ();
-
- pthread_mutex_lock (&m->mtx);
- /* Drain the ready queue of already scheduled jobs, before scheduling
- * more.
- */
- if ((thread = thread_trim_head (&m->ready)) != NULL)
- {
- fetch = thread_run (m, thread, fetch);
- if (fetch->ref)
- *fetch->ref = NULL;
- pthread_mutex_unlock (&m->mtx);
- return fetch;
- }
-
- /* To be fair to all kinds of threads, and avoid starvation, we
- * need to be careful to consider all thread types for scheduling
- * in each quanta. I.e. we should not return early from here on.
- */
-
- /* Normal event are the next highest priority. */
- thread_process (&m->event);
-
- /* Calculate select wait timer if nothing else to do */
- if (m->ready.count == 0)
- {
- timer_wait = thread_timer_wait (m->timer, &timer_val);
- }
+ /* Handle any errors received in poll() */
+ if (num < 0)
+ {
+ if (errno == EINTR)
+ {
+ pthread_mutex_unlock (&m->mtx);
+ continue; /* loop around to signal handler */
+ }
- if (timer_wait && timer_wait->tv_sec < 0)
- {
- timerclear(&timer_val);
- timer_wait = &timer_val;
- }
+ /* else die */
+ zlog_warn ("poll() error: %s", safe_strerror (errno));
+ pthread_mutex_unlock (&m->mtx);
+ fetch = NULL;
+ break;
+ }
- unsigned int count = m->handler.pfdcount + m->handler.pfdcountsnmp;
- memcpy (m->handler.copy, m->handler.pfds, count * sizeof (struct pollfd));
+ /* Since we could have received more cancellation requests during poll(), process those */
+ do_thread_cancel (m);
- pthread_mutex_unlock (&m->mtx);
+ /* Post timers to ready queue. */
+ monotime(&now);
+ thread_process_timers (m->timer, &now);
+
+ /* Post I/O to ready queue. */
+ if (num > 0)
+ thread_process_io (m, num);
+
+ /* If we have a ready task, break the loop and return it to the caller */
+ if ((thread = thread_trim_head (&m->ready)))
{
- num = fd_poll (m, m->handler.copy, m->handler.pfdsize, count, timer_wait);
+ fetch = thread_run (m, thread, fetch);
+ if (fetch->ref)
+ *fetch->ref = NULL;
}
- pthread_mutex_lock (&m->mtx);
- /* Signals should get quick treatment */
- if (num < 0)
- {
- if (errno == EINTR)
- {
- pthread_mutex_unlock (&m->mtx);
- continue; /* signal received - process it */
- }
- zlog_warn ("poll() error: %s", safe_strerror (errno));
- pthread_mutex_unlock (&m->mtx);
- return NULL;
- }
+ pthread_mutex_unlock (&m->mtx);
- /* Check foreground timers. Historically, they have had higher
- * priority than I/O threads, so let's push them onto the ready
- * list in front of the I/O threads. */
- monotime(&now);
- thread_process_timers (m->timer, &now);
-
- /* Got IO, process it */
- if (num > 0)
- thread_process_io (m, m->handler.copy, num, count);
-
- if ((thread = thread_trim_head (&m->ready)) != NULL)
- {
- fetch = thread_run (m, thread, fetch);
- if (fetch->ref)
- *fetch->ref = NULL;
- pthread_mutex_unlock (&m->mtx);
- return fetch;
- }
+ } while (!thread && m->spin);
- pthread_mutex_unlock (&m->mtx);
-
- } while (m->spin);
+ return fetch;
+}
- return NULL;
+static unsigned long
+timeval_elapsed (struct timeval a, struct timeval b)
+{
+ return (((a.tv_sec - b.tv_sec) * TIMER_SECOND_MICRO)
+ + (a.tv_usec - b.tv_usec));
}
unsigned long
getrusage(RUSAGE_SELF, &(r->cpu));
}
-struct thread *thread_current = NULL;
-
/* We check thread consumed time. If the system has getrusage, we'll
use that to get in-depth stats on the performance of the thread in addition
to wall clock time stats from gettimeofday. */
GETRUSAGE (&before);
thread->real = before.real;
- thread_current = thread;
+ pthread_setspecific (thread_current, thread);
(*thread->func) (thread);
- thread_current = NULL;
+ pthread_setspecific (thread_current, NULL);
GETRUSAGE (&after);
tmp.func = dummy.func = func;
tmp.funcname = dummy.funcname = funcname;
- pthread_mutex_lock (&cpu_record_mtx);
- {
- dummy.hist = hash_get (cpu_record, &tmp,
- (void * (*) (void *))cpu_record_hash_alloc);
- }
- pthread_mutex_unlock (&cpu_record_mtx);
+ dummy.hist = hash_get (m->cpu_record, &tmp,
+ (void * (*) (void *))cpu_record_hash_alloc);
dummy.schedfrom = schedfrom;
dummy.schedfrom_line = fromln;
struct fd_handler
{
- /* number of pfd stored in pfds */
- nfds_t pfdcount;
- /* number of pfd stored in pfds + number of snmp pfd */
- nfds_t pfdcountsnmp;
- /* number of pfd that fit in the allocated space of pfds */
+ /* number of pfd that fit in the allocated space of pfds. This is a constant
+ * and is the same for both pfds and copy. */
nfds_t pfdsize;
+
/* file descriptors to monitor for i/o */
struct pollfd *pfds;
+ /* number of pollfds stored in pfds */
+ nfds_t pfdcount;
+
/* chunk used for temp copy of pollfds */
struct pollfd *copy;
+ /* number of pollfds stored in copy */
+ nfds_t copycount;
+};
+
+struct cancel_req {
+ struct thread *thread;
+ void *eventobj;
+ struct thread **threadref;
};
/* Master of the theads. */
struct thread_master
{
+ char *name;
+
struct thread **read;
struct thread **write;
struct pqueue *timer;
struct thread_list event;
struct thread_list ready;
struct thread_list unuse;
+ struct list *cancel_req;
+ bool canceled;
+ pthread_cond_t cancel_cond;
+ struct hash *cpu_record;
int io_pipe[2];
int fd_limit;
struct fd_handler handler;
#define thread_execute(m,f,a,v) funcname_thread_execute(m,f,a,v,#f,__FILE__,__LINE__)
/* Prototypes. */
-extern struct thread_master *thread_master_create (void);
+extern struct thread_master *thread_master_create (const char *);
extern void thread_master_free (struct thread_master *);
extern void thread_master_free_unused(struct thread_master *);
#undef debugargdef
extern void thread_cancel (struct thread *);
-extern unsigned int thread_cancel_event (struct thread_master *, void *);
+extern void thread_cancel_async (struct thread_master *, struct thread **, void *);
+extern void thread_cancel_event (struct thread_master *, void *);
extern struct thread *thread_fetch (struct thread_master *, struct thread *);
extern void thread_call (struct thread *);
extern unsigned long thread_timer_remain_second (struct thread *);
unsigned long *cpu_time_elapsed);
/* only for use in logging functions! */
-extern struct thread *thread_current;
+extern pthread_key_t thread_current;
#endif /* _ZEBRA_THREAD_H */
{
vty_out (vty, "%% VRF name %s is invalid: length exceeds "
"%d characters%s",
- vrfname, VRF_NAMSIZ, VTY_NEWLINE);
+ vrfname, VRF_NAMSIZ, VTYNL);
return CMD_WARNING;
}
if (vrfp == NULL)
{
- vty_out (vty, "%% VRF %s does not exist%s", vrfname, VTY_NEWLINE);
+ vty_out (vty, "%% VRF %s does not exist%s", vrfname, VTYNL);
return CMD_WARNING;
}
if (CHECK_FLAG (vrfp->status, VRF_ACTIVE))
{
vty_out (vty, "%% Only inactive VRFs can be deleted%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
vrf_write_host (struct vty *vty)
{
if (debug_vrf)
- vty_out (vty, "debug vrf%s", VTY_NEWLINE);
+ vty_outln (vty, "debug vrf");
return 1;
}
struct vrf *vrf; \
if (!(vrf = vrf_lookup_by_name(NAME))) \
{ \
- vty_out (vty, "%% VRF %s not found%s", NAME, VTY_NEWLINE);\
+ vty_out (vty, "%% VRF %s not found%s", NAME, VTYNL);\
return CMD_WARNING; \
} \
if (vrf->vrf_id == VRF_UNKNOWN) \
{ \
- vty_out (vty, "%% VRF %s not active%s", NAME, VTY_NEWLINE);\
+ vty_out (vty, "%% VRF %s not active%s", NAME, VTYNL);\
return CMD_WARNING; \
} \
(V) = vrf->vrf_id; \
static int do_log_commands = 0;
-/* VTY standard output function. */
-int
-vty_out (struct vty *vty, const char *format, ...)
+static int
+vty_out_variadic (struct vty *vty, const char *format, va_list args)
{
- va_list args;
int len = 0;
int size = 1024;
char buf[1024];
char *p = NULL;
+ va_list cp;
if (vty_shell (vty))
- {
- va_start (args, format);
- vprintf (format, args);
- va_end (args);
- }
+ vprintf (format, args);
else
{
/* Try to write to initial buffer. */
- va_start (args, format);
+ va_copy (cp, args);
len = vsnprintf (buf, sizeof(buf), format, args);
- va_end (args);
+ va_end (cp);
/* Initial buffer is not enough. */
if (len < 0 || len >= size)
if (! p)
return -1;
- va_start (args, format);
len = vsnprintf (p, size, format, args);
- va_end (args);
if (len > -1 && len < size)
break;
return len;
}
+/* VTY standard output function. */
+int
+vty_out (struct vty *vty, const char *format, ...)
+{
+ int len;
+ va_list args;
+
+ va_start (args, format);
+ len = vty_out_variadic (vty, format, args);
+ va_end (args);
+
+ return len;
+}
+
+int
+vty_outln (struct vty *vty, const char *format, ...)
+{
+ int len;
+ va_list args;
+
+ va_start (args, format);
+ len = vty_out_variadic (vty, format, args);
+ va_end (args);
+
+ return len + vty_out (vty, "%s", VTYNL);
+}
static int
vty_log_out (struct vty *vty, const char *level, const char *proto_str,
for (s = buf + strlen (buf); (s > buf) && isspace ((int)*(s - 1));
s--);
*s = '\0';
- vty_out (vty, "%s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, "%s", buf);
}
fclose (f);
}
else
- vty_out (vty, "MOTD file not found%s", VTY_NEWLINE);
+ vty_outln (vty, "MOTD file not found");
}
else if (host.motd)
vty_out (vty, "%s", host.motd);
{
if (vty->node == AUTH_NODE)
{
- vty_out (vty, "%% Bad passwords, too many failures!%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Bad passwords, too many failures!");
vty->status = VTY_CLOSE;
}
else
{
/* AUTH_ENABLE_NODE */
vty->fail = 0;
- vty_out (vty, "%% Bad enable passwords, too many failures!%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Bad enable passwords, too many failures!");
vty->status = VTY_CLOSE;
}
}
{
case CMD_WARNING:
if (vty->type == VTY_FILE)
- vty_out (vty, "Warning...%s", VTY_NEWLINE);
+ vty_outln (vty, "Warning...");
break;
case CMD_ERR_AMBIGUOUS:
- vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Ambiguous command.");
break;
case CMD_ERR_NO_MATCH:
- vty_out (vty, "%% [%s] Unknown command: %s%s", protocolname, buf, VTY_NEWLINE);
+ vty_outln (vty, "%% [%s] Unknown command: %s", protocolname, buf);
break;
case CMD_ERR_INCOMPLETE:
- vty_out (vty, "%% Command incomplete.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Command incomplete.");
break;
}
cmd_free_strvec (vline);
static void
vty_down_level (struct vty *vty)
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
cmd_exit (vty);
vty_prompt (vty);
vty->cp = 0;
static void
vty_end_config (struct vty *vty)
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
switch (vty->node)
{
cmd_free_strvec (vline);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
switch (ret)
{
case CMD_ERR_AMBIGUOUS:
- vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Ambiguous command.");
vty_prompt (vty);
vty_redraw_line (vty);
break;
case CMD_ERR_NO_MATCH:
- /* vty_out (vty, "%% There is no matched command.%s", VTY_NEWLINE); */
+ /* vty_out (vty, "%% There is no matched command.%s", VTYNL); */
vty_prompt (vty);
vty_redraw_line (vty);
break;
if (!matched[0])
{
/* 2016-11-28 equinox -- need to debug, SEGV here */
- vty_out (vty, "%% CLI BUG: FULL_MATCH with NULL str%s", VTY_NEWLINE);
+ vty_outln (vty, "%% CLI BUG: FULL_MATCH with NULL str");
vty_prompt (vty);
vty_redraw_line (vty);
break;
for (i = 0; matched[i] != NULL; i++)
{
if (i != 0 && ((i % 6) == 0))
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, "%-10s ", matched[i]);
XFREE (MTYPE_COMPLETION, matched[i]);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_prompt (vty);
vty_redraw_line (vty);
if (desc_width <= 0)
{
- vty_out (vty, " %-*s %s%s", cmd_width, cmd, token->desc, VTY_NEWLINE);
+ vty_outln (vty, " %-*s %s", cmd_width, cmd, token->desc);
return;
}
strncpy (buf, p, pos);
buf[pos] = '\0';
- vty_out (vty, " %-*s %s%s", cmd_width, cmd, buf, VTY_NEWLINE);
+ vty_outln (vty, " %-*s %s", cmd_width, cmd, buf);
cmd = "";
}
- vty_out (vty, " %-*s %s%s", cmd_width, cmd, p, VTY_NEWLINE);
+ vty_outln (vty, " %-*s %s", cmd_width, cmd, p);
XFREE (MTYPE_TMP, buf);
}
describe = cmd_describe_command (vline, vty, &ret);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
/* Ambiguous error. */
switch (ret)
{
case CMD_ERR_AMBIGUOUS:
- vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Ambiguous command.");
goto out;
break;
case CMD_ERR_NO_MATCH:
- vty_out (vty, "%% There is no matched command.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% There is no matched command.");
goto out;
break;
}
}
if (!token->desc)
- vty_out (vty, " %-s%s",
- token->text,
- VTY_NEWLINE);
+ vty_outln (vty, " %-s",
+ token->text);
else if (desc_width >= strlen (token->desc))
- vty_out (vty, " %-*s %s%s", width,
+ vty_outln (vty, " %-*s %s", width,
token->text,
- token->desc, VTY_NEWLINE);
+ token->desc);
else
vty_describe_fold (vty, width, desc_width, token);
vty_out(vty, " %s", item);
XFREE(MTYPE_COMPLETION, item);
}
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
vector_free(varcomps);
}
#if 0
vty_out (vty, " %-*s %s%s", width
desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
- desc->str ? desc->str : "", VTY_NEWLINE);
+ desc->str ? desc->str : "", VTYNL);
#endif /* 0 */
}
if ((token = token_cr))
{
if (!token->desc)
- vty_out (vty, " %-s%s",
- token->text,
- VTY_NEWLINE);
+ vty_outln (vty, " %-s",
+ token->text);
else if (desc_width >= strlen (token->desc))
- vty_out (vty, " %-*s %s%s", width,
+ vty_outln (vty, " %-*s %s", width,
token->text,
- token->desc, VTY_NEWLINE);
+ token->desc);
else
vty_describe_fold (vty, width, desc_width, token);
}
{
vty->cp = vty->length = 0;
vty_clear_buf (vty);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
switch (vty->node)
{
vty_out (vty, "SE ");
break;
case TELOPT_ECHO:
- vty_out (vty, "TELOPT_ECHO %s", VTY_NEWLINE);
+ vty_outln (vty, "TELOPT_ECHO ");
break;
case TELOPT_SGA:
- vty_out (vty, "TELOPT_SGA %s", VTY_NEWLINE);
+ vty_outln (vty, "TELOPT_SGA ");
break;
case TELOPT_NAWS:
- vty_out (vty, "TELOPT_NAWS %s", VTY_NEWLINE);
+ vty_outln (vty, "TELOPT_NAWS ");
break;
default:
vty_out (vty, "%x ", buf[i]);
break;
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
#endif /* TELNET_OPTION_DEBUG */
vty->width = ((vty->sb_buf[1] << 8)|vty->sb_buf[2]);
vty->height = ((vty->sb_buf[3] << 8)|vty->sb_buf[4]);
#ifdef TELNET_OPTION_DEBUG
- vty_out(vty, "TELNET NAWS window size negotiation completed: "
- "width %d, height %d%s",
- vty->width, vty->height, VTY_NEWLINE);
+ vty_outln (vty, "TELNET NAWS window size negotiation completed: "
+ "width %d, height %d",
+ vty->width, vty->height);
#endif
}
break;
break;
case '\n':
case '\r':
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_execute (vty);
break;
case '\t':
/* Vty is not available if password isn't set. */
if (host.password == NULL && host.password_encrypt == NULL)
{
- vty_out (vty, "Vty password is not set.%s", VTY_NEWLINE);
+ vty_outln (vty, "Vty password is not set.");
vty->status = VTY_CLOSE;
vty_close (vty);
return NULL;
/* Say hello to the world. */
vty_hello (vty);
if (! no_password_check)
- vty_out (vty, "%sUser Access Verification%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "%sUser Access Verification%s", VTYNL,
+ VTYNL);
/* Setting up terminal. */
vty_will_echo (vty);
/* Clear command line buffer. */
vty->cp = vty->length = 0;
vty_clear_buf (vty);
- vty_out (vty, "%% Command is too long.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Command is too long.");
}
else
{
}
}
- vty_event (VTYSH_READ, sock, vty);
+ if (vty->status == VTY_CLOSE)
+ vty_close (vty);
+ else
+ vty_event (VTYSH_READ, sock, vty);
return 0;
}
/* Clear buffer*/
buffer_reset (vty->obuf);
- vty_out (vty, "%sVty connection is timed out.%s", VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "%sVty connection is timed out.", VTYNL);
/* Close connection. */
vty->status = VTY_CLOSE;
if ((v = vector_slot (vtyvec, i)) != NULL)
vty_out (vty, "%svty[%d] connected from %s.%s",
v->config ? "*" : " ",
- i, v->address, VTY_NEWLINE);
+ i, v->address, VTYNL);
return CMD_SUCCESS;
}
const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL;
if (! vty_accesslist_name || (argc == 3 && strcmp(vty_accesslist_name, accesslist)))
{
- vty_out (vty, "Access-class is not currently applied to vty%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Access-class is not currently applied to vty");
return CMD_WARNING;
}
if (! vty_ipv6_accesslist_name ||
(argc == 4 && strcmp(vty_ipv6_accesslist_name, accesslist)))
{
- vty_out (vty, "IPv6 access-class is not currently applied to vty%s",
- VTY_NEWLINE);
+ vty_outln (vty,"IPv6 access-class is not currently applied to vty");
return CMD_WARNING;
}
}
if (vty->hist[index] != NULL)
- vty_out (vty, " %s%s", vty->hist[index], VTY_NEWLINE);
+ vty_out (vty, " %s%s", vty->hist[index], VTYNL);
index++;
}
static int
vty_config_write (struct vty *vty)
{
- vty_out (vty, "line vty%s", VTY_NEWLINE);
+ vty_outln (vty, "line vty");
if (vty_accesslist_name)
- vty_out (vty, " access-class %s%s",
- vty_accesslist_name, VTY_NEWLINE);
+ vty_outln (vty, " access-class %s",
+ vty_accesslist_name);
if (vty_ipv6_accesslist_name)
- vty_out (vty, " ipv6 access-class %s%s",
- vty_ipv6_accesslist_name, VTY_NEWLINE);
+ vty_outln (vty, " ipv6 access-class %s",
+ vty_ipv6_accesslist_name);
/* exec-timeout */
if (vty_timeout_val != VTY_TIMEOUT_DEFAULT)
- vty_out (vty, " exec-timeout %ld %ld%s",
+ vty_outln (vty, " exec-timeout %ld %ld",
vty_timeout_val / 60,
- vty_timeout_val % 60, VTY_NEWLINE);
+ vty_timeout_val % 60);
/* login */
if (no_password_check)
- vty_out (vty, " no login%s", VTY_NEWLINE);
+ vty_outln (vty, " no login");
if (do_log_commands)
- vty_out (vty, "log commands%s", VTY_NEWLINE);
+ vty_outln (vty, "log commands");
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
return CMD_SUCCESS;
}
#define VTY_CHECK_CONTEXT(ptr) \
if (!ptr) { \
vty_out (vty, "Current configuration object was deleted " \
- "by another process.%s", VTY_NEWLINE); \
+ "by another process.%s", VTYNL); \
return CMD_WARNING; \
}
#define INTEGRATE_DEFAULT_CONFIG "frr.conf"
/* Small macro to determine newline is newline only or linefeed needed. */
-#define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\n")
+#define VTYNL ((vty->type == VTY_TERM) ? "\r\n" : "\n")
/* Default time out value */
#define VTY_TIMEOUT_DEFAULT 600
#define PRINTF_ATTRIBUTE(a,b)
#endif /* __GNUC__ */
-/* Utility macros to convert VTY argument to unsigned long */
-#define VTY_GET_ULONG(NAME,V,STR) \
-do { \
- char *endptr = NULL; \
- errno = 0; \
- (V) = strtoul ((STR), &endptr, 10); \
- if (*(STR) == '-') \
- { \
- vty_out (vty, "%% Invalid %s value (dash)%s", NAME, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
- if (*endptr != '\0') \
- { \
- vty_out (vty, "%% Invalid %s value (%s)%s", NAME, endptr, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
- if (errno) \
- { \
- vty_out (vty, "%% Invalid %s value (error %d)%s", NAME, errno, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
-} while (0)
-
-/* Utility macros to convert VTY argument to unsigned long long */
-#define VTY_GET_ULL(NAME,V,STR) \
-do { \
- char *endptr = NULL; \
- errno = 0; \
- (V) = strtoull ((STR), &endptr, 10); \
- if (*(STR) == '-') \
- { \
- vty_out (vty, "%% Invalid %s value (dash)%s", NAME, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
- if (*endptr != '\0') \
- { \
- vty_out (vty, "%% Invalid %s value (%s)%s", NAME, endptr, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
- if (errno) \
- { \
- vty_out (vty, "%% Invalid %s value (error %d)%s", NAME, errno, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
-} while (0)
-
-/*
- * The logic below ((TMPL) <= ((MIN) && (TMPL) != (MIN)) is
- * done to circumvent the compiler complaining about
- * comparing unsigned numbers against zero, if MIN is zero.
- * NB: The compiler isn't smart enough to supress the warning
- * if you write (MIN) != 0 && tmpl < (MIN).
- */
-#define VTY_GET_INTEGER_RANGE_HEART(NAME,TMPL,STR,MIN,MAX) \
-do { \
- VTY_GET_ULONG(NAME, (TMPL), STR); \
- if ( ((TMPL) <= (MIN) && (TMPL) != (MIN)) || (TMPL) > (MAX) ) \
- { \
- vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE);\
- return CMD_WARNING; \
- } \
-} while (0)
-
-#define VTY_GET_INTEGER_RANGE(NAME,V,STR,MIN,MAX) \
-do { \
- unsigned long long tmpl; \
- VTY_GET_INTEGER_RANGE_HEART(NAME,tmpl,STR,MIN,MAX); \
- (V) = tmpl; \
-} while (0)
-
-#define VTY_CHECK_INTEGER_RANGE(NAME,STR,MIN,MAX) \
-do { \
- unsigned long tmpl; \
- VTY_GET_INTEGER_RANGE_HEART(NAME,tmpl,STR,MIN,MAX); \
-} while (0)
-
-#define VTY_GET_INTEGER(NAME,V,STR) \
- VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)
-
-#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \
-do { \
- int retv; \
- retv = inet_aton ((STR), &(V)); \
- if (!retv) \
- { \
- vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
-} while (0)
-
-#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \
-do { \
- int retv; \
- retv = str2prefix_ipv4 ((STR), &(V)); \
- if (retv <= 0) \
- { \
- vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
- return CMD_WARNING; \
- } \
-} while (0)
-
-#define VTY_WARN_EXPERIMENTAL() \
-do { \
- vty_out (vty, "%% WARNING: this command is experimental. Both its name and" \
- " parameters may%s%% change in a future version of Quagga," \
- " possibly breaking your configuration!%s", \
- VTY_NEWLINE, VTY_NEWLINE); \
-} while (0)
-
/* Exported variables */
extern char integrate_default[];
extern struct vty *vty_new (void);
extern struct vty *vty_stdio (void (*atclose)(void));
extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
+extern int vty_outln (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
extern void vty_read_config (const char *, char *);
extern void vty_time_print (struct vty *, int);
extern void vty_serv_sock (const char *, unsigned short, const char *);
struct listnode *node;
struct work_queue *wq;
- vty_out (vty,
- "%c %8s %5s %8s %8s %21s%s",
- ' ', "List","(ms) ","Q. Runs","Yields","Cycle Counts ",
- VTY_NEWLINE);
- vty_out (vty,
- "%c %8s %5s %8s %8s %7s %6s %8s %6s %s%s",
+ vty_outln (vty,
+ "%c %8s %5s %8s %8s %21s",
+ ' ', "List","(ms) ","Q. Runs","Yields","Cycle Counts ");
+ vty_outln (vty,
+ "%c %8s %5s %8s %8s %7s %6s %8s %6s %s",
'P',
"Items",
"Hold",
"Total","Total",
"Best","Gran.","Total","Avg.",
- "Name",
- VTY_NEWLINE);
+ "Name");
for (ALL_LIST_ELEMENTS_RO (work_queues, node, wq))
{
- vty_out (vty,"%c %8d %5d %8ld %8ld %7d %6d %8ld %6u %s%s",
+ vty_outln (vty,"%c %8d %5d %8ld %8ld %7d %6d %8ld %6u %s",
(CHECK_FLAG (wq->flags, WQ_UNPLUGGED) ? ' ' : 'P'),
listcount (wq->items),
wq->spec.hold,
wq->cycles.best, wq->cycles.granularity, wq->cycles.total,
(wq->runs) ?
(unsigned int) (wq->cycles.total / wq->runs) : 0,
- wq->name,
- VTY_NEWLINE);
+ wq->name);
}
return CMD_SUCCESS;
void nhrp_zebra_terminate(void)
{
zclient_stop(zclient);
+ zclient_free(zclient);
route_table_finish(zebra_rib[AFI_IP]);
route_table_finish(zebra_rib[AFI_IP6]);
}
snprintf(buf, sizeof(buf), "Unknown error %d", ret);
}
- vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
+ vty_outln (vty, "%% %s", str);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
- vty_out(vty, "%% Invalid value %s%s", name, VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid value %s", name);
return CMD_WARNING;
}
{
int i;
- vty_out(vty, "NHRP debugging status:%s", VTY_NEWLINE);
+ vty_outln (vty, "NHRP debugging status:");
for (i = 0; debug_flags_desc[i].str != NULL; i++) {
if (debug_flags_desc[i].key == NHRP_DEBUG_ALL)
if (!(debug_flags_desc[i].key & debug_flags))
continue;
- vty_out(vty, " NHRP %s debugging is on%s",
- debug_flags_desc[i].str, VTY_NEWLINE);
+ vty_outln (vty, " NHRP %s debugging is on",
+ debug_flags_desc[i].str);
}
return CMD_SUCCESS;
{
#ifndef NO_DEBUG
if (debug_flags == NHRP_DEBUG_ALL) {
- vty_out(vty, "debug nhrp all%s", VTY_NEWLINE);
+ vty_outln (vty, "debug nhrp all");
} else {
int i;
continue;
if (!(debug_flags & debug_flags_desc[i].key))
continue;
- vty_out(vty, "debug nhrp %s%s", debug_flags_desc[i].str, VTY_NEWLINE);
+ vty_outln (vty, "debug nhrp %s",
+ debug_flags_desc[i].str);
}
}
- vty_out(vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
#endif /* NO_DEBUG */
if (nhrp_event_socket_path) {
- vty_out(vty, "nhrp event socket %s%s",
- nhrp_event_socket_path, VTY_NEWLINE);
+ vty_outln (vty, "nhrp event socket %s",
+ nhrp_event_socket_path);
}
if (netlink_nflog_group) {
- vty_out(vty, "nhrp nflog-group %d%s",
- netlink_nflog_group, VTY_NEWLINE);
+ vty_outln (vty, "nhrp nflog-group %d",
+ netlink_nflog_group);
}
return 0;
{
uint32_t nfgroup;
- VTY_GET_INTEGER_RANGE("nflog-group", nfgroup, argv[2]->arg, 1, 65535);
+ nfgroup = strtoul(argv[2]->arg, NULL, 10);
netlink_set_nflog_group(nfgroup);
return CMD_SUCCESS;
struct nhrp_interface *nifp = ifp->info;
afi_t afi = cmd_to_afi(argv[0]);
- VTY_GET_INTEGER_RANGE("network-id", nifp->afi[afi].network_id, argv[3]->arg, 1, 4294967295);
+ nifp->afi[afi].network_id = strtoul(argv[3]->arg, NULL, 10);
nhrp_interface_update(ifp);
return CMD_SUCCESS;
struct nhrp_interface *nifp = ifp->info;
afi_t afi = cmd_to_afi(argv[0]);
- VTY_GET_INTEGER_RANGE("holdtime", nifp->afi[afi].holdtime, argv[3]->arg, 1, 65000);
+ nifp->afi[afi].holdtime = strtoul(argv[3]->arg, NULL, 10);
nhrp_interface_update(ifp);
return CMD_SUCCESS;
if (argv[3]->arg[0] == 'o') {
nifp->afi[AFI_IP].configured_mtu = -1;
} else {
- VTY_GET_INTEGER_RANGE("mtu", nifp->afi[AFI_IP].configured_mtu, argv[3]->arg, 576, 1500);
+ nifp->afi[AFI_IP].configured_mtu = strtoul(argv[3]->arg, NULL,
+ 10);
}
nhrp_interface_update_mtu(ifp, AFI_IP);
return nhrp_vty_return(vty, NHRP_ERR_FAIL);
c->map = 1;
- if (strcmp(argv[4]->text, "local") == 0) {
+ if (strmatch(argv[4]->text, "local")) {
nhrp_cache_update_binding(c, NHRP_CACHE_LOCAL, 0, NULL, 0, NULL);
} else{
if (str2sockunion(argv[4]->arg, &nbma_addr) < 0)
return;
if (!ctx->count) {
- vty_out(vty, "%-8s %-8s %-24s %-24s %-6s %s%s",
+ vty_outln (vty, "%-8s %-8s %-24s %-24s %-6s %s",
"Iface",
"Type",
"Protocol",
"NBMA",
"Flags",
- "Identity",
- VTY_NEWLINE);
+ "Identity");
}
ctx->count++;
- vty_out(ctx->vty, "%-8s %-8s %-24s %-24s %c%c%c %s%s",
+ vty_outln(ctx->vty, "%-8s %-8s %-24s %-24s %c%c%c %s",
c->ifp->name,
nhrp_cache_type_str[c->cur.type],
sockunion2str(&c->remote_addr, buf[0], sizeof buf[0]),
c->used ? 'U' : ' ',
c->t_timeout ? 'T' : ' ',
c->t_auth ? 'A' : ' ',
- c->cur.peer ? c->cur.peer->vc->remote.id : "-",
- VTY_NEWLINE);
+ c->cur.peer ? c->cur.peer->vc->remote.id : "-");
}
static void show_ip_nhrp_nhs(struct nhrp_nhs *n, struct nhrp_registration *reg, void *pctx)
char buf[2][SU_ADDRSTRLEN];
if (!ctx->count) {
- vty_out(vty, "%-8s %-24s %-16s %-16s%s",
+ vty_outln (vty, "%-8s %-24s %-16s %-16s",
"Iface",
"FQDN",
"NBMA",
- "Protocol",
- VTY_NEWLINE);
+ "Protocol");
}
ctx->count++;
- vty_out(vty, "%-8s %-24s %-16s %-16s%s",
- n->ifp->name,
- n->nbma_fqdn,
- (reg && reg->peer) ? sockunion2str(®->peer->vc->remote.nbma, buf[0], sizeof buf[0]) : "-",
- sockunion2str(reg ? ®->proto_addr : &n->proto_addr, buf[1], sizeof buf[1]),
- VTY_NEWLINE);
+ vty_outln (vty, "%-8s %-24s %-16s %-16s",
+ n->ifp->name,
+ n->nbma_fqdn,
+ (reg && reg->peer) ? sockunion2str(®->peer->vc->remote.nbma,
+ buf[0], sizeof buf[0])
+ : "-",
+ sockunion2str(reg ? ®->proto_addr : &n->proto_addr,
+ buf[1], sizeof buf[1]));
}
static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
char buf1[PREFIX_STRLEN], buf2[SU_ADDRSTRLEN];
if (!ctx->count) {
- vty_out(vty, "%-8s %-24s %-24s %s%s",
+ vty_outln (vty, "%-8s %-24s %-24s %s",
"Type",
"Prefix",
"Via",
- "Identity",
- VTY_NEWLINE);
+ "Identity");
}
ctx->count++;
c = s->cache;
- vty_out(ctx->vty, "%-8s %-24s %-24s %s%s",
+ vty_outln(ctx->vty, "%-8s %-24s %-24s %s",
nhrp_cache_type_str[s->type],
prefix2str(s->p, buf1, sizeof buf1),
c ? sockunion2str(&c->remote_addr, buf2, sizeof buf2) : "",
- (c && c->cur.peer) ? c->cur.peer->vc->remote.id : "",
- VTY_NEWLINE);
+ (c && c->cur.peer) ? c->cur.peer->vc->remote.id : "");
}
static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
if (ctx->afi != family2afi(sockunion_family(&c->remote_addr)))
return;
- vty_out(ctx->vty,
- "Type: %s%s"
- "Flags:%s%s%s"
- "Protocol-Address: %s/%zu%s",
- nhrp_cache_type_str[c->cur.type],
- VTY_NEWLINE,
- (c->cur.peer && c->cur.peer->online) ? " up": "",
- c->used ? " used": "",
- VTY_NEWLINE,
- sockunion2str(&c->remote_addr, buf, sizeof buf),
- 8 * family2addrsize(sockunion_family(&c->remote_addr)),
- VTY_NEWLINE);
+ vty_outln(ctx->vty,
+ "Type: %s%s"
+ "Flags:%s%s%s"
+ "Protocol-Address: %s/%zu",
+ nhrp_cache_type_str[c->cur.type],
+ VTYNL,
+ (c->cur.peer && c->cur.peer->online) ? " up": "",
+ c->used ? " used": "",
+ VTYNL,
+ sockunion2str(&c->remote_addr, buf, sizeof buf),
+ 8 * family2addrsize(sockunion_family(&c->remote_addr)));
if (c->cur.peer) {
- vty_out(ctx->vty,
- "NBMA-Address: %s%s",
- sockunion2str(&c->cur.peer->vc->remote.nbma, buf, sizeof buf),
- VTY_NEWLINE);
+ vty_outln(ctx->vty,
+ "NBMA-Address: %s",
+ sockunion2str(&c->cur.peer->vc->remote.nbma,
+ buf, sizeof buf));
}
if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC) {
- vty_out(ctx->vty,
- "NBMA-NAT-OA-Address: %s%s",
- sockunion2str(&c->cur.remote_nbma_natoa, buf, sizeof buf),
- VTY_NEWLINE);
+ vty_outln(ctx->vty,
+ "NBMA-NAT-OA-Address: %s",
+ sockunion2str(&c->cur.remote_nbma_natoa, buf, sizeof buf));
}
- vty_out(ctx->vty, "%s", VTY_NEWLINE);
+ vty_outln(ctx->vty, VTYNL);
}
DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
} else if (argv[3]->text[0] == 's') {
nhrp_shortcut_foreach(ctx.afi, show_ip_nhrp_shortcut, &ctx);
} else {
- vty_out(vty, "Status: ok%s%s", VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "Status: ok%s", VTYNL);
ctx.count++;
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx);
}
if (!ctx.count) {
- vty_out(vty, "%% No entries%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No entries");
return CMD_WARNING;
}
struct vty *vty = ctx;
char buf[2][SU_ADDRSTRLEN];
- vty_out(vty, "%-24s %-24s %c %-4d %-24s%s",
+ vty_outln (vty, "%-24s %-24s %c %-4d %-24s",
sockunion2str(&vc->local.nbma, buf[0], sizeof buf[0]),
sockunion2str(&vc->remote.nbma, buf[1], sizeof buf[1]),
notifier_active(&vc->notifier_list) ? 'n' : ' ',
vc->ipsec,
- vc->remote.id,
- VTY_NEWLINE);
+ vc->remote.id);
}
DEFUN(show_dmvpn, show_dmvpn_cmd,
SHOW_STR
"DMVPN information\n")
{
- vty_out(vty, "%-24s %-24s %-6s %-4s %-24s%s",
+ vty_outln (vty, "%-24s %-24s %-6s %-4s %-24s",
"Src",
"Dst",
"Flags",
"SAs",
- "Identity",
- VTY_NEWLINE);
+ "Identity");
nhrp_vc_foreach(show_dmvpn_entry, vty);
}
if (!ctx.count) {
- vty_out(vty, "%% No entries%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No entries");
return CMD_WARNING;
}
- vty_out(vty, "%% %d entries cleared%s", ctx.count, VTY_NEWLINE);
+ vty_outln (vty, "%% %d entries cleared", ctx.count);
return CMD_SUCCESS;
}
if (!c->map) return;
if (sockunion_family(&c->remote_addr) != ctx->family) return;
- vty_out(vty, " %s nhrp map %s %s%s",
+ vty_outln (vty, " %s nhrp map %s %s",
ctx->aficmd,
sockunion2str(&c->remote_addr, buf[0], sizeof buf[0]),
- c->cur.type == NHRP_CACHE_LOCAL ? "local" :
- sockunion2str(&c->cur.peer->vc->remote.nbma, buf[1], sizeof buf[1]),
- VTY_NEWLINE);
+ c->cur.type == NHRP_CACHE_LOCAL ? "local" : sockunion2str(&c->cur.peer->vc->remote.nbma, buf[1], sizeof buf[1]));
}
static int interface_config_write(struct vty *vty)
int i;
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);
nifp = ifp->info;
if (nifp->ipsec_profile) {
if (nifp->ipsec_fallback_profile)
vty_out(vty, " fallback-profile %s",
nifp->ipsec_fallback_profile);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (nifp->source)
- vty_out(vty, " tunnel source %s%s",
- nifp->source, VTY_NEWLINE);
+ vty_outln (vty, " tunnel source %s",
+ nifp->source);
for (afi = 0; afi < AFI_MAX; afi++) {
struct nhrp_afi_data *ad = &nifp->afi[afi];
aficmd = afi_to_cmd(afi);
if (ad->network_id)
- vty_out(vty, " %s nhrp network-id %u%s",
- aficmd, ad->network_id,
- VTY_NEWLINE);
+ vty_outln (vty, " %s nhrp network-id %u",
+ aficmd,ad->network_id);
if (ad->holdtime != NHRPD_DEFAULT_HOLDTIME)
- vty_out(vty, " %s nhrp holdtime %u%s",
- aficmd, ad->holdtime,
- VTY_NEWLINE);
+ vty_outln (vty, " %s nhrp holdtime %u",
+ aficmd,ad->holdtime);
if (ad->configured_mtu < 0)
- vty_out(vty, " %s nhrp mtu opennhrp%s",
- aficmd, VTY_NEWLINE);
+ vty_outln (vty, " %s nhrp mtu opennhrp",
+ aficmd);
else if (ad->configured_mtu)
- vty_out(vty, " %s nhrp mtu %u%s",
- aficmd, ad->configured_mtu,
- VTY_NEWLINE);
+ vty_outln (vty, " %s nhrp mtu %u",
+ aficmd,ad->configured_mtu);
for (i = 0; interface_flags_desc[i].str != NULL; i++) {
if (!(ad->flags & interface_flags_desc[i].key))
continue;
- vty_out(vty, " %s nhrp %s%s",
- aficmd, interface_flags_desc[i].str, VTY_NEWLINE);
+ vty_outln (vty, " %s nhrp %s",
+ aficmd, interface_flags_desc[i].str);
}
mapctx = (struct write_map_ctx) {
nhrp_cache_foreach(ifp, interface_config_write_nhrp_map, &mapctx);
list_for_each_entry(nhs, &ad->nhslist_head, nhslist_entry) {
- vty_out(vty, " %s nhrp nhs %s nbma %s%s",
+ vty_outln (vty, " %s nhrp nhs %s nbma %s",
aficmd,
sockunion_family(&nhs->proto_addr) == AF_UNSPEC ? "dynamic" : sockunion2str(&nhs->proto_addr, buf, sizeof buf),
- nhs->nbma_fqdn,
- VTY_NEWLINE);
+ nhs->nbma_fqdn);
}
}
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
}
return 0;
result = monotime_since(&oa->ts_spf, NULL);
if (result/TIMER_SECOND_MICRO > 0)
{
- vty_out (vty, "SPF last executed %ld.%lds ago%s",
+ vty_outln (vty, "SPF last executed %ld.%lds ago",
result/TIMER_SECOND_MICRO,
- result%TIMER_SECOND_MICRO, VTY_NEWLINE);
+ result % TIMER_SECOND_MICRO);
}
else
{
- vty_out (vty, "SPF last executed %ldus ago%s",
- result, VTY_NEWLINE);
+ vty_outln (vty, "SPF last executed %ldus ago",
+ result);
}
}
else
- vty_out (vty, "SPF has not been run%s", VTY_NEWLINE);
+ vty_outln (vty, "SPF has not been run");
}
}
else
{
- VTY_GET_INTEGER_RANGE ("cost", cost, argv[5]->arg, 0, OSPF_LS_INFINITY);
+ cost = strtoul(argv[5]->arg, NULL, 10);
UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
}
}
if (!ospf6_area_stub_set (ospf6, area))
{
- vty_out (vty, "First deconfigure all virtual link through this area%s",
- VTY_NEWLINE);
+ vty_outln (vty,"First deconfigure all virtual link through this area");
return CMD_WARNING;
}
if (!ospf6_area_stub_set (ospf6, area))
{
- vty_out (vty, "First deconfigure all virtual link through this area%s",
- VTY_NEWLINE);
+ vty_outln (vty,"First deconfigure all virtual link through this area");
return CMD_WARNING;
}
bfd_info = (struct bfd_info *)oi->bfd_info;
if (CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG))
- vty_out (vty, " ipv6 ospf6 bfd %d %d %d%s",
+ vty_outln (vty, " ipv6 ospf6 bfd %d %d %d",
bfd_info->detect_mult, bfd_info->required_min_rx,
- bfd_info->desired_min_tx, VTY_NEWLINE);
+ bfd_info->desired_min_tx);
else
- vty_out (vty, " ipv6 ospf6 bfd%s", VTY_NEWLINE);
+ vty_outln (vty, " ipv6 ospf6 bfd");
}
/*
oi->state = OSPF6_INTERFACE_DOWN;
oi->flag = 0;
oi->mtu_ignore = 0;
+ oi->c_ifmtu = 0;
/* Try to adjust I/O buffer size with IfMtu */
oi->ifmtu = ifp->mtu6;
ospf6_interface_state_update (struct interface *ifp)
{
struct ospf6_interface *oi;
+ unsigned int iobuflen;
oi = (struct ospf6_interface *) ifp->info;
if (oi == NULL)
if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE))
return;
+ /* Adjust the mtu values if the kernel told us something new */
+ if (ifp->mtu6 != oi->ifmtu)
+ {
+ /* If nothing configured, accept it and check for buffer size */
+ if (!oi->c_ifmtu)
+ {
+ oi->ifmtu = ifp->mtu6;
+ iobuflen = ospf6_iobuf_size (ifp->mtu6);
+ if (oi->ifmtu > iobuflen)
+ {
+ if (IS_OSPF6_DEBUG_INTERFACE)
+ zlog_debug ("Interface %s: IfMtu is adjusted to I/O buffer size: %d.",
+ ifp->name, iobuflen);
+ oi->ifmtu = iobuflen;
+ }
+ }
+ else if (oi->c_ifmtu > ifp->mtu6)
+ {
+ oi->ifmtu = ifp->mtu6;
+ zlog_warn ("Configured mtu %u on %s overridden by kernel %u",
+ oi->c_ifmtu, ifp->name, ifp->mtu6);
+ }
+ else
+ oi->ifmtu = oi->c_ifmtu;
+ }
+
if (if_is_operative (ifp)
&& (ospf6_interface_get_linklocal_address(oi->interface)
|| if_is_loopback(oi->interface)))
ifmtu = strtol (argv[idx_number]->arg, NULL, 10);
- if (oi->ifmtu == ifmtu)
+ if (oi->c_ifmtu == ifmtu)
return CMD_SUCCESS;
if (ifp->mtu6 != 0 && ifp->mtu6 < ifmtu)
{
vty_out (vty, "%s's ifmtu is adjusted to I/O buffer size (%d).%s",
ifp->name, iobuflen, VNL);
- oi->ifmtu = iobuflen;
+ oi->ifmtu = oi->c_ifmtu = iobuflen;
}
else
- oi->ifmtu = ifmtu;
+ oi->ifmtu = oi->c_ifmtu = ifmtu;
}
else
- oi->ifmtu = ifmtu;
+ oi->ifmtu = oi->c_ifmtu = ifmtu;
/* re-establish adjacencies */
for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
DEFUN (no_ipv6_ospf6_ifmtu,
no_ipv6_ospf6_ifmtu_cmd,
- "no ipv6 ospf6 ifmtu",
+ "no ipv6 ospf6 ifmtu [(1-65535)]",
NO_STR
IP6_STR
OSPF6_STR
"Interface MTU\n"
+ "OSPFv3 Interface MTU\n"
)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
else
oi->ifmtu = ifp->mtu;
+ oi->c_ifmtu = 0;
+
/* re-establish adjacencies */
for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
{
refbw = strtol (argv[idx_number]->arg, NULL, 10);
if (refbw < 1 || refbw > 4294967)
{
- vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
+ vty_outln (vty, "reference-bandwidth value is invalid");
return CMD_WARNING;
}
if (ifp->desc)
vty_out (vty, " description %s%s", ifp->desc, VNL);
- if (ifp->mtu6 != oi->ifmtu)
- vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->ifmtu, VNL);
+ if (oi->c_ifmtu)
+ vty_out (vty, " ipv6 ospf6 ifmtu %d%s", oi->c_ifmtu, VNL);
if (CHECK_FLAG (oi->flag, OSPF6_INTERFACE_NOAUTOCOST))
vty_out (vty, " ipv6 ospf6 cost %d%s",
/* I/F MTU */
u_int32_t ifmtu;
+ /* Configured MTU */
+ u_int32_t c_ifmtu;
+
/* Interface State */
u_char state;
if (argc == 5)
{
- if (! strcmp (argv[idx_type]->text, "originate"))
+ if (strmatch(argv[idx_type]->text, "originate"))
SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE);
- else if (! strcmp (argv[idx_type]->text, "examine"))
+ else if (strmatch(argv[idx_type]->text, "examine"))
SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN);
- else if (! strcmp (argv[idx_type]->text, "flooding"))
+ else if (strmatch(argv[idx_type]->text, "flooding"))
SET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD);
}
else
if (argc == 6)
{
- if (! strcmp (argv[idx_type]->text, "originate"))
+ if (strmatch(argv[idx_type]->text, "originate"))
UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE);
- if (! strcmp (argv[idx_type]->text, "examine"))
+ if (strmatch(argv[idx_type]->text, "examine"))
UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN);
- if (! strcmp (argv[idx_type]->text, "flooding"))
+ if (strmatch(argv[idx_type]->text, "flooding"))
UNSET_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD);
}
else
cmd_terminate ();
if (zclient)
- zclient_free (zclient);
+ {
+ zclient_stop (zclient);
+ zclient_free (zclient);
+ }
if (master)
thread_master_free (master);
for (i = argc_start; i < argc; i++)
{
- if (! strcmp (argv[i]->arg, "summary"))
+ if (strmatch(argv[i]->text, "summary"))
{
summary++;
continue;
}
- if (! strcmp (argv[i]->arg, "intra-area"))
+ if (strmatch(argv[i]->text, "intra-area"))
{
type = OSPF6_PATH_TYPE_INTRA;
continue;
}
- if (! strcmp (argv[i]->arg, "inter-area"))
+ if (strmatch(argv[i]->text, "inter-area"))
{
type = OSPF6_PATH_TYPE_INTER;
continue;
}
- if (! strcmp (argv[i]->arg, "external-1"))
+ if (strmatch(argv[i]->text, "external-1"))
{
type = OSPF6_PATH_TYPE_EXTERNAL1;
continue;
}
- if (! strcmp (argv[i]->arg, "external-2"))
+ if (strmatch(argv[i]->text, "external-2"))
{
type = OSPF6_PATH_TYPE_EXTERNAL2;
continue;
}
- if (! strcmp (argv[i]->arg, "detail"))
+ if (strmatch(argv[i]->text, "detail"))
{
detail++;
continue;
}
- if (! strcmp (argv[i]->arg, "match"))
+ if (strmatch(argv[i]->text, "match"))
{
match++;
continue;
for (i = idx_ipv4; i < argc; i++)
{
- if (! strcmp (argv[i]->arg, "detail"))
+ if (strmatch(argv[i]->text, "detail"))
{
detail++;
continue;
int idx_number_3 = 5;
unsigned int delay, hold, max;
- VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000);
- VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000);
- VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000);
+ delay = strtoul(argv[idx_number]->arg, NULL, 10);
+ hold = strtoul(argv[idx_number_2]->arg, NULL, 10);
+ max = strtoul(argv[idx_number_3]->arg, NULL, 10);
return ospf6_timers_spf_set (vty, delay, hold, max);
}
if (ospf6->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
ospf6->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT ||
ospf6->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT)
- vty_out (vty, " timers throttle spf %d %d %d%s",
+ vty_outln (vty, " timers throttle spf %d %d %d",
ospf6->spf_delay, ospf6->spf_holdtime,
- ospf6->spf_max_holdtime, VTY_NEWLINE);
+ ospf6->spf_max_holdtime);
}
int idx_number = 3;
unsigned int minarrival;
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg);
+ minarrival = strtoul(argv[idx_number]->arg, NULL, 10);
ospf->lsa_minarrival = minarrival;
return CMD_SUCCESS;
if (argc == 5)
{
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg);
+ minarrival = strtoul(argv[idx_number]->arg, NULL, 10);
if (ospf->lsa_minarrival != minarrival ||
minarrival == OSPF_MIN_LS_ARRIVAL)
/* Redistribute configuration */
/* XXX */
- vty_out (vty, " LSA minimum arrival %d msecs%s", o->lsa_minarrival,
- VTY_NEWLINE);
+ vty_outln (vty, " LSA minimum arrival %d msecs",o->lsa_minarrival);
/* Show SPF parameters */
vty_out(vty, " Initial SPF scheduling delay %d millisec(s)%s"
if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES))
{
if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_DETAIL))
- vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE);
+ vty_outln (vty, " All adjacency changes are logged");
else
- vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE);
+ vty_outln (vty, " Adjacency changes are logged");
}
- vty_out (vty, "%s",VTY_NEWLINE);
+ vty_out (vty, VTYNL);
for (ALL_LIST_ELEMENTS_RO (o->area_list, n, oa))
ospf6_area_show (vty, oa);
struct ospf6_distance *odistance;
if (ospf6->distance_all)
- vty_out (vty, " distance %u%s", ospf6->distance_all, VTY_NEWLINE);
+ vty_outln (vty, " distance %u", ospf6->distance_all);
if (ospf6->distance_intra
|| ospf6->distance_inter
if (ospf6->distance_external)
vty_out (vty, " external %u", ospf6->distance_external);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
for (rn = route_top (ospf6->distance_table); rn; rn = route_next (rn))
{
char buf[PREFIX_STRLEN];
- vty_out (vty, " distance %u %s %s%s", odistance->distance,
+ vty_outln (vty, " distance %u %s %s", odistance->distance,
prefix2str (&rn->p, buf, sizeof (buf)),
- odistance->access_list ? odistance->access_list : "",
- VTY_NEWLINE);
+ odistance->access_list ? odistance->access_list : "");
}
return 0;
}
if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES))
{
if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL))
- vty_out(vty, " log-adjacency-changes detail%s", VTY_NEWLINE);
+ vty_outln (vty, " log-adjacency-changes detail");
else if (!DFLT_OSPF6_LOG_ADJACENCY_CHANGES)
- vty_out(vty, " log-adjacency-changes%s", VTY_NEWLINE);
+ vty_outln (vty, " log-adjacency-changes");
}
else if (DFLT_OSPF6_LOG_ADJACENCY_CHANGES)
{
- vty_out(vty, " no log-adjacency-changes%s", VTY_NEWLINE);
+ vty_outln (vty, " no log-adjacency-changes");
}
if (ospf6->ref_bandwidth != OSPF6_REFERENCE_BANDWIDTH)
/* LSA timers print. */
if (ospf6->lsa_minarrival != OSPF_MIN_LS_ARRIVAL)
- vty_out (vty, " timers lsa min-arrival %d%s", ospf6->lsa_minarrival,
- VTY_NEWLINE);
+ vty_outln (vty, " timers lsa min-arrival %d",ospf6->lsa_minarrival);
ospf6_stub_router_config_write (vty);
ospf6_redistribute_config_write (vty);
ret = str2prefix_ipv6 (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
ret = str2prefix_ipv6 (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
rn = route_node_lookup (o->distance_table, (struct prefix *) &p);
if (!rn)
{
- vty_out (vty, "Cant't find specified prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Cant't find specified prefix");
return CMD_WARNING;
}
#define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
#define OSPF6_LS_ID_STR "Specify Link State ID\n"
-#define VNL VTY_NEWLINE
+#define VNL VTYNL
#define OSPF6_CMD_CHECK_RUNNING() \
if (ospf6 == NULL) \
{ \
- vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE); \
+ vty_out (vty, "OSPFv3 is not running%s", VTYNL); \
return CMD_SUCCESS; \
}
/* Initialization */
zprivs_init (&ospfd_privs);
- master = thread_master_create ();
+ master = thread_master_create(NULL);
/* Open connection to OSPF daemon */
oclient = ospf_apiclient_connect (args[1], ASYNCPORT);
if (vty != NULL)
{
int i;
- vty_out (vty, " Added using OSPF API: %u octets of opaque data %s%s",
+ vty_outln (vty, " Added using OSPF API: %u octets of opaque data %s",
opaquelen,
- VALID_OPAQUE_INFO_LEN (lsa->data) ? "" : "(Invalid length?)",
- VTY_NEWLINE);
+ VALID_OPAQUE_INFO_LEN(lsa->data) ? "" : "(Invalid length?)");
vty_out (vty, " Opaque data: ");
for (i = 0; i < opaquelen; i++)
{
vty_out (vty, "0x%x ", olsa->data[i]);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
else
{
bfd_info = (struct bfd_info *)params->bfd_info;
if (CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG))
- vty_out (vty, " ip ospf bfd %d %d %d%s",
+ vty_outln (vty, " ip ospf bfd %d %d %d",
bfd_info->detect_mult, bfd_info->required_min_rx,
- bfd_info->desired_min_tx, VTY_NEWLINE);
+ bfd_info->desired_min_tx);
else
- vty_out (vty, " ip ospf bfd%s", VTY_NEWLINE);
+ vty_outln (vty, " ip ospf bfd");
}
/*
int idx_number = 2;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 3;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 2;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 3;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 2;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 3;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 2;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 3;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 2;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int idx_number = 3;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf_lookup_instance (instance))
return CMD_SUCCESS;
int i;
if (ospf->instance)
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "%sOSPF Instance: %d%s", VTYNL, ospf->instance,
+ VTYNL);
- vty_out (vty, "OSPF debugging status:%s", VTY_NEWLINE);
+ vty_outln (vty, "OSPF debugging status:");
/* Show debug status for events. */
if (IS_DEBUG_OSPF(event,EVENT))
- vty_out (vty, " OSPF event debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF event debugging is on");
/* Show debug status for ISM. */
if (IS_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
- vty_out (vty, " OSPF ISM debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF ISM debugging is on");
else
{
if (IS_DEBUG_OSPF (ism, ISM_STATUS))
- vty_out (vty, " OSPF ISM status debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF ISM status debugging is on");
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
- vty_out (vty, " OSPF ISM event debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF ISM event debugging is on");
if (IS_DEBUG_OSPF (ism, ISM_TIMERS))
- vty_out (vty, " OSPF ISM timer debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF ISM timer debugging is on");
}
/* Show debug status for NSM. */
if (IS_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
- vty_out (vty, " OSPF NSM debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF NSM debugging is on");
else
{
if (IS_DEBUG_OSPF (nsm, NSM_STATUS))
- vty_out (vty, " OSPF NSM status debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF NSM status debugging is on");
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
- vty_out (vty, " OSPF NSM event debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF NSM event debugging is on");
if (IS_DEBUG_OSPF (nsm, NSM_TIMERS))
- vty_out (vty, " OSPF NSM timer debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF NSM timer debugging is on");
}
/* Show debug status for OSPF Packets. */
for (i = 0; i < 5; i++)
if (IS_DEBUG_OSPF_PACKET (i, SEND) && IS_DEBUG_OSPF_PACKET (i, RECV))
{
- vty_out (vty, " OSPF packet %s%s debugging is on%s",
- lookup_msg(ospf_packet_type_str, i + 1, NULL),
- IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
- VTY_NEWLINE);
+ vty_outln (vty, " OSPF packet %s%s debugging is on",
+ lookup_msg(ospf_packet_type_str, i + 1, NULL),
+ IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "");
}
else
{
if (IS_DEBUG_OSPF_PACKET (i, SEND))
- vty_out (vty, " OSPF packet %s send%s debugging is on%s",
- lookup_msg(ospf_packet_type_str, i + 1, NULL),
- IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
- VTY_NEWLINE);
+ vty_outln (vty, " OSPF packet %s send%s debugging is on",
+ lookup_msg(ospf_packet_type_str, i + 1, NULL),
+ IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "");
if (IS_DEBUG_OSPF_PACKET (i, RECV))
- vty_out (vty, " OSPF packet %s receive%s debugging is on%s",
- lookup_msg(ospf_packet_type_str, i + 1, NULL),
- IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "",
- VTY_NEWLINE);
+ vty_outln (vty, " OSPF packet %s receive%s debugging is on",
+ lookup_msg(ospf_packet_type_str, i + 1, NULL),
+ IS_DEBUG_OSPF_PACKET (i, DETAIL) ? " detail" : "");
}
/* Show debug status for OSPF LSAs. */
if (IS_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
- vty_out (vty, " OSPF LSA debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF LSA debugging is on");
else
{
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
- vty_out (vty, " OSPF LSA generation debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF LSA generation debugging is on");
if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
- vty_out (vty, " OSPF LSA flooding debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF LSA flooding debugging is on");
if (IS_DEBUG_OSPF (lsa, LSA_INSTALL))
- vty_out (vty, " OSPF LSA install debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF LSA install debugging is on");
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
- vty_out (vty, " OSPF LSA refresh debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF LSA refresh debugging is on");
}
/* Show debug status for Zebra. */
if (IS_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
- vty_out (vty, " OSPF Zebra debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF Zebra debugging is on");
else
{
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- vty_out (vty, " OSPF Zebra interface debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF Zebra interface debugging is on");
if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
- vty_out (vty, " OSPF Zebra redistribute debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF Zebra redistribute debugging is on");
}
/* Show debug status for NSSA. */
if (IS_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
- vty_out (vty, " OSPF NSSA debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " OSPF NSSA debugging is on");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
return CMD_SUCCESS;
}
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL )
return CMD_SUCCESS;
/* debug ospf ism (status|events|timers). */
if (IS_CONF_DEBUG_OSPF (ism, ISM) == OSPF_DEBUG_ISM)
- vty_out (vty, "debug ospf%s ism%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s ism", str);
else
{
if (IS_CONF_DEBUG_OSPF (ism, ISM_STATUS))
- vty_out (vty, "debug ospf%s ism status%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s ism status", str);
if (IS_CONF_DEBUG_OSPF (ism, ISM_EVENTS))
- vty_out (vty, "debug ospf%s ism event%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s ism event", str);
if (IS_CONF_DEBUG_OSPF (ism, ISM_TIMERS))
- vty_out (vty, "debug ospf%s ism timer%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s ism timer", str);
}
/* debug ospf nsm (status|events|timers). */
if (IS_CONF_DEBUG_OSPF (nsm, NSM) == OSPF_DEBUG_NSM)
- vty_out (vty, "debug ospf%s nsm%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s nsm", str);
else
{
if (IS_CONF_DEBUG_OSPF (nsm, NSM_STATUS))
- vty_out (vty, "debug ospf%s nsm status%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s nsm status", str);
if (IS_CONF_DEBUG_OSPF (nsm, NSM_EVENTS))
- vty_out (vty, "debug ospf%s nsm event%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s nsm event", str);
if (IS_CONF_DEBUG_OSPF (nsm, NSM_TIMERS))
- vty_out (vty, "debug ospf%s nsm timer%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s nsm timer", str);
}
/* debug ospf lsa (generate|flooding|install|refresh). */
if (IS_CONF_DEBUG_OSPF (lsa, LSA) == OSPF_DEBUG_LSA)
- vty_out (vty, "debug ospf%s lsa%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s lsa", str);
else
{
if (IS_CONF_DEBUG_OSPF (lsa, LSA_GENERATE))
- vty_out (vty, "debug ospf%s lsa generate%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s lsa generate", str);
if (IS_CONF_DEBUG_OSPF (lsa, LSA_FLOODING))
- vty_out (vty, "debug ospf%s lsa flooding%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s lsa flooding", str);
if (IS_CONF_DEBUG_OSPF (lsa, LSA_INSTALL))
- vty_out (vty, "debug ospf%s lsa install%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s lsa install", str);
if (IS_CONF_DEBUG_OSPF (lsa, LSA_REFRESH))
- vty_out (vty, "debug ospf%s lsa refresh%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s lsa refresh", str);
write = 1;
}
/* debug ospf zebra (interface|redistribute). */
if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA) == OSPF_DEBUG_ZEBRA)
- vty_out (vty, "debug ospf%s zebra%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s zebra", str);
else
{
if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- vty_out (vty, "debug ospf%s zebra interface%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s zebra interface", str);
if (IS_CONF_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
- vty_out (vty, "debug ospf%s zebra redistribute%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s zebra redistribute", str);
write = 1;
}
/* debug ospf event. */
if (IS_CONF_DEBUG_OSPF (event, EVENT) == OSPF_DEBUG_EVENT)
{
- vty_out (vty, "debug ospf%s event%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s event", str);
write = 1;
}
/* debug ospf nssa. */
if (IS_CONF_DEBUG_OSPF (nssa, NSSA) == OSPF_DEBUG_NSSA)
{
- vty_out (vty, "debug ospf%s nssa%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s nssa", str);
write = 1;
}
r &= conf_debug_ospf_packet[i] & (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL);
if (r == (OSPF_DEBUG_SEND_RECV|OSPF_DEBUG_DETAIL))
{
- vty_out (vty, "debug ospf%s packet all detail%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s packet all detail", str);
return 1;
}
r &= conf_debug_ospf_packet[i] & OSPF_DEBUG_SEND_RECV;
if (r == OSPF_DEBUG_SEND_RECV)
{
- vty_out (vty, "debug ospf%s packet all%s", str, VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s packet all", str);
for (i = 0; i < 5; i++)
if (conf_debug_ospf_packet[i] & OSPF_DEBUG_DETAIL)
- vty_out (vty, "debug ospf%s packet %s detail%s", str,
- type_str[i],
- VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s packet %s detail", str,
+ type_str[i]);
return 1;
}
if (conf_debug_ospf_packet[i] == 0)
continue;
- vty_out (vty, "debug ospf%s packet %s%s%s", str,
- type_str[i], detail_str[conf_debug_ospf_packet[i]],
- VTY_NEWLINE);
+ vty_outln (vty, "debug ospf%s packet %s%s", str,
+ type_str[i],detail_str[conf_debug_ospf_packet[i]]);
write = 1;
}
u_int32_t cost;
u_int32_t bw, refbw;
- bw = oi->ifp->bandwidth ? oi->ifp->bandwidth : OSPF_DEFAULT_BANDWIDTH;
+ /* ifp speed and bw can be 0 in some platforms, use ospf default bw
+ if bw is configured under interface it would be used.
+ */
+ if (!oi->ifp->bandwidth && oi->ifp->speed)
+ bw = oi->ifp->speed;
+ else
+ bw = oi->ifp->bandwidth ? oi->ifp->bandwidth : OSPF_DEFAULT_BANDWIDTH;
refbw = oi->ospf->ref_bandwidth;
/* A specifed ip ospf cost overrides a calculated one. */
#define IF_DEF_PARAMS(I) (IF_OSPF_IF_INFO (I)->def_params)
#define IF_OIFS(I) (IF_OSPF_IF_INFO (I)->oifs)
#define IF_OIFS_PARAMS(I) (IF_OSPF_IF_INFO (I)->params)
-
+
+/* Despite the name, this macro probably is for specialist use only */
#define OSPF_IF_PARAM_CONFIGURED(S, P) ((S) && (S)->P##__config)
+
+/* Test whether an OSPF interface parameter is set, generally, given some
+ * existing ospf interface
+ */
+#define OSPF_IF_PARAM_IS_SET(O,P) \
+ (OSPF_IF_PARAM_CONFIGURED ((O)->params, P) || \
+ OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS((O)->ifp)->P))
+
#define OSPF_IF_PARAM(O, P) \
(OSPF_IF_PARAM_CONFIGURED ((O)->params, P)?\
(O)->params->P:IF_DEF_PARAMS((O)->ifp)->P)
struct list *funclist;
if (CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE))
- vty_out (vty, " capability opaque%s", VTY_NEWLINE);
+ vty_outln (vty, " capability opaque");
funclist = ospf_opaque_wildcard_funclist;
opaque_lsa_config_write_router_callback (funclist, vty);
/* Switch output functionality by vty address. */
if (vty != NULL)
{
- vty_out (vty, " Opaque-Type %u (%s)%s", opaque_type,
- ospf_opaque_type_name (opaque_type), VTY_NEWLINE);
- vty_out (vty, " Opaque-ID 0x%x%s", opaque_id, VTY_NEWLINE);
+ vty_outln (vty, " Opaque-Type %u (%s)", opaque_type,
+ ospf_opaque_type_name(opaque_type));
+ vty_outln (vty, " Opaque-ID 0x%x", opaque_id);
- vty_out (vty, " Opaque-Info: %u octets of data%s%s",
+ vty_outln (vty, " Opaque-Info: %u octets of data%s",
ntohs (lsah->length) - OSPF_LSA_HEADER_SIZE,
- VALID_OPAQUE_INFO_LEN(lsah) ? "" : "(Invalid length?)",
- VTY_NEWLINE);
+ VALID_OPAQUE_INFO_LEN(lsah) ? "" : "(Invalid length?)");
}
else
{
struct ri_tlv_router_cap *top = (struct ri_tlv_router_cap *) tlvh;
if (vty != NULL)
- vty_out (vty, " Router Capabilities: 0x%x%s", ntohl (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" Router Capabilities: 0x%x", ntohl (top->value));
+ vty_outln (vty, " Router Capabilities: 0x%x",ntohl(top->value));
+ else
+ zlog_debug (" Router Capabilities: 0x%x", ntohl (top->value));
return RI_TLV_SIZE (tlvh);
}
if (ntohs (top->address.type) == PCE_ADDRESS_TYPE_IPV4)
{
if (vty != NULL)
- vty_out (vty, " PCE Address: %s%s", inet_ntoa (top->address.value),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE Address: %s", inet_ntoa (top->address.value));
+ vty_outln (vty, " PCE Address: %s",inet_ntoa(top->address.value));
+ else
+ zlog_debug (" PCE Address: %s", inet_ntoa (top->address.value));
}
else
{
/* TODO: Add support to IPv6 with inet_ntop() */
if (vty != NULL)
- vty_out (vty, " PCE Address: 0x%x%s",
- ntohl (top->address.value.s_addr), VTY_NEWLINE);
- else
- zlog_debug (" PCE Address: 0x%x",
- ntohl (top->address.value.s_addr));
+ vty_outln (vty, " PCE Address: 0x%x",
+ ntohl(top->address.value.s_addr));
+ else
+ zlog_debug (" PCE Address: 0x%x",
+ ntohl (top->address.value.s_addr));
}
return RI_TLV_SIZE (tlvh);
(struct ri_pce_subtlv_path_scope *) tlvh;
if (vty != NULL)
- vty_out (vty, " PCE Path Scope: 0x%x%s", ntohl (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE Path Scope: 0x%x", ntohl (top->value));
+ vty_outln (vty, " PCE Path Scope: 0x%x",ntohl(top->value));
+ else
+ zlog_debug (" PCE Path Scope: 0x%x", ntohl (top->value));
return RI_TLV_SIZE (tlvh);
}
{
tmp.s_addr = top->value;
if (vty != NULL)
- vty_out (vty, " PCE domain Area: %s%s", inet_ntoa (tmp),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE domain Area: %s", inet_ntoa (tmp));
+ vty_outln (vty, " PCE domain Area: %s",inet_ntoa(tmp));
+ else
+ zlog_debug (" PCE domain Area: %s", inet_ntoa (tmp));
}
else
{
if (vty != NULL)
- vty_out (vty, " PCE domain AS: %d%s", ntohl (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE domain AS: %d", ntohl (top->value));
+ vty_outln (vty, " PCE domain AS: %d",ntohl(top->value));
+ else
+ zlog_debug (" PCE domain AS: %d", ntohl (top->value));
}
return RI_TLV_SIZE (tlvh);
}
{
tmp.s_addr = top->value;
if (vty != NULL)
- vty_out (vty, " PCE neighbor Area: %s%s", inet_ntoa (tmp),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE neighbor Area: %s", inet_ntoa (tmp));
+ vty_outln (vty, " PCE neighbor Area: %s",inet_ntoa(tmp));
+ else
+ zlog_debug (" PCE neighbor Area: %s", inet_ntoa (tmp));
}
else
{
if (vty != NULL)
- vty_out (vty, " PCE neighbor AS: %d%s", ntohl (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE neighbor AS: %d", ntohl (top->value));
+ vty_outln (vty, " PCE neighbor AS: %d",ntohl(top->value));
+ else
+ zlog_debug (" PCE neighbor AS: %d", ntohl (top->value));
}
return RI_TLV_SIZE (tlvh);
}
struct ri_pce_subtlv_cap_flag *top = (struct ri_pce_subtlv_cap_flag *) tlvh;
if (vty != NULL)
- vty_out (vty, " PCE Capabilities Flag: 0x%x%s", ntohl (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" PCE Capabilities Flag: 0x%x", ntohl (top->value));
+ vty_outln (vty, " PCE Capabilities Flag: 0x%x",ntohl(top->value));
+ else
+ zlog_debug (" PCE Capabilities Flag: 0x%x", ntohl (top->value));
return RI_TLV_SIZE (tlvh);
}
show_vty_unknown_tlv (struct vty *vty, struct ri_tlv_header *tlvh)
{
if (vty != NULL)
- vty_out (vty, " Unknown TLV: [type(0x%x), length(0x%x)]%s",
- ntohs (tlvh->type), ntohs (tlvh->length), VTY_NEWLINE);
- else
- zlog_debug (" Unknown TLV: [type(0x%x), length(0x%x)]",
- ntohs (tlvh->type), ntohs (tlvh->length));
+ vty_outln (vty, " Unknown TLV: [type(0x%x), length(0x%x)]",
+ ntohs (tlvh->type), ntohs(tlvh->length));
+ else
+ zlog_debug (" Unknown TLV: [type(0x%x), length(0x%x)]",
+ ntohs (tlvh->type), ntohs (tlvh->length));
return RI_TLV_SIZE (tlvh);
}
if (OspfRI.status == enabled)
{
if (OspfRI.scope == OSPF_OPAQUE_AS_LSA)
- vty_out (vty, " router-info as%s", VTY_NEWLINE);
+ vty_outln (vty, " router-info as");
else
- vty_out (vty, " router-info area %s%s", inet_ntoa (OspfRI.area_id),
- VTY_NEWLINE);
+ vty_outln (vty, " router-info area %s",inet_ntoa(OspfRI.area_id));
if (pce->pce_address.header.type != 0)
- vty_out (vty, " pce address %s%s",
- inet_ntoa (pce->pce_address.address.value), VTY_NEWLINE);
+ vty_outln (vty, " pce address %s",
+ inet_ntoa(pce->pce_address.address.value));
if (pce->pce_cap_flag.header.type != 0)
- vty_out (vty, " pce flag 0x%x%s", ntohl (pce->pce_cap_flag.value),
- VTY_NEWLINE);
+ vty_outln (vty, " pce flag 0x%x",ntohl(pce->pce_cap_flag.value));
for (ALL_LIST_ELEMENTS_RO (pce->pce_domain, node, domain))
{
if (domain->type == PCE_DOMAIN_TYPE_AREA)
{
tmp.s_addr = domain->value;
- vty_out (vty, " pce domain area %s%s", inet_ntoa (tmp),
- VTY_NEWLINE);
+ vty_outln (vty, " pce domain area %s",inet_ntoa(tmp));
}
else
{
- vty_out (vty, " pce domain as %d%s", ntohl (domain->value),
- VTY_NEWLINE);
+ vty_outln (vty, " pce domain as %d",ntohl(domain->value));
}
}
}
if (neighbor->type == PCE_DOMAIN_TYPE_AREA)
{
tmp.s_addr = neighbor->value;
- vty_out (vty, " pce neighbor area %s%s", inet_ntoa (tmp),
- VTY_NEWLINE);
+ vty_outln (vty, " pce neighbor area %s",inet_ntoa(tmp));
}
else
{
- vty_out (vty, " pce neighbor as %d%s",
- ntohl (neighbor->value), VTY_NEWLINE);
+ vty_outln (vty, " pce neighbor as %d",
+ ntohl(neighbor->value));
}
}
}
if (pce->pce_scope.header.type != 0)
- vty_out (vty, " pce scope 0x%x%s",
- ntohl (OspfRI.pce_info.pce_scope.value), VTY_NEWLINE);
+ vty_outln (vty, " pce scope 0x%x",
+ ntohl(OspfRI.pce_info.pce_scope.value));
}
return;
}
{
if (!inet_aton (area, &OspfRI.area_id))
{
- vty_out (vty, "%% specified Area ID %s is invalid%s",
- area, VTY_NEWLINE);
+ vty_outln (vty, "%% specified Area ID %s is invalid",
+ area);
return CMD_WARNING;
}
scope = OSPF_OPAQUE_AREA_LSA;
return 1;
if (vty)
- vty_out (vty, "%% OSPF RI is not turned on%s", VTY_NEWLINE);
+ vty_outln (vty, "%% OSPF RI is not turned on");
return 0;
}
if (!inet_aton (argv[idx_ipv4]->arg, &value))
{
- vty_out (vty, "Please specify PCE Address by A.B.C.D%s", VTY_NEWLINE);
+ vty_outln (vty, "Please specify PCE Address by A.B.C.D");
return CMD_WARNING;
}
if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &scope) != 1)
{
- vty_out (vty, "pce_path_scope: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "pce_path_scope: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_number]->arg, "%d", &as) != 1)
{
- vty_out (vty, "pce_domain: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "pce_domain: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_number]->arg, "%d", &as) != 1)
{
- vty_out (vty, "no_pce_domain: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "no_pce_domain: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_number]->arg, "%d", &as) != 1)
{
- vty_out (vty, "pce_neighbor: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "pce_neighbor: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_number]->arg, "%d", &as) != 1)
{
- vty_out (vty, "no_pce_neighbor: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "no_pce_neighbor: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_bitpattern]->arg, "0x%x", &cap) != 1)
{
- vty_out (vty, "pce_cap_flag: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "pce_cap_flag: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
if (OspfRI.status == enabled)
{
- vty_out (vty, "--- Router Information parameters ---%s", VTY_NEWLINE);
+ vty_outln (vty, "--- Router Information parameters ---");
show_vty_router_cap (vty, &OspfRI.router_cap.header);
}
else
{
if (vty != NULL)
- vty_out (vty, " Router Information is disabled on this router%s", VTY_NEWLINE);
+ vty_outln (vty, " Router Information is disabled on this router");
}
return CMD_SUCCESS;
}
if (OspfRI.status == enabled)
{
- vty_out (vty, "--- PCE parameters ---%s", VTY_NEWLINE);
+ vty_outln (vty, "--- PCE parameters ---");
if (pce->pce_address.header.type != 0)
show_vty_pce_subtlv_address (vty, &pce->pce_address.header);
}
else
{
- vty_out (vty, " Router Information is disabled on this router%s",
- VTY_NEWLINE);
+ vty_outln (vty," Router Information is disabled on this router");
}
return CMD_SUCCESS;
}
}
-/* Delete rip route map rule. */
-static int
-ospf_route_match_delete (struct vty *vty,
- const char *command, const char *arg)
-{
- VTY_DECLVAR_CONTEXT(route_map_index, index);
- int ret;
-
- ret = route_map_delete_match (index, command, arg);
- if (ret)
- {
- switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
-
- return CMD_SUCCESS;
-}
-
-static int
-ospf_route_match_add (struct vty *vty,
- const char *command, const char *arg)
-{
- VTY_DECLVAR_CONTEXT(route_map_index, index);
- int ret;
-
- ret = route_map_add_match (index, command, arg);
- if (ret)
- {
- switch (ret)
- {
- case RMAP_RULE_MISSING:
- vty_out (vty, "%% OSPF Can't find rule.%s", VTY_NEWLINE);
- return CMD_WARNING;
- case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% OSPF Argument is malformed.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
-
- return CMD_SUCCESS;
-}
-
/* `match ip netxthop ' */
/* Match function return 1 if match is success else return zero. */
static route_map_result_t
route_set_metric_compile (const char *arg)
{
u_int32_t *metric;
- int32_t ret;
/* OSPF doesn't support the +/- in
set metric <+/-metric> check
Ignore the +/- component */
if (! all_digit (arg))
{
- if ((strncmp (arg, "+", 1) == 0 || strncmp (arg, "-", 1) == 0) &&
- all_digit (arg+1))
+ if ((arg[0] == '+' || arg[0] == '-') && all_digit (arg+1))
{
zlog_warn ("OSPF does not support 'set metric +/-'");
arg++;
}
else
- {
- return NULL;
- }
+ {
+ if (strmatch (arg, "+rtt") || strmatch (arg, "-rtt"))
+ zlog_warn ("OSPF does not support 'set metric +rtt / -rtt'");
+ return NULL;
+ }
}
metric = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
- ret = atoi (arg);
+ *metric = strtoul (arg, NULL, 10);
- if (ret >= 0)
- {
- *metric = (u_int32_t)ret;
- return metric;
- }
-
- XFREE (MTYPE_ROUTE_MAP_COMPILED, metric);
- return NULL;
+ return metric;
}
/* Free route map's compiled `set metric' value. */
route_map_rule_tag_free,
};
-DEFUN (match_ip_nexthop,
- match_ip_nexthop_cmd,
- "match ip next-hop <(1-199)|(1300-2699)|WORD>",
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP access-list name\n")
-{
- int idx_acl = 3;
- return ospf_route_match_add (vty, "ip next-hop", argv[idx_acl]->arg);
-}
-
-DEFUN (no_match_ip_nexthop,
- no_match_ip_nexthop_cmd,
- "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]",
- NO_STR
- MATCH_STR
- IP_STR
- "Match next-hop address of route\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP access-list name\n")
-{
- char *al = (argc == 5) ? argv[4]->arg : NULL;
- return ospf_route_match_delete (vty, "ip next-hop", al);
-}
-
DEFUN (set_metric_type,
set_metric_type_cmd,
"set metric-type <type-1|type-2>",
route_map_delete_hook (ospf_route_map_update);
route_map_event_hook (ospf_route_map_event);
+ route_map_set_metric_hook (generic_set_add);
+ route_map_no_set_metric_hook (generic_set_delete);
+
+ route_map_match_ip_next_hop_hook (generic_match_add);
+ route_map_no_match_ip_next_hop_hook (generic_match_delete);
+
route_map_match_interface_hook (generic_match_add);
route_map_no_match_interface_hook (generic_match_delete);
route_map_install_set (&route_set_metric_type_cmd);
route_map_install_set (&route_set_tag_cmd);
- install_element (RMAP_NODE, &match_ip_nexthop_cmd);
- install_element (RMAP_NODE, &no_match_ip_nexthop_cmd);
-
install_element (RMAP_NODE, &set_metric_type_cmd);
install_element (RMAP_NODE, &no_set_metric_type_cmd);
}
struct te_tlv_router_addr *top = (struct te_tlv_router_addr *) tlvh;
if (vty != NULL)
- vty_out (vty, " Router-Address: %s%s", inet_ntoa (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" Router-Address: %s", inet_ntoa (top->value));
+ vty_outln (vty, " Router-Address: %s",inet_ntoa(top->value));
+ else
+ zlog_debug (" Router-Address: %s", inet_ntoa (top->value));
return TLV_SIZE (tlvh);
}
struct te_tlv_link *top = (struct te_tlv_link *) tlvh;
if (vty != NULL)
- vty_out (vty, " Link: %u octets of data%s", ntohs (top->header.length),
- VTY_NEWLINE);
- else
- zlog_debug (" Link: %u octets of data", ntohs (top->header.length));
+ vty_outln (vty, " Link: %u octets of data",ntohs(top->header.length));
+ else
+ zlog_debug (" Link: %u octets of data", ntohs (top->header.length));
return TLV_HDR_SIZE; /* Here is special, not "TLV_SIZE". */
}
}
if (vty != NULL)
- vty_out (vty, " Link-Type: %s (%u)%s", cp, top->link_type.value,
- VTY_NEWLINE);
+ vty_outln (vty, " Link-Type: %s (%u)", cp,top->link_type.value);
else
zlog_debug (" Link-Type: %s (%u)", cp, top->link_type.value);
top = (struct te_link_subtlv_link_id *) tlvh;
if (vty != NULL)
- vty_out (vty, " Link-ID: %s%s", inet_ntoa (top->value), VTY_NEWLINE);
- else
- zlog_debug (" Link-ID: %s", inet_ntoa (top->value));
+ vty_outln (vty, " Link-ID: %s", inet_ntoa(top->value));
+ else
+ zlog_debug (" Link-ID: %s", inet_ntoa (top->value));
return TLV_SIZE (tlvh);
}
n = ntohs (tlvh->length) / sizeof (top->value[0]);
if (vty != NULL)
- vty_out (vty, " Local Interface IP Address(es): %d%s", n, VTY_NEWLINE);
+ vty_outln (vty, " Local Interface IP Address(es): %d", n);
else
zlog_debug (" Local Interface IP Address(es): %d", n);
for (i = 0; i < n; i++)
{
if (vty != NULL)
- vty_out (vty, " #%d: %s%s", i, inet_ntoa (top->value[i]),
- VTY_NEWLINE);
- else
- zlog_debug (" #%d: %s", i, inet_ntoa (top->value[i]));
+ vty_outln (vty, " #%d: %s", i,inet_ntoa(top->value[i]));
+ else
+ zlog_debug (" #%d: %s", i, inet_ntoa (top->value[i]));
}
return TLV_SIZE (tlvh);
}
top = (struct te_link_subtlv_rmtif_ipaddr *) tlvh;
n = ntohs (tlvh->length) / sizeof (top->value[0]);
if (vty != NULL)
- vty_out (vty, " Remote Interface IP Address(es): %d%s", n, VTY_NEWLINE);
+ vty_outln (vty, " Remote Interface IP Address(es): %d", n);
else
zlog_debug (" Remote Interface IP Address(es): %d", n);
for (i = 0; i < n; i++)
{
if (vty != NULL)
- vty_out (vty, " #%d: %s%s", i, inet_ntoa (top->value[i]),
- VTY_NEWLINE);
- else
- zlog_debug (" #%d: %s", i, inet_ntoa (top->value[i]));
+ vty_outln (vty, " #%d: %s", i,inet_ntoa(top->value[i]));
+ else
+ zlog_debug (" #%d: %s", i, inet_ntoa (top->value[i]));
}
return TLV_SIZE (tlvh);
}
top = (struct te_link_subtlv_te_metric *) tlvh;
if (vty != NULL)
- vty_out (vty, " Traffic Engineering Metric: %u%s",
- (u_int32_t) ntohl (top->value), VTY_NEWLINE);
- else
- zlog_debug (" Traffic Engineering Metric: %u",
- (u_int32_t) ntohl (top->value));
+ vty_outln (vty, " Traffic Engineering Metric: %u",
+ (u_int32_t)ntohl(top->value));
+ else
+ zlog_debug (" Traffic Engineering Metric: %u",
+ (u_int32_t) ntohl (top->value));
return TLV_SIZE (tlvh);
}
fval = ntohf (top->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);
fval = ntohf (top->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);
top = (struct te_link_subtlv_unrsv_bw *) tlvh;
if (vty != NULL)
- vty_out (vty, " Unreserved Bandwidth per Class Type in Byte/s:%s", VTY_NEWLINE);
+ vty_outln (vty, " Unreserved Bandwidth per Class Type in Byte/s:");
else
zlog_debug (" Unreserved Bandwidth per Class Type in Byte/s:");
for (i = 0; i < MAX_CLASS_TYPE; i+=2)
fval2 = ntohf (top->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);
top = (struct te_link_subtlv_rsc_clsclr *) tlvh;
if (vty != NULL)
- vty_out (vty, " Resource class/color: 0x%x%s",
- (u_int32_t) ntohl (top->value), VTY_NEWLINE);
- else
- zlog_debug (" Resource Class/Color: 0x%x",
- (u_int32_t) ntohl (top->value));
+ vty_outln (vty, " Resource class/color: 0x%x",
+ (u_int32_t)ntohl(top->value));
+ else
+ zlog_debug (" Resource Class/Color: 0x%x",
+ (u_int32_t) ntohl (top->value));
return TLV_SIZE (tlvh);
}
if (vty != NULL)
{
- vty_out (vty, " Local TE Router ID: %s%s", inet_ntoa (top->local),
- VTY_NEWLINE);
- vty_out (vty, " Remote TE Router ID: %s%s", inet_ntoa (top->remote),
- VTY_NEWLINE);
+ vty_outln (vty, " Local TE Router ID: %s",inet_ntoa(top->local));
+ vty_outln (vty, " Remote TE Router ID: %s",inet_ntoa(top->remote));
}
else
{
if (vty != NULL)
{
- vty_out (vty, " Link Local ID: %d%s", (u_int32_t) ntohl (top->local),
- VTY_NEWLINE);
- vty_out (vty, " Link Remote ID: %d%s", (u_int32_t) ntohl (top->remote),
- VTY_NEWLINE);
+ vty_outln (vty, " Link Local ID: %d",(u_int32_t)ntohl(top->local));
+ vty_outln (vty, " Link Remote ID: %d",(u_int32_t)ntohl(top->remote));
}
else
{
top = (struct te_link_subtlv_rip *) tlvh;
if (vty != NULL)
- vty_out (vty, " Inter-AS TE Remote ASBR IP address: %s%s",
- inet_ntoa (top->value), VTY_NEWLINE);
- else
- zlog_debug (" Inter-AS TE Remote ASBR IP address: %s",
- inet_ntoa (top->value));
+ vty_outln (vty, " Inter-AS TE Remote ASBR IP address: %s",
+ inet_ntoa(top->value));
+ else
+ zlog_debug (" Inter-AS TE Remote ASBR IP address: %s",
+ inet_ntoa (top->value));
return TLV_SIZE (tlvh);
}
top = (struct te_link_subtlv_ras *) tlvh;
if (vty != NULL)
- vty_out (vty, " Inter-AS TE Remote AS number: %u%s", ntohl (top->value),
- VTY_NEWLINE);
- else
- zlog_debug (" Inter-AS TE Remote AS number: %u", ntohl (top->value));
+ vty_outln (vty, " Inter-AS TE Remote AS number: %u",ntohl(top->value));
+ else
+ zlog_debug (" Inter-AS TE Remote AS number: %u", ntohl (top->value));
return TLV_SIZE (tlvh);
}
anomalous = (u_int32_t) ntohl (top->value) & TE_EXT_ANORMAL;
if (vty != NULL)
- vty_out (vty, " %s Average Link Delay: %d (micro-sec)%s",
- anomalous ? "Anomalous" : "Normal", delay, VTY_NEWLINE);
+ vty_outln (vty, " %s Average Link Delay: %d (micro-sec)",
+ anomalous ? "Anomalous" : "Normal", delay);
else
zlog_debug (" %s Average Link Delay: %d (micro-sec)",
anomalous ? "Anomalous" : "Normal", delay);
high = (u_int32_t) ntohl (top->high);
if (vty != NULL)
- vty_out (vty, " %s Min/Max Link Delay: %d/%d (micro-sec)%s",
- anomalous ? "Anomalous" : "Normal", low, high, VTY_NEWLINE);
+ vty_outln (vty, " %s Min/Max Link Delay: %d/%d (micro-sec)",
+ anomalous ? "Anomalous" : "Normal", low, high);
else
zlog_debug (" %s Min/Max Link Delay: %d/%d (micro-sec)",
anomalous ? "Anomalous" : "Normal", low, high);
jitter = (u_int32_t) ntohl (top->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);
anomalous = (u_int32_t) ntohl (top->value) & TE_EXT_ANORMAL;
if (vty != NULL)
- vty_out (vty, " %s Link Loss: %g (%%)%s", anomalous ? "Anomalous" : "Normal",
- fval, VTY_NEWLINE);
+ vty_outln (vty, " %s Link Loss: %g (%%)", anomalous ? "Anomalous" : "Normal",
+ fval);
else
zlog_debug (" %s Link Loss: %g (%%)", anomalous ? "Anomalous" : "Normal",
fval);
fval = ntohf (top->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);
fval = ntohf (top->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);
fval = ntohf (top->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);
show_vty_unknown_tlv (struct vty *vty, struct te_tlv_header *tlvh)
{
if (vty != NULL)
- vty_out (vty, " Unknown TLV: [type(0x%x), length(0x%x)]%s",
- ntohs (tlvh->type), ntohs (tlvh->length), VTY_NEWLINE);
- else
- zlog_debug (" Unknown TLV: [type(0x%x), length(0x%x)]",
- ntohs (tlvh->type), ntohs (tlvh->length));
+ vty_outln (vty, " Unknown TLV: [type(0x%x), length(0x%x)]",
+ ntohs (tlvh->type), ntohs(tlvh->length));
+ else
+ zlog_debug (" Unknown TLV: [type(0x%x), length(0x%x)]",
+ ntohs (tlvh->type), ntohs (tlvh->length));
return TLV_SIZE (tlvh);
}
if (OspfMplsTE.status == enabled)
{
- vty_out (vty, " mpls-te on%s", VTY_NEWLINE);
- vty_out (vty, " mpls-te router-address %s%s",
- inet_ntoa (OspfMplsTE.router_addr.value), VTY_NEWLINE);
+ vty_outln (vty, " mpls-te on");
+ vty_outln (vty, " mpls-te router-address %s",
+ inet_ntoa(OspfMplsTE.router_addr.value));
}
if (OspfMplsTE.inter_as == AS)
- vty_out (vty, " mpls-te inter-as as%s", VTY_NEWLINE);
+ vty_outln (vty, " mpls-te inter-as as");
if (OspfMplsTE.inter_as == Area)
- vty_out (vty, " mpls-te inter-as area %s %s",
- inet_ntoa (OspfMplsTE.interas_areaid), VTY_NEWLINE);
+ vty_outln (vty, " mpls-te inter-as area %s ",
+ inet_ntoa(OspfMplsTE.interas_areaid));
return;
}
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;
}
}
else
{
- vty_out (vty, "Unknown mode. Please choose between as or area%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Unknown mode. Please choose between as or area");
return CMD_WARNING;
}
/* Register new callbacks regarding the flooding scope (AS or Area) */
if (ospf_mpls_te_register (mode) < 0)
{
- vty_out (vty, "Internal error: Unable to register Inter-AS functions%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Internal error: Unable to register Inter-AS functions");
return CMD_WARNING;
}
}
else
{
- vty_out (vty, "Please change Inter-AS support to disable first before going to mode %s%s",
- mode2text[mode], VTY_NEWLINE);
+ vty_outln (vty, "Please change Inter-AS support to disable first before going to mode %s",
+ mode2text[mode]);
return CMD_WARNING;
}
}
else
{
- vty_out (vty, "mpls-te has not been turned on%s", VTY_NEWLINE);
+ vty_outln (vty, "mpls-te has not been turned on");
return CMD_WARNING;
}
return CMD_SUCCESS;
{
if (OspfMplsTE.status == enabled)
{
- vty_out (vty, "--- MPLS-TE router parameters ---%s", VTY_NEWLINE);
+ vty_outln (vty, "--- MPLS-TE router parameters ---");
if (ntohs (OspfMplsTE.router_addr.header.type) != 0)
show_vty_router_addr (vty, &OspfMplsTE.router_addr.header);
else if (vty != NULL)
- vty_out (vty, " N/A%s", VTY_NEWLINE);
+ vty_outln (vty, " N/A");
}
return CMD_SUCCESS;
}
{
if (IS_INTER_AS (lp->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);
}
if (TLV_TYPE(lp->link_type) != 0)
show_vty_link_subtlv_ava_bw (vty, &lp->ava_bw.header);
if (TLV_TYPE(lp->use_bw) != 0)
show_vty_link_subtlv_use_bw (vty, &lp->use_bw.header);
- 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;
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_link_sub (vty, ifp);
}
*metric = strtol (str, NULL, 10);
if (*metric < 0 && *metric > 16777214)
{
- /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
+ /* vty_out (vty, "OSPF metric value is invalid%s", VTYNL); */
return 0;
}
ospf = ospf_lookup();
if (!ospf)
{
- vty_out (vty, "There isn't active ospf instance %s", VTY_NEWLINE);
+ vty_out (vty, "There isn't active ospf instance %s", VTYNL);
return CMD_WARNING;
}
if (argc > 2)
- VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
+ instance = strtoul (argv[2]->arg, NULL, 10);
/* The following logic to set the vty qobj index is in place to be able
to ignore the commands which dont belong to this instance. */
u_short instance = 0;
if (argc > 3)
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ instance = strtoul(argv[3]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL)
return CMD_SUCCESS;
ret = inet_aton (argv[idx_ipv4]->arg, &router_id);
if (!ret)
{
- vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
+ vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTYNL);
return CMD_WARNING;
}
if (area->full_nbrs)
{
vty_out (vty, "For this router-id change to take effect,"
- " save config and restart ospfd%s", VTY_NEWLINE);
+ " save config and restart ospfd%s", VTYNL);
return CMD_SUCCESS;
}
ret = inet_aton (argv[idx_ipv4]->arg, &router_id);
if (!ret)
{
- vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
+ vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTYNL);
return CMD_WARNING;
}
if (area->full_nbrs)
{
vty_out (vty, "For this router-id change to take effect,"
- " save config and restart ospfd%s", VTY_NEWLINE);
+ " save config and restart ospfd%s", VTYNL);
return CMD_SUCCESS;
}
if (area->full_nbrs)
{
vty_out (vty, "For this router-id change to take effect,"
- " save config and restart ospfd%s", VTY_NEWLINE);
+ " save config and restart ospfd%s", VTYNL);
return CMD_SUCCESS;
}
struct ospf_if_params *params;
struct route_node *rn;
- if (strcmp (argv[1]->text, "default") == 0)
+ if (strmatch(argv[1]->text, "default"))
{
ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE);
return CMD_SUCCESS;
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
int ret;
struct route_node *rn;
- if (strcmp (argv[2]->text, "default") == 0)
+ if (strmatch(argv[2]->text, "default"))
{
ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE);
return CMD_SUCCESS;
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (ospf->instance)
{
vty_out (vty, "The network command is not supported in multi-instance ospf%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (ospf->if_ospf_cli_count > 0)
{
vty_out (vty, "Please remove all ip ospf area x.x.x.x commands first.%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
/* Get network prefix and Area ID. */
- VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_network_set (ospf, &p, area_id, format);
if (ret == 0)
{
- vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
+ vty_out (vty, "There is already same network statement.%s", VTYNL);
return CMD_WARNING;
}
if (ospf->instance)
{
vty_out (vty, "The network command is not supported in multi-instance ospf%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
/* Get network prefix and Area ID. */
- VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_network_unset (ospf, &p, area_id);
if (ret == 0)
{
vty_out (vty, "Can't find specified network area configuration.%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
u_int32_t cost;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
if (argc > 5)
{
- VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg);
+ cost = strtoul(argv[idx_cost]->arg, NULL, 10);
ospf_area_range_cost_set (ospf, area_id, &p, cost);
}
u_int32_t cost;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format);
- VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg);
+ cost = strtoul(argv[idx_cost]->arg, NULL, 10);
ospf_area_range_cost_set (ospf, area_id, &p, cost);
return CMD_SUCCESS;
int format;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
ospf_area_range_set (ospf, area_id, &p, 0);
ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format);
int format;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
ospf_area_range_unset (ospf, area_id, &p);
int format;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
- VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen_2]->arg, &s);
ospf_area_range_substitute_set (ospf, area_id, &p, &s);
ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format);
int format;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
- VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen]->arg, &p);
+ str2prefix_ipv4(argv[idx_ipv4_prefixlen_2]->arg, &s);
ospf_area_range_substitute_unset (ospf, area_id, &p);
{
vty_out (vty,
"Configuring VLs over the backbone is not allowed%s",
- VTY_NEWLINE);
+ VTYNL);
return NULL;
}
area = ospf_area_get (ospf, area_id);
vty_out (vty, "Area %s is %s%s",
inet_ntoa (area_id),
area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
- VTY_NEWLINE);
+ VTYNL);
else
vty_out (vty, "Area %ld is %s%s",
(u_long)ntohl (area_id.s_addr),
area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
- VTY_NEWLINE);
+ VTYNL);
return NULL;
}
!= NULL)
{
vty_out (vty, "OSPF: Key %d already exists%s",
- vl_config->crypto_key_id, VTY_NEWLINE);
+ vl_config->crypto_key_id, VTYNL);
return CMD_WARNING;
}
ck = ospf_crypt_key_new ();
vl_config->crypto_key_id) == NULL)
{
vty_out (vty, "OSPF: Key %d does not exist%s",
- vl_config->crypto_key_id, VTY_NEWLINE);
+ vl_config->crypto_key_id, VTYNL);
return CMD_WARNING;
}
&vl_config.area_id_fmt);
if (ret < 0)
{
- vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
+ vty_out (vty, "OSPF area ID is invalid%s", VTYNL);
return CMD_WARNING;
}
if (! ret)
{
vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
for (i=5; i < argc; i++)
{
- /* vty_out (vty, "argv[%d]->arg - %s%s", i, argv[i]->text, VTY_NEWLINE); */
+ /* vty_out (vty, "argv[%d]->arg - %s%s", i, argv[i]->text, VTYNL); */
switch (argv[i]->arg[0])
{
i++;
}
else if (strncmp (argv[i+1]->arg, "m", 1) == 0
- && strcmp (argv[i+1]->arg, "message-digest-") != 0)
+ && !strmatch(argv[i + 1]->text, "message-digest-"))
{
/* "authentication message-digest" */
vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
ret = str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format);
if (ret < 0)
{
- vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
+ vty_out (vty, "OSPF area ID is invalid%s", VTYNL);
return CMD_WARNING;
}
area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id);
if (!area)
{
- vty_out (vty, "Area does not exist%s", VTY_NEWLINE);
+ vty_out (vty, "Area does not exist%s", VTYNL);
return CMD_WARNING;
}
if (! ret)
{
vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
/* Deal with other parameters */
for (i=6; i < argc; i++)
{
- /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
+ /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTYNL); */
switch (argv[i]->arg[0])
{
ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt);
if (ret < 0)
{
- vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
+ vty_out (vty, "OSPF area ID is invalid%s", VTYNL);
return CMD_WARNING;
}
ret = inet_aton (router_id, &vl_config.vl_peer);
if (! ret)
{
- vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE);
+ vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTYNL);
return CMD_WARNING;
}
ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt);
if (ret < 0)
{
- vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
+ vty_out (vty, "OSPF area ID is invalid%s", VTYNL);
return CMD_WARNING;
}
ret = inet_aton (router_id, &vl_config.vl_peer);
if (! ret)
{
- vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE);
+ vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTYNL);
return CMD_WARNING;
}
if (ospf->abr_type != OSPF_ABR_SHORTCUT)
vty_out (vty, "Shortcut area setting will take effect "
"only when the router is configured as Shortcut ABR%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_SUCCESS;
}
if (ret == 0)
{
vty_out (vty, "First deconfigure all virtual link through this area%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (ret == 0)
{
vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (ret == 0)
{
vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
struct prefix_ipv4 p;
VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg);
- VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[idx_number]->arg, 0, 16777215);
+ cost = strtoul(argv[idx_number]->arg, NULL, 10);
area = ospf_area_get (ospf, area_id);
ospf_area_display_format_set (ospf, area, format);
if (area->external_routing == OSPF_AREA_DEFAULT)
{
- vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
+ vty_out (vty, "The area is neither stub, nor NSSA%s", VTYNL);
return CMD_WARNING;
}
{
VTY_DECLVAR_CONTEXT(ospf, ospf);
int idx_ipv4_number = 2;
- int idx_number = 4;
struct ospf_area *area;
struct in_addr area_id;
int format;
struct prefix_ipv4 p;
VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg);
- VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[idx_number]->arg, 0, OSPF_LS_INFINITY);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
if (area->external_routing == OSPF_AREA_DEFAULT)
{
- vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
+ vty_out (vty, "The area is neither stub, nor NSSA%s", VTYNL);
return CMD_WARNING;
}
if (argc < 5)
{
- vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE);
+ vty_out (vty, "Insufficient arguments%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("LSA interval", interval, argv[idx_number]->arg);
+ interval = strtoul(argv[idx_number]->arg, NULL, 10);
ospf->min_ls_interval = interval;
if (argc < 4)
{
- vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE);
+ vty_out (vty, "Insufficient arguments%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[idx_number]->arg, 0, 1000);
+ arrival = strtoul(argv[idx_number]->arg, NULL, 10);
ospf->min_ls_arrival = arrival;
if (argc < 6)
{
- vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE);
+ vty_out (vty, "Insufficient arguments%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000);
- VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000);
- VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000);
+ delay = strtoul(argv[idx_number]->arg, NULL, 10);
+ hold = strtoul(argv[idx_number_2]->arg, NULL, 10);
+ max = strtoul(argv[idx_number_3]->arg, NULL, 10);
return ospf_timers_spf_set (vty, delay, hold, max);
}
if (argc < 4)
{
- vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE);
+ vty_out (vty, "Insufficient number of arguments%s", VTYNL);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg);
+ minarrival = strtoul(argv[idx_number]->arg, NULL, 10);
ospf->min_ls_arrival = minarrival;
if (argc > 4)
{
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[4]->arg);
+ minarrival = strtoul(argv[4]->arg, NULL, 10);
if (ospf->min_ls_arrival != minarrival ||
minarrival == OSPF_MIN_LS_ARRIVAL)
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
+ inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
if (argc > 2)
- VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[idx_pri]->arg, 0, 255);
+ priority = strtoul(argv[idx_pri]->arg, NULL, 10);
if (argc > 4)
- VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_poll]->arg, 1, 65535);
+ interval = strtoul(argv[idx_poll]->arg, NULL, 10);
ospf_nbr_nbma_set (ospf, nbr_addr);
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
+ inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
- VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_poll]->arg, 1, 65535);
+ interval = strtoul(argv[idx_poll]->arg, NULL, 10);
if (argc > 4)
- VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[idx_pri]->arg, 0, 255);
+ priority = strtoul(argv[idx_pri]->arg, NULL, 10);
ospf_nbr_nbma_set (ospf, nbr_addr);
ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
int idx_ipv4 = 2;
struct in_addr nbr_addr;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
+ inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
(void)ospf_nbr_nbma_unset (ospf, nbr_addr);
int idx_ipv4 = 2;
struct in_addr nbr_addr;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
+ inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
(void)ospf_nbr_nbma_unset (ospf, nbr_addr);
int idx_number = 2;
unsigned int interval;
- VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800);
+ interval = strtoul(argv[idx_number]->arg, NULL, 10);
interval = (interval / OSPF_LSA_REFRESHER_GRANULARITY) * OSPF_LSA_REFRESHER_GRANULARITY;
ospf_timers_refresh_set (ospf, interval);
if (argc == 1)
{
- VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800);
+ interval = strtoul(argv[idx_number]->arg, NULL, 10);
if (ospf->lsa_refresh_interval != interval ||
interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
refbw = strtol (argv[idx_number]->arg, NULL, 10);
if (refbw < 1 || refbw > 4294967)
{
- vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
+ vty_out (vty, "reference-bandwidth value is invalid%s", VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;
- vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
- vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
+ vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTYNL);
+ vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTYNL);
for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp))
ospf_if_recalculate_output_cost (ifp);
write_oi_count = strtol (argv[idx_number]->arg, NULL, 10);
if (write_oi_count < 1 || write_oi_count > 100)
{
- vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE);
+ vty_out (vty, "write-multiplier value is invalid%s", VTYNL);
return CMD_WARNING;
}
if (use_json)
json_object_boolean_true_add(json_area, "backbone");
else
- vty_out (vty, " (Backbone)%s", VTY_NEWLINE);
+ vty_out (vty, " (Backbone)%s", VTYNL);
}
else
{
area->no_summary ? ", no summary" : "",
area->shortcut_configured ? "; " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
vty_out (vty, " Shortcutting mode: %s",
ospf_shortcut_mode_descr_str[area->shortcut_configured]);
vty_out (vty, ", S-bit consensus: %s%s",
- area->shortcut_capability ? "ok" : "no", VTY_NEWLINE);
+ area->shortcut_capability ? "ok" : "no", VTYNL);
}
}
else
vty_out (vty, " Number of interfaces in this area: Total: %d, "
"Active: %d%s", listcount (area->oiflist),
- area->act_ints, VTY_NEWLINE);
+ area->act_ints, VTYNL);
if (area->external_routing == OSPF_AREA_NSSA)
{
}
else
{
- vty_out (vty, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTYNL, VTYNL);
if (! IS_OSPF_ABR (area->ospf))
vty_out (vty, " It is not ABR, therefore not Translator. %s",
- VTY_NEWLINE);
+ VTYNL);
else if (area->NSSATranslatorState)
{
vty_out (vty, " We are an ABR and ");
if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE)
vty_out (vty, "the NSSA Elected Translator. %s",
- VTY_NEWLINE);
+ VTYNL);
else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS)
vty_out (vty, "always an NSSA Translator. %s",
- VTY_NEWLINE);
+ VTYNL);
}
else
{
vty_out (vty, " We are an ABR, but ");
if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE)
vty_out (vty, "not the NSSA Elected Translator. %s",
- VTY_NEWLINE);
+ VTYNL);
else
vty_out (vty, "never an NSSA Translator. %s",
- VTY_NEWLINE);
+ VTYNL);
}
}
}
else
{
vty_out (vty, " Originating stub / maximum-distance Router-LSA%s",
- VTY_NEWLINE);
+ VTYNL);
if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
vty_out (vty, " Administratively activated (indefinitely)%s",
- VTY_NEWLINE);
+ VTYNL);
if (area->t_stub_router)
vty_out (vty, " Active from startup, %s remaining%s",
ospf_timer_dump (area->t_stub_router, timebuf,
- sizeof(timebuf)), VTY_NEWLINE);
+ sizeof(timebuf)), VTYNL);
}
}
{
/* Show number of fully adjacent neighbors. */
vty_out (vty, " Number of fully adjacent neighbors in this area:"
- " %d%s", area->full_nbrs, VTY_NEWLINE);
+ " %d%s", area->full_nbrs, VTYNL);
/* Show authentication type. */
vty_out (vty, " Area has ");
if (area->auth_type == OSPF_AUTH_NULL)
- vty_out (vty, "no authentication%s", VTY_NEWLINE);
+ vty_out (vty, "no authentication%s", VTYNL);
else if (area->auth_type == OSPF_AUTH_SIMPLE)
- vty_out (vty, "simple password authentication%s", VTY_NEWLINE);
+ vty_out (vty, "simple password authentication%s", VTYNL);
else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC)
- vty_out (vty, "message digest authentication%s", VTY_NEWLINE);
+ vty_out (vty, "message digest authentication%s", VTYNL);
if (!OSPF_IS_AREA_BACKBONE (area))
vty_out (vty, " Number of full virtual adjacencies going through"
- " this area: %d%s", area->full_vls, VTY_NEWLINE);
+ " this area: %d%s", area->full_vls, VTYNL);
/* Show SPF calculation times. */
vty_out (vty, " SPF algorithm executed %d times%s",
- area->spf_calculation, VTY_NEWLINE);
+ area->spf_calculation, VTYNL);
/* Show number of LSA. */
- vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE);
+ vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTYNL);
vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTYNL);
vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTYNL);
vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTYNL);
vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTYNL);
vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTYNL);
}
if (use_json)
{
vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTYNL);
vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA),
- ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTYNL);
}
if (use_json)
json_object_object_add(json_areas, inet_ntoa (area->area_id), json_area);
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
static int
}
else
{
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
}
{
vty_out (vty, " OSPF Routing Process, Router ID: %s%s",
inet_ntoa (ospf->router_id),
- VTY_NEWLINE);
+ VTYNL);
}
/* Graceful shutdown */
{
vty_out (vty, " Deferred shutdown in progress, %s remaining%s",
ospf_timer_dump (ospf->t_deferred_shutdown,
- timebuf, sizeof (timebuf)), VTY_NEWLINE);
+ timebuf, sizeof (timebuf)), VTYNL);
}
}
}
else
{
- vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE);
- vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE);
+ vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTYNL);
+ vty_out (vty, " This implementation conforms to RFC2328%s", VTYNL);
vty_out (vty, " RFC1583Compatibility flag is %s%s",
CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?
- "enabled" : "disabled", VTY_NEWLINE);
+ "enabled" : "disabled", VTYNL);
}
if (use_json)
{
vty_out (vty, " OpaqueCapability flag is %s%s",
CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? "enabled" : "disabled",
- VTY_NEWLINE);
+ VTYNL);
}
/* Show stub-router configuration */
else
{
vty_out (vty, " Stub router advertisement is configured%s",
- VTY_NEWLINE);
+ VTYNL);
if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED)
vty_out (vty, " Enabled for %us after start-up%s",
- ospf->stub_router_startup_time, VTY_NEWLINE);
+ ospf->stub_router_startup_time, VTYNL);
if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED)
vty_out (vty, " Enabled for %us prior to full shutdown%s",
- ospf->stub_router_shutdown_time, VTY_NEWLINE);
+ ospf->stub_router_shutdown_time, VTYNL);
}
}
" Minimum hold time between consecutive SPFs %d millisec(s)%s"
" Maximum hold time between consecutive SPFs %d millisec(s)%s"
" Hold time multiplier is currently %d%s",
- ospf->spf_delay, VTY_NEWLINE,
- ospf->spf_holdtime, VTY_NEWLINE,
- ospf->spf_max_holdtime, VTY_NEWLINE,
- ospf->spf_hold_multiplier, VTY_NEWLINE);
+ ospf->spf_delay, VTYNL,
+ ospf->spf_holdtime, VTYNL,
+ ospf->spf_max_holdtime, VTYNL,
+ ospf->spf_hold_multiplier, VTYNL);
}
if (use_json)
monotime_since(&ospf->ts_spf, &result);
vty_out (vty, "last executed %s ago%s",
ospf_timeval_dump (&result, timebuf, sizeof (timebuf)),
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, " Last SPF duration %s%s",
ospf_timeval_dump (&ospf->ts_spf_duration, timebuf, sizeof (timebuf)),
- VTY_NEWLINE);
+ VTYNL);
}
else
- vty_out (vty, "has not been run%s", VTY_NEWLINE);
+ vty_out (vty, "has not been run%s", VTYNL);
}
if (use_json)
vty_out (vty, " SPF timer %s%s%s",
(ospf->t_spf_calc ? "due in " : "is "),
ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)),
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, " LSA minimum interval %d msecs%s",
- ospf->min_ls_interval, VTY_NEWLINE);
+ ospf->min_ls_interval, VTYNL);
vty_out (vty, " LSA minimum arrival %d msecs%s",
- ospf->min_ls_arrival, VTY_NEWLINE);
+ ospf->min_ls_arrival, VTYNL);
/* Show write multiplier values */
vty_out (vty, " Write Multiplier set to %d %s",
- ospf->write_oi_count, VTY_NEWLINE);
+ ospf->write_oi_count, VTYNL);
/* Show refresh parameters. */
vty_out (vty, " Refresh timer %d secs%s",
- ospf->lsa_refresh_interval, VTY_NEWLINE);
+ ospf->lsa_refresh_interval, VTYNL);
}
/* Show ABR/ASBR flags. */
json_object_string_add(json, "abrType", ospf_abr_type_descr_str[ospf->abr_type]);
else
vty_out (vty, " This router is an ABR, ABR type is: %s%s",
- ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE);
+ ospf_abr_type_descr_str[ospf->abr_type], VTYNL);
}
if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR))
{
json_object_string_add(json, "asbrRouter", "injectingExternalRoutingInformation");
else
vty_out (vty, " This router is an ASBR "
- "(injecting external routing information)%s", VTY_NEWLINE);
+ "(injecting external routing information)%s", VTYNL);
}
/* Show Number of AS-external-LSAs. */
{
vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA),
- ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTYNL);
}
if (use_json)
{
vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA),
- ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE);
+ ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTYNL);
}
/* Show number of areas attached. */
json_object_int_add(json, "attachedAreaCounter", listcount (ospf->areas));
else
vty_out (vty, " Number of areas attached to this router: %d%s",
- listcount (ospf->areas), VTY_NEWLINE);
+ listcount (ospf->areas), VTYNL);
if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES))
{
if (use_json)
json_object_boolean_true_add(json, "adjacencyChangesLoggedAll");
else
- vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE);
+ vty_out(vty, " All adjacency changes are logged%s",VTYNL);
}
else
{
if (use_json)
json_object_boolean_true_add(json, "adjacencyChangesLogged");
else
- vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE);
+ vty_out(vty, " Adjacency changes are logged%s",VTYNL);
}
}
/* Show each area status. */
if (use_json)
{
json_object_object_add(json, "areas", json_areas);
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s",VTY_NEWLINE);
+ vty_out (vty, "%s",VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
int is_up;
struct ospf_neighbor *nbr;
struct route_node *rn;
+ uint32_t bandwidth = ifp->bandwidth ? ifp->bandwidth : ifp->speed;
/* Is interface up? */
if (use_json)
json_object_int_add(json_interface_sub, "ifIndex", ifp->ifindex);
json_object_int_add(json_interface_sub, "mtuBytes", ifp->mtu);
- json_object_int_add(json_interface_sub, "bandwidthMbit", ifp->bandwidth);
+ json_object_int_add(json_interface_sub, "bandwidthMbit", bandwidth);
json_object_string_add(json_interface_sub, "ifFlags", if_flag_dump(ifp->flags));
}
else
{
- 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, BW %u Mbit %s%s",
- ifp->ifindex, ifp->mtu, ifp->bandwidth, 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, BW %u Mbit %s",
+ ifp->ifindex, ifp->mtu, bandwidth, if_flag_dump(ifp->flags));
}
/* Is interface OSPF enabled? */
{
if (ospf_oi_count(ifp) == 0)
{
- vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
+ vty_out (vty, " OSPF not enabled on this interface%s", VTYNL);
return;
}
else if (!is_up)
{
vty_out (vty, " OSPF is enabled, but not running on this interface%s",
- VTY_NEWLINE);
+ VTYNL);
return;
}
}
}
else
{
- vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
- VTY_NEWLINE);
+ vty_outln (vty, " Area %s", ospf_area_desc_string (oi->area));
- vty_out (vty, " MTU mismatch detection:%s%s",
- OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE);
+ vty_outln (vty, " MTU mismatch detection: %s",
+ OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled");
- vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s",
- inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
- oi->output_cost, VTY_NEWLINE);
+ vty_outln (vty, " Router ID %s, Network Type %s, Cost: %d",
+ inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
+ oi->output_cost);
- vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s",
- OSPF_IF_PARAM (oi,transmit_delay), lookup_msg(ospf_ism_state_msg, oi->state, NULL),
- PRIORITY (oi), VTY_NEWLINE);
+ vty_outln (vty, " Transmit Delay is %d sec, State %s, Priority %d",
+ OSPF_IF_PARAM (oi,transmit_delay), lookup_msg(ospf_ism_state_msg, oi->state, NULL),
+ PRIORITY (oi));
}
/* Show DR information. */
if (DR (oi).s_addr == 0)
{
if (!use_json)
- vty_out (vty, " No backup designated router on this network%s",
- VTY_NEWLINE);
+ vty_outln (vty, " No backup designated router on this network");
}
else
{
if (nbr == NULL)
{
if (!use_json)
- vty_out (vty, " No backup designated router on this network%s",
- VTY_NEWLINE);
+ vty_outln (vty, " No backup designated router on this network");
}
else
{
{
vty_out (vty, " Backup Designated Router (ID) %s,",
inet_ntoa (nbr->router_id));
- vty_out (vty, " Interface Address %s%s",
- inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
+ vty_outln (vty, " Interface Address %s",
+ inet_ntoa (nbr->address.u.prefix4));
}
}
}
json_object_int_add(json_interface_sub, "networkLsaSequence", ntohl (oi->params->network_lsa_seqnum));
else
vty_out (vty, " Saved Network-LSA sequence number 0x%x%s",
- ntohl (oi->params->network_lsa_seqnum), VTY_NEWLINE);
+ ntohl (oi->params->network_lsa_seqnum), VTYNL);
}
if (use_json)
}
else
vty_out (vty, " <None>");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (use_json)
OSPF_IF_PARAM (oi, v_wait),
OSPF_IF_PARAM (oi, v_wait),
OSPF_IF_PARAM (oi, retransmit_interval),
- VTY_NEWLINE);
+ VTYNL);
}
if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_ACTIVE)
else
vty_out (vty, " Hello due in %s%s",
ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)),
- VTY_NEWLINE);
+ VTYNL);
}
else /* passive-interface is set */
{
if (use_json)
json_object_boolean_true_add(json_interface_sub, "timerPassiveIface");
else
- vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
+ vty_out (vty, " No Hellos (Passive interface)%s", VTYNL);
}
if (use_json)
else
vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full),
- VTY_NEWLINE);
+ VTYNL);
ospf_bfd_interface_show(vty, ifp, json_interface_sub, use_json);
}
}
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
if (argc == iface_argv)
if (use_json)
json_object_boolean_true_add(json, "noSuchIface");
else
- vty_out (vty, "No such interface name%s", VTY_NEWLINE);
+ vty_out (vty, "No such interface name%s", VTYNL);
}
else
{
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
show_ip_ospf_neighbour_header (struct vty *vty)
{
vty_out (vty, "%s%-15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
- VTY_NEWLINE,
+ VTYNL,
"Neighbor ID", "Pri", "State", "Dead Time",
"Address", "Interface", "RXmtL", "RqstL", "DBsmL",
- VTY_NEWLINE);
+ VTYNL);
}
static void
vty_out (vty, "%-20s %5ld %5ld %5d%s",
IF_NAME (oi), ospf_ls_retransmit_count (nbr),
ospf_ls_request_count (nbr), ospf_db_summary_count (nbr),
- VTY_NEWLINE);
+ VTYNL);
}
}
}
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
"-", nbr_nbma->priority, "Down", "-");
vty_out (vty, "%-15s %-20s %5d %5d %5d%s",
inet_ntoa (nbr_nbma->addr), IF_NAME (oi),
- 0, 0, 0, VTY_NEWLINE);
+ 0, 0, 0, VTYNL);
}
}
}
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
ifp = if_lookup_by_name (argv[arg_base]->arg, VRF_DEFAULT);
if (use_json)
json_object_boolean_true_add(json, "noSuchIface");
else
- vty_out (vty, "No such interface.%s", VTY_NEWLINE);
+ vty_out (vty, "No such interface.%s", VTYNL);
return CMD_WARNING;
}
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
json_object_string_add(json_sub, "ifaceAddress", inet_ntoa (nbr_nbma->addr));
else
vty_out (vty, " interface address %s%s",
- inet_ntoa (nbr_nbma->addr), VTY_NEWLINE);
+ inet_ntoa (nbr_nbma->addr), VTYNL);
/* Show Area ID. */
if (use_json)
}
else
vty_out (vty, " In the area %s via interface %s%s",
- ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE);
+ ospf_area_desc_string (oi->area), IF_NAME (oi), VTYNL);
/* Show neighbor priority and state. */
if (use_json)
if (use_json)
json_object_int_add(json_sub, "stateChangeCounter", nbr_nbma->state_change);
else
- vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE);
+ vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTYNL);
/* Show PollInterval */
if (use_json)
json_object_int_add(json_sub, "pollInterval", nbr_nbma->v_poll);
else
- vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE);
+ vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTYNL);
/* Show poll-interval timer. */
if (use_json)
else
vty_out (vty, " Poll timer due in %s%s",
ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)),
- VTY_NEWLINE);
+ VTYNL);
/* Show poll-interval timer thread. */
if (use_json)
}
else
vty_out (vty, " Thread Poll Timer %s%s",
- nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE);
+ nbr_nbma->t_poll != NULL ? "on" : "off", VTYNL);
if (use_json)
json_object_object_add(json, "noNbrId", json_sub);
json_object_string_add(json_sub, "ifaceAddress", inet_ntoa (nbr->address.u.prefix4));
else
vty_out (vty, " interface address %s%s",
- inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
+ inet_ntoa (nbr->address.u.prefix4), VTYNL);
/* Show Area ID. */
if (use_json)
}
else
vty_out (vty, " In the area %s via interface %s%s",
- ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE);
+ ospf_area_desc_string (oi->area), oi->ifp->name, VTYNL);
/* Show neighbor priority and state. */
if (use_json)
if (use_json)
json_object_int_add(json_sub, "stateChangeCounter", nbr->state_change);
else
- vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
+ vty_out (vty, " %d state changes%s", nbr->state_change, VTYNL);
if (nbr->ts_last_progress.tv_sec || nbr->ts_last_progress.tv_usec)
{
else
{
vty_out (vty, " Most recent state change statistics:%s",
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, " Progressive change %s ago%s",
ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
- VTY_NEWLINE);
+ VTYNL);
}
}
vty_out (vty, " Regressive change %s ago, due to %s%s",
ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
(nbr->last_regress_str ? nbr->last_regress_str : "??"),
- VTY_NEWLINE);
+ VTYNL);
}
}
if (use_json)
json_object_string_add(json_sub, "routerDesignatedBackupId", inet_ntoa (nbr->bd_router));
else
- vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE);
+ vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTYNL);
/* Show options. */
if (use_json)
}
else
vty_out (vty, " Options %d %s%s", nbr->options,
- ospf_options_dump (nbr->options), VTY_NEWLINE);
+ ospf_options_dump (nbr->options), VTYNL);
/* Show Router Dead interval timer. */
if (use_json)
else
vty_out (vty, " Dead timer due in %s%s",
ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)),
- VTY_NEWLINE);
+ VTYNL);
/* Show Database Summary list. */
if (use_json)
json_object_int_add(json_sub, "databaseSummaryListCounter", ospf_db_summary_count (nbr));
else
vty_out (vty, " Database Summary List %d%s",
- ospf_db_summary_count (nbr), VTY_NEWLINE);
+ ospf_db_summary_count (nbr), VTYNL);
/* Show Link State Request list. */
if (use_json)
json_object_int_add(json_sub, "linkStateRequestListCounter", ospf_ls_request_count (nbr));
else
vty_out (vty, " Link State Request List %ld%s",
- ospf_ls_request_count (nbr), VTY_NEWLINE);
+ ospf_ls_request_count (nbr), VTYNL);
/* Show Link State Retransmission list. */
if (use_json)
json_object_int_add(json_sub, "linkStateRetransmissionListCounter", ospf_ls_retransmit_count (nbr));
else
vty_out (vty, " Link State Retransmission List %ld%s",
- ospf_ls_retransmit_count (nbr), VTY_NEWLINE);
+ ospf_ls_retransmit_count (nbr), VTYNL);
/* Show inactivity timer thread. */
if (use_json)
}
else
vty_out (vty, " Thread Inactivity Timer %s%s",
- nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE);
+ nbr->t_inactivity != NULL ? "on" : "off", VTYNL);
/* Show Database Description retransmission thread. */
if (use_json)
}
else
vty_out (vty, " Thread Database Description Retransmision %s%s",
- nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE);
+ nbr->t_db_desc != NULL ? "on" : "off", VTYNL);
/* Show Link State Request Retransmission thread. */
if (use_json)
}
else
vty_out (vty, " Thread Link State Request Retransmission %s%s",
- nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE);
+ nbr->t_ls_req != NULL ? "on" : "off", VTYNL);
/* Show Link State Update Retransmission thread. */
if (use_json)
}
else
vty_out (vty, " Thread Link State Update Retransmission %s%s%s",
- nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE);
+ nbr->t_ls_upd != NULL ? "on" : "off", VTYNL, VTYNL);
if (use_json)
{
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
ret = inet_aton (argv[arg_base]->arg, &router_id);
if (!ret)
{
if (!use_json)
- vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE);
+ vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTYNL);
return CMD_WARNING;
}
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
{
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return CMD_SUCCESS;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
json_object_int_add(json, "ospfInstance", ospf->instance);
else
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
}
ifp = if_lookup_by_name (argv[arg_base]->arg, VRF_DEFAULT);
if (!ifp)
{
if (!use_json)
- vty_out (vty, "No such interface.%s", VTY_NEWLINE);
+ vty_out (vty, "No such interface.%s", VTYNL);
return CMD_WARNING;
}
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTYNL);
json_object_free(json);
}
else
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
default:
break;
}
- vty_out (vty, VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return 0;
{
struct router_lsa *rlsa = (struct router_lsa*) lsa->data;
- vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE);
- vty_out (vty, " Options: 0x%-2x : %s%s",
- lsa->data->options,
- ospf_options_dump(lsa->data->options),
- VTY_NEWLINE);
- vty_out (vty, " LS Flags: 0x%-2x %s%s",
- lsa->flags,
- ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""),
- VTY_NEWLINE);
+ vty_outln (vty, " LS age: %d", LS_AGE (lsa));
+ vty_outln (vty, " Options: 0x%-2x : %s", lsa->data->options,
+ ospf_options_dump(lsa->data->options));
+ vty_outln (vty, " LS Flags: 0x%-2x %s",
+ lsa->flags,
+ ((lsa->flags & OSPF_LSA_LOCAL_XLT) ?
+ "(Translated from Type-7)" : ""));
if (lsa->data->type == OSPF_ROUTER_LSA)
{
IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "",
IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : "");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
- vty_out (vty, " LS Type: %s%s",
- lookup_msg(ospf_lsa_type_msg, lsa->data->type, NULL), VTY_NEWLINE);
- vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id),
- lookup_msg(ospf_link_state_id_type_msg, lsa->data->type, NULL), VTY_NEWLINE);
- vty_out (vty, " Advertising Router: %s%s",
- inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
- vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum),
- VTY_NEWLINE);
- vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum),
- VTY_NEWLINE);
- vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE);
+ vty_outln (vty, " LS Type: %s",
+ lookup_msg(ospf_lsa_type_msg, lsa->data->type, NULL));
+ vty_outln (vty, " Link State ID: %s %s", inet_ntoa (lsa->data->id),
+ lookup_msg(ospf_link_state_id_type_msg, lsa->data->type, NULL));
+ vty_outln (vty, " Advertising Router: %s", inet_ntoa (lsa->data->adv_router));
+ vty_outln (vty, " LS Seq Number: %08lx", (u_long)ntohl (lsa->data->ls_seqnum));
+ vty_outln (vty, " Checksum: 0x%04x", ntohs (lsa->data->checksum));
+ vty_outln (vty, " Length: %d%s", ntohs (lsa->data->length), VTYNL);
}
const char *link_type_desc[] =
type = rl->link[i].type;
vty_out (vty, " Link connected to: %s%s",
- link_type_desc[type], VTY_NEWLINE);
+ link_type_desc[type], VTYNL);
vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type],
- inet_ntoa (rl->link[i].link_id), VTY_NEWLINE);
+ inet_ntoa (rl->link[i].link_id), VTYNL);
vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type],
- inet_ntoa (rl->link[i].link_data), VTY_NEWLINE);
- vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE);
+ inet_ntoa (rl->link[i].link_data), VTYNL);
+ vty_out (vty, " Number of TOS metrics: 0%s", VTYNL);
vty_out (vty, " TOS 0 Metric: %d%s",
- ntohs (rl->link[i].metric), VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ ntohs (rl->link[i].metric), VTYNL);
+ vty_out (vty, "%s", VTYNL);
}
}
show_ip_ospf_database_header (vty, lsa);
vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links),
- VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, VTYNL);
show_ip_ospf_database_router_links (vty, rl);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
show_ip_ospf_database_header (vty, lsa);
vty_out (vty, " Network Mask: /%d%s",
- ip_masklen (nl->mask), VTY_NEWLINE);
+ ip_masklen (nl->mask), VTYNL);
length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4;
for (i = 0; length > 0; i++, length -= 4)
vty_out (vty, " Attached Router: %s%s",
- inet_ntoa (nl->routers[i]), VTY_NEWLINE);
+ inet_ntoa (nl->routers[i]), VTYNL);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
show_ip_ospf_database_header (vty, lsa);
vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask),
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
- VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ VTYNL);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
show_ip_ospf_database_header (vty, lsa);
vty_out (vty, " Network Mask: /%d%s",
- ip_masklen (sl->mask), VTY_NEWLINE);
+ ip_masklen (sl->mask), VTYNL);
vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
- VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ VTYNL);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
show_ip_ospf_database_header (vty, lsa);
vty_out (vty, " Network Mask: /%d%s",
- ip_masklen (al->mask), VTY_NEWLINE);
+ ip_masklen (al->mask), VTYNL);
vty_out (vty, " Metric Type: %s%s",
IS_EXTERNAL_METRIC (al->e[0].tos) ?
- "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
- vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
+ "2 (Larger than any link state path)" : "1", VTYNL);
+ vty_out (vty, " TOS: 0%s", VTYNL);
vty_out (vty, " Metric: %d%s",
- GET_METRIC (al->e[0].metric), VTY_NEWLINE);
+ GET_METRIC (al->e[0].metric), VTYNL);
vty_out (vty, " Forward Address: %s%s",
- inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
+ inet_ntoa (al->e[0].fwd_addr), VTYNL);
vty_out (vty, " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
- (route_tag_t)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ (route_tag_t)ntohl (al->e[0].route_tag), VTYNL, VTYNL);
}
return 0;
show_ip_ospf_database_header (vty, lsa);
vty_out (vty, " Network Mask: /%d%s",
- ip_masklen (al->mask), VTY_NEWLINE);
+ ip_masklen (al->mask), VTYNL);
vty_out (vty, " Metric Type: %s%s",
IS_EXTERNAL_METRIC (al->e[0].tos) ?
- "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
- vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
+ "2 (Larger than any link state path)" : "1", VTYNL);
+ vty_out (vty, " TOS: 0%s", VTYNL);
vty_out (vty, " Metric: %d%s",
- GET_METRIC (al->e[0].metric), VTY_NEWLINE);
+ GET_METRIC (al->e[0].metric), VTYNL);
vty_out (vty, " NSSA: Forward Address: %s%s",
- inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
+ inet_ntoa (al->e[0].fwd_addr), VTYNL);
vty_out (vty, " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
- (route_tag_t)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ (route_tag_t)ntohl (al->e[0].route_tag), VTYNL, VTYNL);
}
return 0;
show_ip_ospf_database_header (vty, lsa);
show_opaque_info_detail (vty, lsa);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
}
case OSPF_OPAQUE_AS_LSA:
vty_out (vty, " %s %s%s",
show_database_desc[type],
- VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, VTYNL);
show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router);
break;
default:
for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
{
vty_out (vty, "%s %s (Area %s)%s%s",
- VTY_NEWLINE, show_database_desc[type],
- ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, show_database_desc[type],
+ ospf_area_desc_string (area), VTYNL, VTYNL);
show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router);
}
break;
case OSPF_OPAQUE_AS_LSA:
vty_out (vty, " %s %s%s",
show_database_desc[type],
- VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, VTYNL);
show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type),
adv_router);
break;
for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
{
vty_out (vty, "%s %s (Area %s)%s%s",
- VTY_NEWLINE, show_database_desc[type],
- ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, show_database_desc[type],
+ ospf_area_desc_string (area), VTYNL, VTYNL);
show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type),
adv_router);
}
vty_out (vty, " %s (Area %s)%s%s",
show_database_desc[type],
ospf_area_desc_string (area),
- VTY_NEWLINE, VTY_NEWLINE);
- vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE);
+ VTYNL, VTYNL);
+ vty_out (vty, "%s%s", show_database_header[type], VTYNL);
LSDB_LOOP (AREA_LSDB (area, type), rn, lsa)
show_lsa_summary (vty, lsa, self);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
}
{
vty_out (vty, " %s%s%s",
show_database_desc[type],
- VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, VTYNL);
vty_out (vty, "%s%s", show_database_header[type],
- VTY_NEWLINE);
+ VTYNL);
LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa)
show_lsa_summary (vty, lsa, self);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
static void
struct route_node *rn;
vty_out (vty, "%s MaxAge Link States:%s%s",
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ VTYNL, VTYNL, VTYNL);
for (rn = route_top (ospf->maxage_lsa); rn; rn = route_next (rn))
{
if ((lsa = rn->info) != NULL)
{
- vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);
+ vty_out (vty, "Link type: %d%s", lsa->data->type, VTYNL);
vty_out (vty, "Link State ID: %s%s",
- inet_ntoa (lsa->data->id), VTY_NEWLINE);
+ inet_ntoa (lsa->data->id), VTYNL);
vty_out (vty, "Advertising Router: %s%s",
- inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
- vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ inet_ntoa (lsa->data->adv_router), VTYNL);
+ vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTYNL);
+ vty_out (vty, "%s", VTYNL);
}
}
}
struct in_addr id, adv_router;
if (ospf->instance)
- vty_out (vty, "%sOSPF Instance: %d%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s", VTYNL, ospf->instance,
+ VTYNL);
- vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
- inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTYNL,
+ inet_ntoa (ospf->router_id), VTYNL, VTYNL);
/* Show all LSA. */
if (argc == arg_base + 4)
int idx = 0;
if (argv_find (argv, argc, "(1-65535)", &idx))
{
- VTY_GET_INTEGER ("Instance", instance, argv[idx]->arg);
+ instance = strtoul(argv[idx]->arg, NULL, 10);
ospf = ospf_lookup_instance (instance);
}
else {
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
struct in_addr adv_router;
if (ospf->instance)
- vty_out (vty, "%sOSPF Instance: %d%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE);
-
- vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
- inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s", VTYNL, ospf->instance,
+ VTYNL);
- if (argc != arg_base + 7)
- return CMD_WARNING;
+ vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTYNL,
+ inet_ntoa (ospf->router_id), VTYNL, VTYNL);
/* Set database type to show. */
if (strncmp (argv[arg_base + idx_type]->text, "r", 1) == 0)
return CMD_SUCCESS;
}
-DEFUN (show_ip_ospf_database_type_adv_router,
- show_ip_ospf_database_type_adv_router_cmd,
- "show ip ospf database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate>",
- SHOW_STR
- IP_STR
- "OSPF information\n"
- "Database summary\n"
- OSPF_LSA_TYPES_DESC
- "Advertising Router link states\n"
- "Advertising Router (as an IP address)\n"
- "Self-originated link states\n")
-{
- struct ospf *ospf;
-
- if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
- return CMD_SUCCESS;
-
- return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 0, argc, argv));
-}
-
DEFUN (show_ip_ospf_instance_database_type_adv_router,
show_ip_ospf_instance_database_type_adv_router_cmd,
- "show ip ospf (1-65535) database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate>",
+ "show ip ospf [(1-65535)] database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate>",
SHOW_STR
IP_STR
"OSPF information\n"
"Advertising Router (as an IP address)\n"
"Self-originated link states\n")
{
- int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
+ int idx = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ if (argv_find(argv, argc, "(1-65535)", &idx))
+ {
+ instance = strtoul(argv[idx]->arg, NULL, 10);
+ ospf = ospf_lookup_instance(instance);
+ }
+ else
+ ospf = ospf_lookup();
- if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
+ if (!ospf || !ospf->oi_running)
return CMD_SUCCESS;
- return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 1, argc, argv));
+ return (show_ip_ospf_database_type_adv_router_common(vty, ospf, idx ? 1 : 0, argc, argv));
}
DEFUN (ip_ospf_authentication_args,
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
- vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE);
+ vty_out (vty, "You shouldn't get here!%s", VTYNL);
return CMD_WARNING;
}
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
params = ospf_lookup_if_params (ifp, addr);
if (params == NULL)
{
- vty_out (vty, "Ip Address specified is unknown%s", VTY_NEWLINE);
+ vty_out (vty, "Ip Address specified is unknown%s", VTYNL);
return CMD_WARNING;
}
params->auth_type = OSPF_AUTH_NOTSET;
}
else
{
- vty_out (vty, "Unexpected input encountered%s", VTY_NEWLINE);
+ vty_out (vty, "Unexpected input encountered%s", VTYNL);
return CMD_WARNING;
}
/*
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
params = ospf_lookup_if_params (ifp, addr);
if (params == NULL)
{
- vty_out (vty, "Ip Address specified is unknown%s", VTY_NEWLINE);
+ vty_out (vty, "Ip Address specified is unknown%s", VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
key_id = strtol (keyid, NULL, 10);
if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
{
- vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
+ vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
if (ck == NULL)
{
- vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
+ vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTYNL);
return CMD_WARNING;
}
if(!inet_aton(ifaddr, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(ifaddr, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (interval_str)
{
- VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str,
- 1, 65535);
+ seconds = strtoul(interval_str, NULL, 10);
/* reset fast_hello too, just to be sure */
UNSET_IF_PARAM (params, fast_hello);
}
else if (fast_hello_str)
{
- VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str,
- 1, 10);
+ hellomult = strtoul(fast_hello_str, NULL, 10);
/* 1s dead-interval with sub-second hellos desired */
seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL;
SET_IF_PARAM (params, fast_hello);
else
{
vty_out (vty, "Please specify dead-interval or hello-multiplier%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if(!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if(!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (old_type == OSPF_IFTYPE_LOOPBACK)
{
- vty_out (vty, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE);
+ vty_out (vty, "This is a loopback interface. Can't set network type.%s", VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
DEFUN (ip_ospf_area,
ip_ospf_area_cmd,
- "ip ospf [(1-65535)] area <A.B.C.D|(0-4294967295)>",
+ "ip ospf [(1-65535)] area <A.B.C.D|(0-4294967295)> [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Instance ID\n"
"Enable OSPF on this interface\n"
"OSPF area ID in IP address format\n"
- "OSPF area ID as a decimal value\n")
+ "OSPF area ID as a decimal value\n"
+ "Address of interface\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx = 0;
int format, ret;
struct in_addr area_id;
- struct ospf *ospf;
+ struct in_addr addr;
struct ospf_if_params *params;
struct route_node *rn;
+ struct ospf *ospf;
u_short instance = 0;
+ char *areaid;
if (argv_find (argv, argc, "(1-65535)", &idx))
instance = strtol (argv[idx]->arg, NULL, 10);
- char *areaid = argv[argc - 1]->arg;
+
+ argv_find (argv, argc, "area", &idx);
+ areaid = argv[idx + 1]->arg;
ospf = ospf_lookup_instance (instance);
if (ospf == NULL)
params = IF_DEF_PARAMS (ifp);
if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
{
- ospf_interface_unset (ifp);
+ UNSET_IF_PARAM (params, if_area);
+ ospf_interface_area_unset (ifp);
ospf = ospf_lookup();
ospf->if_ospf_cli_count--;
}
if (ret < 0)
{
vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (memcmp (ifp->name, "VLINK", 5) == 0)
{
- vty_out (vty, "Cannot enable OSPF on a virtual link.%s", VTY_NEWLINE);
+ vty_out (vty, "Cannot enable OSPF on a virtual link.%s", VTYNL);
return CMD_WARNING;
}
{
vty_out (vty,
"Must remove previous area config before changing ospf area %s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
+ // Check if we have an address arg and proccess it
+ if (argc == idx + 3) {
+ inet_aton(argv[idx+2]->arg, &addr);
+ // update/create address-level params
+ params = ospf_get_if_params ((ifp), (addr));
+ if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
+ {
+ vty_out (vty,
+ "Must remove previous area/address config before changing ospf area");
+ return CMD_WARNING;
+ }
+ ospf_if_update_params ((ifp), (addr));
+ }
+
for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
{
if (rn->info != NULL)
{
- vty_out (vty, "Please remove all network commands first.%s", VTY_NEWLINE);
+ vty_out (vty, "Please remove all network commands first.%s", VTYNL);
return CMD_WARNING;
}
}
/* enable ospf on this interface with area_id */
- ospf_interface_set (ifp, area_id);
+ SET_IF_PARAM (params, if_area);
+ params->if_area = area_id;
+ ospf_interface_area_set (ifp);
ospf->if_ospf_cli_count++;
return CMD_SUCCESS;
DEFUN (no_ip_ospf_area,
no_ip_ospf_area_cmd,
- "no ip ospf [(1-65535)] area [<A.B.C.D|(0-4294967295)>]",
+ "no ip ospf [(1-65535)] area [<A.B.C.D|(0-4294967295)> [A.B.C.D]]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Instance ID\n"
"Disable OSPF on this interface\n"
"OSPF area ID in IP address format\n"
- "OSPF area ID as a decimal value\n")
+ "OSPF area ID as a decimal value\n"
+ "Address of interface\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx = 0;
struct ospf *ospf;
struct ospf_if_params *params;
u_short instance = 0;
-
+ struct in_addr addr;
+
if (argv_find (argv, argc, "(1-65535)", &idx))
instance = strtol (argv[idx]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL)
return CMD_SUCCESS;
- params = IF_DEF_PARAMS (ifp);
+ argv_find (argv, argc, "area", &idx);
+
+ // Check if we have an address arg and proccess it
+ if (argc == idx + 3) {
+ inet_aton(argv[idx+2]->arg, &addr);
+ params = ospf_lookup_if_params (ifp, addr);
+ if ((params) == NULL)
+ return CMD_SUCCESS;
+ }
+ else
+ params = IF_DEF_PARAMS (ifp);
+
if (!OSPF_IF_PARAM_CONFIGURED(params, if_area))
{
- vty_out (vty, "Can't find specified interface area configuration.%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find specified interface area configuration.");
return CMD_WARNING;
- }
+ }
- ospf_interface_unset (ifp);
+ UNSET_IF_PARAM (params, if_area);
+ if (params != IF_DEF_PARAMS ((ifp)))
+ {
+ ospf_free_if_params ((ifp), (addr));
+ ospf_if_update_params ((ifp), (addr));
+ }
+
+ ospf_interface_area_unset (ifp);
ospf->if_ospf_cli_count--;
return CMD_SUCCESS;
}
source = proto_redistnum (AFI_IP, argv[idx_ospf_table]->text);
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if (!ospf)
return CMD_SUCCESS;
if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance)
{
vty_out (vty, "Instance redistribution in non-instanced OSPF not allowed%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if ((source == ZEBRA_ROUTE_OSPF) && (ospf->instance == instance))
{
vty_out (vty, "Same instance OSPF redistribution not allowed%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
else
source = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance)
{
vty_out (vty, "Instance redistribution in non-instanced OSPF not allowed%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if ((source == ZEBRA_ROUTE_OSPF) && (ospf->instance == instance))
{
vty_out (vty, "Same instance OSPF redistribution not allowed%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
params = ospf_get_if_params (ifp, addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
+ VTYNL);
return CMD_WARNING;
}
params = ospf_get_if_params (ifp, addr);
return CMD_WARNING;
}
- VTY_GET_INTEGER ("stub-router startup period", seconds, argv[idx_number]->arg);
+ seconds = strtoul(argv[idx_number]->arg, NULL, 10);
ospf->stub_router_startup_time = seconds;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[idx_number]->arg);
+ seconds = strtoul(argv[idx_number]->arg, NULL, 10);
ospf->stub_router_shutdown_time = seconds;
if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED)
vty_out (vty, " max-metric router-lsa on-startup %u%s",
- ospf->stub_router_startup_time, VTY_NEWLINE);
+ ospf->stub_router_startup_time, VTYNL);
if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED)
vty_out (vty, " max-metric router-lsa on-shutdown %u%s",
- ospf->stub_router_shutdown_time, VTY_NEWLINE);
+ ospf->stub_router_shutdown_time, VTYNL);
for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area))
{
if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
{
vty_out (vty, " max-metric router-lsa administrative%s",
- VTY_NEWLINE);
+ VTYNL);
break;
}
}
struct ospf_path *path;
vty_out (vty, "============ OSPF network routing table ============%s",
- VTY_NEWLINE);
+ VTYNL);
for (rn = route_top (rt); rn; rn = route_next (rn))
if ((or = rn->info) != NULL)
case OSPF_PATH_INTER_AREA:
if (or->type == OSPF_DESTINATION_NETWORK)
vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost,
- inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
+ inet_ntoa (or->u.std.area_id), VTYNL);
else if (or->type == OSPF_DESTINATION_DISCARD)
- vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE);
+ vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTYNL);
break;
case OSPF_PATH_INTRA_AREA:
vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost,
- inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
+ inet_ntoa (or->u.std.area_id), VTYNL);
break;
default:
break;
{
if (path->nexthop.s_addr == 0)
vty_out (vty, "%24s directly attached to %s%s",
- "", ifindex2ifname (path->ifindex, VRF_DEFAULT), VTY_NEWLINE);
+ "", ifindex2ifname (path->ifindex, VRF_DEFAULT), VTYNL);
else
vty_out (vty, "%24s via %s, %s%s", "",
inet_ntoa (path->nexthop),
- ifindex2ifname (path->ifindex, VRF_DEFAULT), VTY_NEWLINE);
+ ifindex2ifname (path->ifindex, VRF_DEFAULT), VTYNL);
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
static void
struct ospf_path *path;
vty_out (vty, "============ OSPF router routing table =============%s",
- VTY_NEWLINE);
+ VTYNL);
for (rn = route_top (rtrs); rn; rn = route_next (rn))
if (rn->info)
{
vty_out (vty, "%s%s%s",
(or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""),
(or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""),
- VTY_NEWLINE);
+ VTYNL);
for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
{
if (path->nexthop.s_addr == 0)
vty_out (vty, "%24s directly attached to %s%s",
"", ifindex2ifname (path->ifindex, VRF_DEFAULT),
- VTY_NEWLINE);
+ VTYNL);
else
vty_out (vty, "%24s via %s, %s%s", "",
inet_ntoa (path->nexthop),
ifindex2ifname (path->ifindex, VRF_DEFAULT),
- VTY_NEWLINE);
+ VTYNL);
}
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
static void
struct ospf_path *path;
vty_out (vty, "============ OSPF external routing table ===========%s",
- VTY_NEWLINE);
+ VTYNL);
for (rn = route_top (rt); rn; rn = route_next (rn))
if ((er = rn->info) != NULL)
{
{
case OSPF_PATH_TYPE1_EXTERNAL:
vty_out (vty, "N E1 %-18s [%d] tag: %"ROUTE_TAG_PRI"%s", buf1,
- er->cost, er->u.ext.tag, VTY_NEWLINE);
+ er->cost, er->u.ext.tag, VTYNL);
break;
case OSPF_PATH_TYPE2_EXTERNAL:
vty_out (vty, "N E2 %-18s [%d/%d] tag: %"ROUTE_TAG_PRI"%s", buf1, er->cost,
- er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
+ er->u.ext.type2_cost, er->u.ext.tag, VTYNL);
break;
}
{
if (path->nexthop.s_addr == 0)
vty_out (vty, "%24s directly attached to %s%s",
- "", ifindex2ifname (path->ifindex, VRF_DEFAULT), VTY_NEWLINE);
+ "", ifindex2ifname (path->ifindex, VRF_DEFAULT), VTYNL);
else
vty_out (vty, "%24s via %s, %s%s", "",
inet_ntoa (path->nexthop),
ifindex2ifname (path->ifindex, VRF_DEFAULT),
- VTY_NEWLINE);
+ VTYNL);
}
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
static int
show_ip_ospf_border_routers_common (struct vty *vty, struct ospf *ospf)
{
if (ospf->instance)
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
if (ospf->new_table == NULL)
{
- vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
+ vty_out (vty, "No OSPF routing information exist%s", VTYNL);
return CMD_SUCCESS;
}
/* Show Router routes. */
show_ip_ospf_route_router (vty, ospf->new_rtrs);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
show_ip_ospf_route_common (struct vty *vty, struct ospf *ospf)
{
if (ospf->instance)
- vty_out (vty, "%sOSPF Instance: %d%s%s", VTY_NEWLINE, ospf->instance,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, "%sOSPF Instance: %d%s%s", VTYNL, ospf->instance,
+ VTYNL, VTYNL);
if (ospf->new_table == NULL)
{
- vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
+ vty_out (vty, "No OSPF routing information exist%s", VTYNL);
return CMD_SUCCESS;
}
/* Show AS External routes. */
show_ip_ospf_route_external (vty, ospf->old_external_route);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
return CMD_SUCCESS;
}
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (ifp->ifindex == IFINDEX_DELETED)
continue;
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_out (vty, "!%s", VTYNL);
vty_out (vty, "interface %s%s", ifp->name,
- VTY_NEWLINE);
+ VTYNL);
if (ifp->desc)
vty_out (vty, " description %s%s", ifp->desc,
- VTY_NEWLINE);
+ VTYNL);
write++;
ospf_int_type_str[params->type]);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
vty_out (vty, " ip ospf authentication%s", auth_str);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Simple Authentication Password print. */
params->auth_simple);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Cryptographic Authentication Key print. */
ck->key_id, ck->auth_key);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Interface Output Cost print. */
vty_out (vty, " ip ospf cost %u", params->output_cost_cmd);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Hello Interval print. */
vty_out (vty, " ip ospf hello-interval %u", params->v_hello);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Router Priority print. */
vty_out (vty, " ip ospf priority %u", params->priority);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Retransmit Interval print. */
params->retransmit_interval);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Transmit Delay print. */
vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay);
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Area print. */
if (OSPF_IF_PARAM_CONFIGURED (params, if_area))
{
if (ospf->instance)
- vty_out (vty, " ip ospf %d area %s%s", ospf->instance,
- inet_ntoa (params->if_area), VTY_NEWLINE);
+ vty_out (vty, " ip ospf %d", ospf->instance);
else
- vty_out (vty, " ip ospf area %s%s",
- inet_ntoa (params->if_area), VTY_NEWLINE);
+ vty_out (vty, " ip ospf");
+ vty_out (vty, " area %s", inet_ntoa (params->if_area));
+ if (params != IF_DEF_PARAMS (ifp))
+ vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
+ vty_out (vty, VTYNL);
}
/* bfd print. */
vty_out (vty, " ip ospf mtu-ignore");
if (params != IF_DEF_PARAMS (ifp))
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
/* Network print. */
vty_out (vty, " network %s/%d area %s%s",
inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
- buf, VTY_NEWLINE);
+ buf, VTYNL);
}
return 0;
if (area->auth_type != OSPF_AUTH_NULL)
{
if (area->auth_type == OSPF_AUTH_SIMPLE)
- vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE);
+ vty_out (vty, " area %s authentication%s", buf, VTYNL);
else
vty_out (vty, " area %s authentication message-digest%s",
- buf, VTY_NEWLINE);
+ buf, VTYNL);
}
if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT)
vty_out (vty, " area %s shortcut %s%s", buf,
ospf_shortcut_mode_str[area->shortcut_configured],
- VTY_NEWLINE);
+ VTYNL);
if ((area->external_routing == OSPF_AREA_STUB)
|| (area->external_routing == OSPF_AREA_NSSA)
if (area->no_summary)
vty_out (vty, " no-summary");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
if (area->default_cost != 1)
vty_out (vty, " area %s default-cost %d%s", buf,
- area->default_cost, VTY_NEWLINE);
+ area->default_cost, VTYNL);
}
for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1))
vty_out (vty, " substitute %s/%d",
inet_ntoa (range->subst_addr), range->subst_masklen);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
if (EXPORT_NAME (area))
vty_out (vty, " area %s export-list %s%s", buf,
- EXPORT_NAME (area), VTY_NEWLINE);
+ EXPORT_NAME (area), VTYNL);
if (IMPORT_NAME (area))
vty_out (vty, " area %s import-list %s%s", buf,
- IMPORT_NAME (area), VTY_NEWLINE);
+ IMPORT_NAME (area), VTYNL);
if (PREFIX_NAME_IN (area))
vty_out (vty, " area %s filter-list prefix %s in%s", buf,
- PREFIX_NAME_IN (area), VTY_NEWLINE);
+ PREFIX_NAME_IN (area), VTYNL);
if (PREFIX_NAME_OUT (area))
vty_out (vty, " area %s filter-list prefix %s out%s", buf,
- PREFIX_NAME_OUT (area), VTY_NEWLINE);
+ PREFIX_NAME_OUT (area), VTYNL);
}
return 0;
if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
vty_out (vty, " poll-interval %d", nbr_nbma->v_poll);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
return 0;
OSPF_IF_PARAM (oi, retransmit_interval),
OSPF_IF_PARAM (oi, transmit_delay),
OSPF_IF_PARAM (oi, v_wait),
- VTY_NEWLINE);
+ VTYNL);
else
vty_out (vty, " area %s virtual-link %s%s", buf,
- inet_ntoa (vl_data->vl_peer), VTY_NEWLINE);
+ inet_ntoa (vl_data->vl_peer), VTYNL);
/* Auth key */
if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0')
vty_out (vty, " area %s virtual-link %s authentication-key %s%s",
buf,
inet_ntoa (vl_data->vl_peer),
IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple,
- VTY_NEWLINE);
+ VTYNL);
/* md5 keys */
for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt,
n2, ck))
" message-digest-key %d md5 %s%s",
buf,
inet_ntoa (vl_data->vl_peer),
- ck->key_id, ck->auth_key, VTY_NEWLINE);
+ ck->key_id, ck->auth_key, VTYNL);
}
}
if (ROUTEMAP_NAME (red))
vty_out (vty, " route-map %s", ROUTEMAP_NAME (red));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
{
if (ospf->default_metric != -1)
vty_out (vty, " default-metric %d%s", ospf->default_metric,
- VTY_NEWLINE);
+ VTYNL);
return 0;
}
if (DISTRIBUTE_NAME (ospf, type))
vty_out (vty, " distribute-list %s out %s%s",
DISTRIBUTE_NAME (ospf, type),
- zebra_route_string(type), VTY_NEWLINE);
+ zebra_route_string(type), VTYNL);
/* default-information print. */
if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
ROUTEMAP_NAME (red));
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
struct ospf_distance *odistance;
if (ospf->distance_all)
- vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE);
+ vty_out (vty, " distance %d%s", ospf->distance_all, VTYNL);
if (ospf->distance_intra
|| ospf->distance_inter
if (ospf->distance_external)
vty_out (vty, " external %d", ospf->distance_external);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn))
vty_out (vty, " distance %d %s/%d %s%s", odistance->distance,
inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
odistance->access_list ? odistance->access_list : "",
- VTY_NEWLINE);
+ VTYNL);
}
return 0;
}
{
/* `router ospf' print. */
if (ospf->instance)
- vty_out (vty, "router ospf %d%s", ospf->instance, VTY_NEWLINE);
+ vty_out (vty, "router ospf %d%s", ospf->instance, VTYNL);
else
- vty_out (vty, "router ospf%s", VTY_NEWLINE);
+ vty_out (vty, "router ospf%s", VTYNL);
write++;
/* Router ID print. */
if (ospf->router_id_static.s_addr != 0)
vty_out (vty, " ospf router-id %s%s",
- inet_ntoa (ospf->router_id_static), VTY_NEWLINE);
+ inet_ntoa (ospf->router_id_static), VTYNL);
/* ABR type print. */
if (ospf->abr_type != OSPF_ABR_DEFAULT)
vty_out (vty, " ospf abr-type %s%s",
- ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE);
+ ospf_abr_type_str[ospf->abr_type], VTYNL);
/* log-adjacency-changes flag print. */
if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES))
{
if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL))
- vty_out(vty, " log-adjacency-changes detail%s", VTY_NEWLINE);
+ vty_out(vty, " log-adjacency-changes detail%s", VTYNL);
else if (!DFLT_OSPF_LOG_ADJACENCY_CHANGES)
- vty_out(vty, " log-adjacency-changes%s", VTY_NEWLINE);
+ vty_out(vty, " log-adjacency-changes%s", VTYNL);
}
else if (DFLT_OSPF_LOG_ADJACENCY_CHANGES)
{
- vty_out(vty, " no log-adjacency-changes%s", VTY_NEWLINE);
+ vty_out(vty, " no log-adjacency-changes%s", VTYNL);
}
/* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
- vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE);
+ vty_out (vty, " compatible rfc1583%s", VTYNL);
/* auto-cost reference-bandwidth configuration. */
if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
{
vty_out (vty, "! Important: ensure reference bandwidth "
- "is consistent across all routers%s", VTY_NEWLINE);
+ "is consistent across all routers%s", VTYNL);
vty_out (vty, " auto-cost reference-bandwidth %d%s",
- ospf->ref_bandwidth, VTY_NEWLINE);
+ ospf->ref_bandwidth, VTYNL);
}
/* SPF timers print. */
ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT)
vty_out (vty, " timers throttle spf %d %d %d%s",
ospf->spf_delay, ospf->spf_holdtime,
- ospf->spf_max_holdtime, VTY_NEWLINE);
+ ospf->spf_max_holdtime, VTYNL);
/* LSA timers print. */
if (ospf->min_ls_interval != OSPF_MIN_LS_INTERVAL)
vty_out (vty, " timers throttle lsa all %d%s",
- ospf->min_ls_interval, VTY_NEWLINE);
+ ospf->min_ls_interval, VTYNL);
if (ospf->min_ls_arrival != OSPF_MIN_LS_ARRIVAL)
vty_out (vty, " timers lsa min-arrival %d%s",
- ospf->min_ls_arrival, VTY_NEWLINE);
+ ospf->min_ls_arrival, VTYNL);
/* Write multiplier print. */
if (ospf->write_oi_count != OSPF_WRITE_INTERFACE_COUNT_DEFAULT)
vty_out (vty, " ospf write-multiplier %d%s",
- ospf->write_oi_count, VTY_NEWLINE);
+ ospf->write_oi_count, VTYNL);
/* Max-metric router-lsa print */
config_write_stub_router (vty, ospf);
/* SPF refresh parameters print. */
if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
vty_out (vty, " refresh timer %d%s",
- ospf->lsa_refresh_interval, VTY_NEWLINE);
+ ospf->lsa_refresh_interval, VTYNL);
/* Redistribute information print. */
config_write_ospf_redistribute (vty, ospf);
/* passive-interface print. */
if (ospf->passive_interface_default == OSPF_IF_PASSIVE)
- vty_out (vty, " passive-interface default%s", VTY_NEWLINE);
+ vty_out (vty, " passive-interface default%s", VTYNL);
for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)
{
vty_out (vty, " %spassive-interface %s%s",
IF_DEF_PARAMS (ifp)->passive_interface ? "" : "no ",
- ifp->name, VTY_NEWLINE);
+ ifp->name, VTYNL);
}
for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
{
vty_out (vty, " %spassive-interface %s %s%s",
oi->params->passive_interface ? "" : "no ",
oi->ifp->name,
- inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
+ inet_ntoa (oi->address->u.prefix4), VTYNL);
}
/* Network area print. */
install_element (VIEW_NODE, &show_ip_ospf_instance_cmd);
/* "show ip ospf database" commands. */
- install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
install_element (VIEW_NODE, &show_ip_ospf_database_max_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd);
else /* Interface name is specified. */
{
if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg, VRF_DEFAULT)) == NULL)
- vty_out (vty, "No such interface name%s", VTY_NEWLINE);
+ vty_out (vty, "No such interface name%s", VTYNL);
else
ospf_interface_clear(ifp);
}
retv = str2area_id ((STR), &(V), &(F)); \
if (retv < 0) \
{ \
- vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \
+ vty_out (vty, "%% Invalid OSPF area ID%s", VTYNL); \
return CMD_WARNING; \
} \
}
retv = str2area_id ((STR), &(V), &(F)); \
if (retv < 0) \
{ \
- vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \
+ vty_out (vty, "%% Invalid OSPF area ID%s", VTYNL); \
return CMD_WARNING; \
} \
if (OSPF_IS_AREA_ID_BACKBONE ((V))) \
{ \
vty_out (vty, "%% You can't configure %s to backbone%s", \
- NAME, VTY_NEWLINE); \
+ NAME, VTYNL); \
} \
}
zebra_interface_if_set_value (zclient->ibuf, ifp);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- zlog_debug ("Zebra: Interface[%s] state update.", ifp->name);
+ zlog_debug ("Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
+ ifp->name, if_tmp.speed, ifp->speed, if_tmp.bandwidth, ifp->bandwidth);
- if (if_tmp.bandwidth != ifp->bandwidth)
- {
- if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.",
- ifp->name, if_tmp.bandwidth, ifp->bandwidth);
-
- ospf_if_recalculate_output_cost (ifp);
- }
+ ospf_if_recalculate_output_cost (ifp);
if (if_tmp.mtu != ifp->mtu)
{
ret = str2prefix_ipv4 (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
ret = str2prefix_ipv4 (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
rn = route_node_lookup (ospf->distance_table, (struct prefix *) &p);
if (!rn)
{
- vty_out (vty, "Can't find specified prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find specified prefix");
return CMD_WARNING;
}
static void ospf_network_free (struct ospf *, struct ospf_network *);
static void ospf_area_free (struct ospf_area *);
static void ospf_network_run (struct prefix *, struct ospf_area *);
-static void ospf_network_run_interface (struct prefix *, struct ospf_area *,
- struct interface *);
+static void ospf_network_run_interface (struct ospf *, struct interface *,
+ struct prefix *, struct ospf_area *);
+static void ospf_network_run_subnet (struct ospf *, struct connected *,
+ struct prefix *, struct ospf_area *);
static int ospf_network_match_iface (const struct connected *,
const struct prefix *);
static void ospf_finish_final (struct ospf *);
return NULL;
}
+static int
+ospf_is_ready (struct ospf *ospf)
+{
+ /* OSPF must be on and Router-ID must be configured. */
+ if (!ospf || ospf->router_id.s_addr == 0)
+ return 0;
+
+ return 1;
+}
+
static void
ospf_add (struct ospf *ospf)
{
* One or more ospf_finish()'s may have deferred shutdown to a timer
* thread
*/
+ zclient_stop (zclient);
+ zclient_free (zclient);
}
void
listnode_delete (area->oiflist, oi);
}
-static struct ospf_interface *
-add_ospf_interface (struct interface *ifp, struct ospf_area *area,
- struct connected *co)
+
+
+static void
+add_ospf_interface (struct connected *co, struct ospf_area *area)
{
struct ospf_interface *oi;
- oi = ospf_if_new (area->ospf, ifp, co->address);
+ oi = ospf_if_new (area->ospf, co->ifp, co->address);
oi->connected = co;
oi->area = area;
- oi->params = ospf_lookup_if_params (ifp, oi->address->u.prefix4);
+ oi->params = ospf_lookup_if_params (co->ifp, oi->address->u.prefix4);
oi->output_cost = ospf_if_get_output_cost (oi);
/* Relate ospf interface to ospf instance. */
/* update network type as interface flag */
/* If network type is specified previously,
skip network type setting. */
- oi->type = IF_DEF_PARAMS (ifp)->type;
+ oi->type = IF_DEF_PARAMS (co->ifp)->type;
/* Add pseudo neighbor. */
ospf_nbr_self_reset (oi, oi->ospf->router_id);
ospf_area_add_if (oi->area, oi);
- return (oi);
+ /*
+ * if router_id is not configured, dont bring up
+ * interfaces.
+ * ospf_router_id_update() will call ospf_if_update
+ * whenever r-id is configured instead.
+ */
+ if ((area->ospf->router_id.s_addr != 0)
+ && if_is_operative (co->ifp))
+ ospf_if_up (oi);
+
}
static void update_redistributed(struct ospf *ospf, int add_to_ospf)
}
}
-
/* Config network statement related functions. */
static struct ospf_network *
ospf_network_new (struct in_addr area_id)
/* Find interfaces that not configured already. */
for (ALL_LIST_ELEMENTS (ospf->oiflist, node, nnode, oi))
{
- int found = 0;
- struct connected *co = oi->connected;
-
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
- continue;
-
- for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
- {
- if (rn->info == NULL)
- continue;
-
- if (ospf_network_match_iface(co,&rn->p))
- {
- found = 1;
- route_unlock_node (rn);
- break;
- }
- }
-
- if (found == 0)
- {
- ospf_if_free (oi);
- ospf_area_check_free (ospf, area_id);
- }
+ ospf_network_run_subnet (ospf, oi->connected, NULL, NULL);
}
/* Update connected redistribute. */
return 1;
}
-int
-ospf_interface_set (struct interface *ifp, struct in_addr area_id)
+/* Ensure there's an OSPF instance, as "ip ospf area" enabled OSPF means
+ * there might not be any 'router ospf' config.
+ *
+ * Otherwise, doesn't do anything different to ospf_if_update for now
+ */
+void
+ospf_interface_area_set (struct interface *ifp)
{
- struct ospf_area *area;
- struct listnode *cnode;
- struct connected *co;
- struct ospf *ospf;
- struct ospf_if_params *params;
- struct ospf_interface *oi;
-
- if ((ospf = ospf_lookup ()) == NULL)
- return 1; /* Ospf not ready yet */
-
- params = IF_DEF_PARAMS (ifp);
-
- SET_IF_PARAM (params, if_area);
- params->if_area = area_id;
-
- area = ospf_area_get (ospf, area_id);
-
- for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, co))
- {
- if (CHECK_FLAG(co->flags,ZEBRA_IFA_SECONDARY))
- continue;
-
- if (co->address->family == AF_INET)
- {
- oi = ospf_if_table_lookup(ifp, co->address);
- if (!oi)
- oi = add_ospf_interface(ifp, area, co);
-
- /* if router_id is not configured, dont bring up
- * interfaces.
- * ospf_router_id_update() will call ospf_if_update
- * whenever r-id is configured instead.
- */
- if ((area->ospf->router_id.s_addr != 0) && if_is_operative (ifp))
- ospf_if_up (oi);
- }
- }
-
- /* Update connected redistribute. */
- update_redistributed(ospf, 1); /* interface possibly added */
- return 1;
+ struct ospf *ospf = ospf_get();
+
+ ospf_if_update (ospf, ifp);
+ /* if_update does a update_redistributed */
+
+ return;
}
-int
-ospf_interface_unset (struct interface *ifp)
+void
+ospf_interface_area_unset (struct interface *ifp)
{
+ struct route_node *rn_oi;
struct ospf *ospf;
- struct ospf_if_params *params;
- struct listnode *node, *nnode;
- struct ospf_interface *oi;
- struct in_addr area_id;
ospf = ospf_lookup ();
if (!ospf)
- return 1; /* Ospf not ready yet */
-
- params = IF_DEF_PARAMS (ifp);
- UNSET_IF_PARAM (params, if_area);
- area_id = params->if_area;
+ return; /* Ospf not ready yet */
- for (ALL_LIST_ELEMENTS (ospf->oiflist, node, nnode, oi))
+ /* Find interfaces that may need to be removed. */
+ for (rn_oi = route_top (IF_OIFS (ifp)); rn_oi; rn_oi = route_next (rn_oi))
{
+ struct ospf_interface *oi;
+
+ if ( (oi = rn_oi->info) == NULL)
+ continue;
+
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
- continue;
- if (oi->ifp == ifp) ospf_if_free (oi);
+ continue;
+
+ ospf_network_run_subnet (ospf, oi->connected, NULL, NULL);
}
/* Update connected redistribute. */
update_redistributed(ospf, 0); /* interfaces possibly removed */
- ospf_area_check_free (ospf, area_id);
-
- return 1;
}
/* Check whether interface matches given network
ospf_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
-ospf_network_run_interface (struct prefix *p, struct ospf_area *area,
- struct interface *ifp)
+ospf_update_interface_area (struct connected *co, struct ospf_area *area)
+{
+ struct ospf_interface *oi = ospf_if_table_lookup (co->ifp, co->address);
+
+ /* nothing to be done case */
+ if (oi && oi->area == area){
+ return;
+ }
+
+ if (oi)
+ ospf_if_free (oi);
+
+ add_ospf_interface (co, area);
+}
+
+/* Run OSPF for the given subnet, taking into account the following
+ * possible sources of area configuration, in the given order of preference:
+ *
+ * - Whether there is interface+address specific area configuration
+ * - Whether there is a default area for the interface
+ * - Whether there is an area given as a parameter.
+ * - If no specific network prefix/area is supplied, whether there's
+ * a matching network configured.
+ */
+static void
+ospf_network_run_subnet (struct ospf *ospf, struct connected *co,
+ struct prefix *p, struct ospf_area *given_area)
+{
+ struct ospf_interface *oi;
+ struct ospf_if_params *params;
+ struct ospf_area *area = NULL;
+ struct route_node *rn;
+ int configed = 0;
+
+ if (CHECK_FLAG(co->flags, ZEBRA_IFA_SECONDARY))
+ return;
+
+ if (co->address->family != AF_INET)
+ return;
+
+ /* Try determine the appropriate area for this interface + address
+ * Start by checking interface config
+ */
+ params = ospf_lookup_if_params (co->ifp, co->address->u.prefix4);
+ if ( params && OSPF_IF_PARAM_CONFIGURED(params, if_area))
+ area = ospf_area_get (ospf, params->if_area);
+ else{
+ params = IF_DEF_PARAMS (co->ifp);
+ if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
+ area = ospf_area_get (ospf, params->if_area);
+ }
+
+ /* If we've found an interface and/or addr specific area, then we're
+ * done
+ */
+ if (area)
+ {
+ ospf_update_interface_area (co, area);
+ return;
+ }
+
+ /* Otherwise, only remaining possibility is a matching network statement */
+ if (p)
+ {
+ assert (given_area != NULL);
+
+ /* Which either was supplied as a parameter.. (e.g. cause a new
+ * network/area was just added)..
+ */
+ if (p->family == co->address->family
+ && ospf_network_match_iface (co, p))
+ ospf_update_interface_area (co, given_area);
+
+ return;
+ }
+
+ /* Else we have to search the existing network/area config to see
+ * if any match..
+ */
+ for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
+ if (rn->info != NULL
+ && ospf_network_match_iface (co, &rn->p))
+ {
+ struct ospf_network *network = (struct ospf_network *) rn->info;
+ area = ospf_area_get (ospf, network->area_id);
+ ospf_update_interface_area (co, area);
+ configed = 1;
+ }
+
+ /* If the subnet isn't in any area, deconfigure */
+ if (!configed && (oi = ospf_if_table_lookup (co->ifp, co->address)))
+ ospf_if_free (oi);
+}
+
+static void
+ospf_network_run_interface (struct ospf *ospf, struct interface *ifp,
+ struct prefix *p,
+ struct ospf_area *given_area)
{
struct listnode *cnode;
struct connected *co;
if (memcmp (ifp->name, "VLINK", 5) == 0)
return;
+ /* Network prefix without area is nonsensical */
+ if (p)
+ assert (given_area != NULL);
+
/* if interface prefix is match specified prefix,
then create socket and join multicast group. */
for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, co))
- {
-
- if (CHECK_FLAG(co->flags,ZEBRA_IFA_SECONDARY))
- continue;
-
- if (p->family == co->address->family
- && ! ospf_if_table_lookup(ifp, co->address)
- && ospf_network_match_iface(co,p))
- {
- struct ospf_interface *oi;
-
- oi = ospf_if_new (area->ospf, ifp, co->address);
- oi->connected = co;
-
- oi->area = area;
-
- oi->params = ospf_lookup_if_params (ifp, oi->address->u.prefix4);
- oi->output_cost = ospf_if_get_output_cost (oi);
-
- /* Add pseudo neighbor. */
- ospf_nbr_add_self (oi, oi->ospf->router_id);
-
- /* Relate ospf interface to ospf instance. */
- oi->ospf = area->ospf;
-
- /* update network type as interface flag */
- /* If network type is specified previously,
- skip network type setting. */
- oi->type = IF_DEF_PARAMS (ifp)->type;
-
- ospf_area_add_if (oi->area, oi);
-
- /* if router_id is not configured, dont bring up
- * interfaces.
- * ospf_router_id_update() will call ospf_if_update
- * whenever r-id is configured instead.
- */
- if ((area->ospf->router_id.s_addr != 0)
- && if_is_operative (ifp))
- ospf_if_up (oi);
- }
- }
+ ospf_network_run_subnet (ospf, co, p, given_area);
}
static void
/* Get target interface. */
for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
- ospf_network_run_interface (p, area, ifp);
+ ospf_network_run_interface (area->ospf, ifp, p, area);
}
void
void
ospf_if_update (struct ospf *ospf, struct interface *ifp)
{
- struct route_node *rn;
- struct ospf_network *network;
- struct ospf_area *area;
- struct ospf_if_params *params;
-
if (!ospf)
ospf = ospf_lookup ();
- /* OSPF must be on and Router-ID must be configured. */
- if (!ospf || ospf->router_id.s_addr == 0)
+ /* OSPF must be ready. */
+ if (!ospf_is_ready (ospf))
return;
- /* Run each netowrk for this interface. */
- for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
- if (rn->info != NULL)
- {
- network = (struct ospf_network *) rn->info;
- area = ospf_area_get (ospf, network->area_id);
- ospf_network_run_interface (&rn->p, area, ifp);
- }
-
- /* create oif for any new co */
- params = IF_DEF_PARAMS (ifp);
- if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
- {
- ospf_interface_set (ifp, params->if_area);
- }
+ ospf_network_run_interface (ospf, ifp, NULL, NULL);
+
+ /* Update connected redistribute. */
+ update_redistributed(ospf, 1);
}
void
extern void ospf_area_add_if (struct ospf_area *, struct ospf_interface *);
extern void ospf_area_del_if (struct ospf_area *, struct ospf_interface *);
+extern void ospf_interface_area_set (struct interface *);
+extern void ospf_interface_area_unset (struct interface *);
+
extern void ospf_route_map_init (void);
extern void ospf_master_init (struct thread_master *master);
-extern int ospf_interface_set (struct interface *ifp, struct in_addr area_id);
-extern int ospf_interface_unset (struct interface *ifp);
#endif /* _ZEBRA_OSPFD_H */
return;
if (CHECK_FLAG (bfd_info->flags, BFD_FLAG_PARAM_CFG))
- vty_out (vty, " ip pim bfd %d %d %d%s",
+ vty_outln (vty, " ip pim bfd %d %d %d",
bfd_info->detect_mult, bfd_info->required_min_rx,
- bfd_info->desired_min_tx, VTY_NEWLINE);
+ bfd_info->desired_min_tx);
else
- vty_out (vty, " ip pim bfd%s", VTY_NEWLINE);
+ vty_outln (vty, " ip pim bfd");
}
/*
now = pim_time_monotonic_sec();
- vty_out(vty,
- "Interface Address Source Group State Winner Uptime Timer%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group State Winner Uptime Timer");
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, ch_node, ch)) {
char ch_src_str[INET_ADDRSTRLEN];
pim_time_timer_to_mmss(timer, sizeof(timer),
ch->t_ifassert_timer);
- vty_out(vty, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %-6s %-15s %-8s %-5s",
ch->interface->name,
inet_ntoa(ifaddr),
ch_src_str,
pim_ifchannel_ifassert_name(ch->ifassert_state),
winner_str,
uptime,
- timer,
- VTY_NEWLINE);
+ timer);
} /* scan interface channels */
}
struct pim_ifchannel *ch;
struct in_addr ifaddr;
- vty_out(vty,
+ vty_outln (vty,
"CA: CouldAssert%s"
"ECA: Evaluate CouldAssert%s"
"ATD: AssertTrackingDesired%s"
- "eATD: Evaluate AssertTrackingDesired%s%s",
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ "eATD: Evaluate AssertTrackingDesired%s",
+ VTYNL, VTYNL, VTYNL, VTYNL);
- vty_out(vty,
- "Interface Address Source Group CA eCA ATD eATD%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group CA eCA ATD eATD");
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, ch_node, ch)) {
pim_ifp = ch->interface->info;
ch_src_str, sizeof(ch_src_str));
pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
- vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s",
ch->interface->name,
inet_ntoa(ifaddr),
ch_src_str,
PIM_IF_FLAG_TEST_COULD_ASSERT(ch->flags) ? "yes" : "no",
pim_macro_ch_could_assert_eval(ch) ? "yes" : "no",
PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch->flags) ? "yes" : "no",
- pim_macro_assert_tracking_desired_eval(ch) ? "yes" : "no",
- VTY_NEWLINE);
+ pim_macro_assert_tracking_desired_eval(ch) ? "yes" : "no");
} /* scan interface channels */
}
struct pim_ifchannel *ch;
struct in_addr ifaddr;
- vty_out(vty,
- "Interface Address Source Group RPT Pref Metric Address %s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group RPT Pref Metric Address ");
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, ch_node, ch)) {
pim_ifp = ch->interface->info;
pim_inet4_dump("<addr?>", am.ip_address,
addr_str, sizeof(addr_str));
- vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %-3s %4u %6u %-15s",
ch->interface->name,
inet_ntoa(ifaddr),
ch_src_str,
am.rpt_bit_flag ? "yes" : "no",
am.metric_preference,
am.route_metric,
- addr_str,
- VTY_NEWLINE);
+ addr_str);
} /* scan interface channels */
}
struct pim_ifchannel *ch;
struct in_addr ifaddr;
- vty_out(vty,
- "Interface Address Source Group RPT Pref Metric Address %s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group RPT Pref Metric Address ");
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, ch_node, ch)) {
pim_ifp = ch->interface->info;
else
snprintf(metr_str, sizeof(metr_str), "%6u", am->route_metric);
- vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %-3s %-4s %-6s %-15s",
ch->interface->name,
inet_ntoa(ifaddr),
ch_src_str,
am->rpt_bit_flag ? "yes" : "no",
pref_str,
metr_str,
- addr_str,
- VTY_NEWLINE);
+ addr_str);
} /* scan interface channels */
}
} /* scan interface channels */
if (uj) {
- 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));
} else {
- vty_out(vty,
- "Interface Address Source Group Membership%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group Membership");
/*
* Example of the json data we are traversing
vty_out(vty, "%-15s ", if_field_key);
json_object_object_get_ex(if_field_val, "localMembership", &json_tmp);
- vty_out(vty, "%-10s%s", json_object_get_string(json_tmp), VTY_NEWLINE);
+ vty_outln (vty, "%-10s", json_object_get_string(json_tmp));
}
}
}
static void pim_print_ifp_flags(struct vty *vty, struct interface *ifp, int mloop)
{
- vty_out(vty, "Flags%s", VTY_NEWLINE);
- vty_out(vty, "-----%s", VTY_NEWLINE);
- vty_out(vty, "All Multicast : %s%s", (ifp->flags & IFF_ALLMULTI) ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, "Broadcast : %s%s", if_is_broadcast(ifp)? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, "Deleted : %s%s", PIM_IF_IS_DELETED(ifp) ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, "Interface Index : %d%s", ifp->ifindex, VTY_NEWLINE);
- vty_out(vty, "Multicast : %s%s", if_is_multicast(ifp) ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, "Multicast Loop : %d%s", mloop, VTY_NEWLINE);
- vty_out(vty, "Promiscuous : %s%s", (ifp->flags & IFF_PROMISC) ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Flags");
+ vty_outln (vty, "-----");
+ vty_outln (vty, "All Multicast : %s",
+ (ifp->flags & IFF_ALLMULTI) ? "yes" : "no");
+ vty_outln (vty, "Broadcast : %s",
+ if_is_broadcast(ifp) ? "yes" : "no");
+ vty_outln (vty, "Deleted : %s",
+ PIM_IF_IS_DELETED(ifp) ? "yes" : "no");
+ vty_outln (vty, "Interface Index : %d", ifp->ifindex);
+ vty_outln (vty, "Multicast : %s",
+ if_is_multicast(ifp) ? "yes" : "no");
+ vty_outln (vty, "Multicast Loop : %d", mloop);
+ vty_outln (vty, "Promiscuous : %s",
+ (ifp->flags & IFF_PROMISC) ? "yes" : "no");
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
}
static void igmp_show_interfaces(struct vty *vty, u_char uj)
if (uj)
json = json_object_new_object();
else
- vty_out(vty,
- "Interface State Address V Querier Query Timer Uptime%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface State Address V Querier Query Timer Uptime");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
struct pim_interface *pim_ifp;
json_object_object_add(json, ifp->name, json_row);
} else {
- vty_out(vty, "%-9s %5s %15s %d %7s %11s %8s%s",
+ vty_outln (vty, "%-9s %5s %15s %d %7s %11s %8s",
ifp->name,
if_is_up(ifp) ? "up" : "down",
inet_ntoa(igmp->ifaddr),
pim_ifp->igmp_version,
igmp->t_igmp_query_timer ? "local" : "other",
query_hhmmss,
- uptime,
- VTY_NEWLINE);
+ uptime);
}
}
}
if (uj) {
- 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);
}
}
json_object_object_add(json, ifp->name, json_row);
} else {
- vty_out(vty, "Interface : %s%s", ifp->name, VTY_NEWLINE);
- vty_out(vty, "State : %s%s", if_is_up(ifp) ? "up" : "down", VTY_NEWLINE);
- vty_out(vty, "Address : %s%s", inet_ntoa(pim_ifp->primary_address), VTY_NEWLINE);
- vty_out(vty, "Uptime : %s%s", uptime, VTY_NEWLINE);
- vty_out(vty, "Version : %d%s", pim_ifp->igmp_version, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
-
- vty_out(vty, "Querier%s", VTY_NEWLINE);
- vty_out(vty, "-------%s", VTY_NEWLINE);
- vty_out(vty, "Querier : %s%s", igmp->t_igmp_query_timer ? "local" : "other", VTY_NEWLINE);
- vty_out(vty, "Start Count : %d%s", igmp->startup_query_count, VTY_NEWLINE);
- vty_out(vty, "Query Timer : %s%s", query_hhmmss, VTY_NEWLINE);
- vty_out(vty, "Other Timer : %s%s", other_hhmmss, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
-
- vty_out(vty, "Timers%s", VTY_NEWLINE);
- vty_out(vty, "------%s", VTY_NEWLINE);
- vty_out(vty, "Group Membership Interval : %lis%s", gmi_msec/1000, VTY_NEWLINE);
- vty_out(vty, "Last Member Query Time : %lis%s", lmqt_msec/1000, VTY_NEWLINE);
- vty_out(vty, "Older Host Present Interval : %lis%s", ohpi_msec/1000, VTY_NEWLINE);
- vty_out(vty, "Other Querier Present Interval : %lis%s", oqpi_msec/1000, VTY_NEWLINE);
- vty_out(vty, "Query Interval : %ds%s", igmp->querier_query_interval, VTY_NEWLINE);
- vty_out(vty, "Query Response Interval : %lis%s", qri_msec/1000, VTY_NEWLINE);
- vty_out(vty, "Robustness Variable : %d%s", igmp->querier_robustness_variable, VTY_NEWLINE);
- vty_out(vty, "Startup Query Interval : %ds%s", sqi, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Interface : %s", ifp->name);
+ vty_outln (vty, "State : %s", if_is_up(ifp) ? "up" : "down");
+ vty_outln (vty, "Address : %s",
+ inet_ntoa(pim_ifp->primary_address));
+ vty_outln (vty, "Uptime : %s", uptime);
+ vty_outln (vty, "Version : %d", pim_ifp->igmp_version);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
+
+ vty_outln (vty, "Querier");
+ vty_outln (vty, "-------");
+ vty_outln (vty, "Querier : %s",
+ igmp->t_igmp_query_timer ? "local" : "other");
+ vty_outln (vty, "Start Count : %d", igmp->startup_query_count);
+ vty_outln (vty, "Query Timer : %s", query_hhmmss);
+ vty_outln (vty, "Other Timer : %s", other_hhmmss);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
+
+ vty_outln (vty, "Timers");
+ vty_outln (vty, "------");
+ vty_outln (vty, "Group Membership Interval : %lis",
+ gmi_msec / 1000);
+ vty_outln (vty, "Last Member Query Time : %lis",
+ lmqt_msec / 1000);
+ vty_outln (vty, "Older Host Present Interval : %lis",
+ ohpi_msec / 1000);
+ vty_outln (vty, "Other Querier Present Interval : %lis",
+ oqpi_msec / 1000);
+ vty_outln (vty, "Query Interval : %ds",
+ igmp->querier_query_interval);
+ vty_outln (vty, "Query Response Interval : %lis",
+ qri_msec / 1000);
+ vty_outln (vty, "Robustness Variable : %d",
+ igmp->querier_robustness_variable);
+ vty_outln (vty, "Startup Query Interval : %ds", sqi);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
pim_print_ifp_flags(vty, ifp, mloop);
}
}
if (uj) {
- 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 (!found_ifname)
- vty_out (vty, "%% No such interface%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No such interface");
}
}
now = pim_time_monotonic_sec();
- vty_out(vty,
- "Interface Address Source Group Socket Uptime %s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group Socket Uptime ");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
struct pim_interface *pim_ifp;
pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str));
pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str));
- vty_out(vty, "%-9s %-15s %-15s %-15s %6d %8s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %6d %8s",
ifp->name,
pri_addr_str,
source_str,
group_str,
ij->sock_fd,
- uptime,
- VTY_NEWLINE);
+ uptime);
} /* for (pim_ifp->igmp_join_list) */
} /* for (iflist) */
json_object_object_add(json, ifp->name, json_row);
} else {
- vty_out(vty, "Interface : %s%s", ifp->name, VTY_NEWLINE);
- vty_out(vty, "State : %s%s", if_is_up(ifp) ? "up" : "down", VTY_NEWLINE);
+ vty_outln (vty, "Interface : %s", ifp->name);
+ vty_outln (vty, "State : %s", if_is_up(ifp) ? "up" : "down");
if (pim_ifp->update_source.s_addr != INADDR_ANY) {
- vty_out(vty, "Use Source : %s%s", inet_ntoa(pim_ifp->update_source), VTY_NEWLINE);
+ vty_outln (vty, "Use Source : %s", inet_ntoa(pim_ifp->update_source));
}
if (pim_ifp->sec_addr_list) {
char pbuf[PREFIX2STR_BUFFER];
- vty_out(vty, "Address : %s (primary)%s",
- inet_ntoa(ifaddr), VTY_NEWLINE);
+ vty_outln (vty, "Address : %s (primary)",
+ inet_ntoa(ifaddr));
for (ALL_LIST_ELEMENTS_RO(pim_ifp->sec_addr_list, sec_node, sec_addr)) {
- vty_out(vty, " %s%s",
- prefix2str(&sec_addr->addr,
- pbuf,
- sizeof(pbuf)), VTY_NEWLINE);
+ vty_outln (vty, " %s",
+ prefix2str(&sec_addr->addr, pbuf, sizeof(pbuf)));
}
} else {
- vty_out(vty, "Address : %s%s", inet_ntoa(ifaddr), VTY_NEWLINE);
+ vty_outln (vty, "Address : %s", inet_ntoa(ifaddr));
}
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
// PIM neighbors
print_header = 1;
for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode, neigh)) {
if (print_header) {
- vty_out(vty, "PIM Neighbors%s", VTY_NEWLINE);
- vty_out(vty, "-------------%s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Neighbors");
+ vty_outln (vty, "-------------");
print_header = 0;
}
pim_inet4_dump("<src?>", neigh->source_addr, neigh_src_str, sizeof(neigh_src_str));
pim_time_uptime(uptime, sizeof(uptime), now - neigh->creation);
pim_time_timer_to_hhmmss(expire, sizeof(expire), neigh->t_expire_timer);
- vty_out(vty, "%-15s : up for %s, holdtime expires in %s%s", neigh_src_str, uptime, expire, VTY_NEWLINE);
+ vty_outln (vty, "%-15s : up for %s, holdtime expires in %s", neigh_src_str, uptime,
+ expire);
}
if (!print_header) {
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
}
- vty_out(vty, "Designated Router%s", VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- vty_out(vty, "Address : %s%s", dr_str, VTY_NEWLINE);
- vty_out(vty, "Priority : %d%s", pim_ifp->pim_dr_priority, VTY_NEWLINE);
- vty_out(vty, "Uptime : %s%s", dr_uptime, VTY_NEWLINE);
- vty_out(vty, "Elections : %d%s", pim_ifp->pim_dr_election_count, VTY_NEWLINE);
- vty_out(vty, "Changes : %d%s", pim_ifp->pim_dr_election_changes, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Designated Router");
+ vty_outln (vty, "-----------------");
+ vty_outln (vty, "Address : %s", dr_str);
+ vty_outln (vty, "Priority : %d", pim_ifp->pim_dr_priority);
+ vty_outln (vty, "Uptime : %s", dr_uptime);
+ vty_outln (vty, "Elections : %d", pim_ifp->pim_dr_election_count);
+ vty_outln (vty, "Changes : %d", pim_ifp->pim_dr_election_changes);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
// FHR
print_header = 1;
if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR) {
if (print_header) {
- vty_out(vty, "FHR - First Hop Router%s", VTY_NEWLINE);
- vty_out(vty, "----------------------%s", VTY_NEWLINE);
+ vty_outln (vty, "FHR - First Hop Router");
+ vty_outln (vty, "----------------------");
print_header = 0;
}
pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
pim_time_uptime(uptime, sizeof(uptime), now - up->state_transition);
- vty_out(vty, "%s : %s is a source, uptime is %s%s", grp_str, src_str, uptime, VTY_NEWLINE);
+ vty_outln (vty, "%s : %s is a source, uptime is %s", grp_str, src_str,
+ uptime);
}
}
}
if (!print_header) {
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
}
- vty_out(vty, "Hellos%s", VTY_NEWLINE);
- vty_out(vty, "------%s", VTY_NEWLINE);
- vty_out(vty, "Period : %d%s", pim_ifp->pim_hello_period, VTY_NEWLINE);
- vty_out(vty, "Timer : %s%s", hello_timer, VTY_NEWLINE);
- vty_out(vty, "StatStart : %s%s", stat_uptime, VTY_NEWLINE);
- vty_out(vty, "Receive : %d%s", pim_ifp->pim_ifstat_hello_recv, VTY_NEWLINE);
- vty_out(vty, "Receive Failed : %d%s", pim_ifp->pim_ifstat_hello_recvfail, VTY_NEWLINE);
- vty_out(vty, "Send : %d%s", pim_ifp->pim_ifstat_hello_sent, VTY_NEWLINE);
- vty_out(vty, "Send Failed : %d%s", pim_ifp->pim_ifstat_hello_sendfail, VTY_NEWLINE);
- vty_out(vty, "Generation ID : %08x%s", pim_ifp->pim_generation_id, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Hellos");
+ vty_outln (vty, "------");
+ vty_outln (vty, "Period : %d", pim_ifp->pim_hello_period);
+ vty_outln (vty, "Timer : %s", hello_timer);
+ vty_outln (vty, "StatStart : %s", stat_uptime);
+ vty_outln (vty, "Receive : %d", pim_ifp->pim_ifstat_hello_recv);
+ vty_outln (vty, "Receive Failed : %d",
+ pim_ifp->pim_ifstat_hello_recvfail);
+ vty_outln (vty, "Send : %d", pim_ifp->pim_ifstat_hello_sent);
+ vty_outln (vty, "Send Failed : %d",
+ pim_ifp->pim_ifstat_hello_sendfail);
+ vty_outln (vty, "Generation ID : %08x", pim_ifp->pim_generation_id);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
pim_print_ifp_flags(vty, ifp, mloop);
- vty_out(vty, "Join Prune Interval%s", VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- vty_out(vty, "LAN Delay : %s%s", pim_if_lan_delay_enabled(ifp) ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, "Effective Propagation Delay : %d msec%s", pim_if_effective_propagation_delay_msec(ifp), VTY_NEWLINE);
- vty_out(vty, "Effective Override Interval : %d msec%s", pim_if_effective_override_interval_msec(ifp), VTY_NEWLINE);
- vty_out(vty, "Join Prune Override Interval : %d msec%s", pim_if_jp_override_interval_msec(ifp), VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
-
- vty_out(vty, "LAN Prune Delay%s", VTY_NEWLINE);
- vty_out(vty, "---------------%s", VTY_NEWLINE);
- vty_out(vty, "Propagation Delay : %d msec%s", pim_ifp->pim_propagation_delay_msec, VTY_NEWLINE);
- vty_out(vty, "Propagation Delay (Highest) : %d msec%s", pim_ifp->pim_neighbors_highest_propagation_delay_msec, VTY_NEWLINE);
- vty_out(vty, "Override Interval : %d msec%s", pim_ifp->pim_override_interval_msec, VTY_NEWLINE);
- vty_out(vty, "Override Interval (Highest) : %d msec%s", pim_ifp->pim_neighbors_highest_override_interval_msec, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Join Prune Interval");
+ vty_outln (vty, "-------------------");
+ vty_outln (vty, "LAN Delay : %s",
+ pim_if_lan_delay_enabled(ifp) ? "yes" : "no");
+ vty_outln (vty, "Effective Propagation Delay : %d msec",
+ pim_if_effective_propagation_delay_msec(ifp));
+ vty_outln (vty, "Effective Override Interval : %d msec",
+ pim_if_effective_override_interval_msec(ifp));
+ vty_outln (vty, "Join Prune Override Interval : %d msec",
+ pim_if_jp_override_interval_msec(ifp));
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
+
+ vty_outln (vty, "LAN Prune Delay");
+ vty_outln (vty, "---------------");
+ vty_outln (vty, "Propagation Delay : %d msec",
+ pim_ifp->pim_propagation_delay_msec);
+ vty_outln (vty, "Propagation Delay (Highest) : %d msec",
+ pim_ifp->pim_neighbors_highest_propagation_delay_msec);
+ vty_outln (vty, "Override Interval : %d msec",
+ pim_ifp->pim_override_interval_msec);
+ vty_outln (vty, "Override Interval (Highest) : %d msec",
+ pim_ifp->pim_neighbors_highest_override_interval_msec);
+ vty_out (vty, VTYNL);
+ vty_out (vty, VTYNL);
}
}
if (uj) {
- 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 (!found_ifname)
- vty_out (vty, "%% No such interface%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No such interface");
}
}
}
if (uj) {
- 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));
} else {
- vty_out(vty, "Interface State Address PIM Nbrs PIM DR FHR IfChannels%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface State Address PIM Nbrs PIM DR FHR IfChannels");
json_object_object_foreach(json, key, val) {
vty_out(vty, "%-9s ", key);
vty_out(vty, "%3d ", json_object_get_int(json_tmp));
json_object_object_get_ex(val, "pimIfChannels", &json_tmp);
- vty_out(vty, "%9d%s", json_object_get_int(json_tmp), VTY_NEWLINE);
+ vty_outln (vty, "%9d", json_object_get_int(json_tmp));
}
}
json = json_object_new_object ();
else
{
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s%s", "Interface",
+ vty_out (vty, VTYNL);
+ vty_outln (vty, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s", "Interface",
" HELLO", " JOIN", " PRUNE", " REGISTER",
- " REGISTER-STOP", " ASSERT", VTY_NEWLINE);
- vty_out (vty,
- "%-10s%-18s%-17s%-17s%-17s%-17s%-17s%s",
+ " REGISTER-STOP", " ASSERT");
+ vty_outln (vty,
+ "%-10s%-18s%-17s%-17s%-17s%-17s%-17s",
"", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx",
- " Rx/Tx", " Rx/Tx", VTY_NEWLINE);
- vty_out (vty,
- "---------------------------------------------------------------------------------------------------------------%s",
- VTY_NEWLINE);
+ " Rx/Tx", " Rx/Tx");
+ vty_outln (vty,
+ "---------------------------------------------------------------------------------------------------------------");
}
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
}
else
{
- vty_out (vty,
- "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %s",
+ vty_outln (vty,
+ "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u ",
ifp->name, pim_ifp->pim_ifstat_hello_recv,
pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv,
pim_ifp->pim_ifstat_join_send, pim_ifp->pim_ifstat_prune_recv,
pim_ifp->pim_ifstat_reg_stop_recv,
pim_ifp->pim_ifstat_reg_stop_send,
pim_ifp->pim_ifstat_assert_recv,
- pim_ifp->pim_ifstat_assert_send, VTY_NEWLINE);
+ pim_ifp->pim_ifstat_assert_send);
}
}
if (uj)
{
- 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);
}
}
json = json_object_new_object ();
else
{
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s%s", "Interface",
+ vty_out (vty, VTYNL);
+ vty_outln (vty, "%-12s%-17s%-17s%-17s%-17s%-17s%-17s", "Interface",
" HELLO", " JOIN", " PRUNE", " REGISTER",
- " REGISTER-STOP", " ASSERT", VTY_NEWLINE);
- vty_out (vty,
- "%-10s%-18s%-17s%-17s%-17s%-17s%-17s%s",
+ " REGISTER-STOP", " ASSERT");
+ vty_outln (vty,
+ "%-10s%-18s%-17s%-17s%-17s%-17s%-17s",
"", " Rx/Tx", " Rx/Tx", " Rx/Tx", " Rx/Tx",
- " Rx/Tx", " Rx/Tx", VTY_NEWLINE);
- vty_out (vty,
- "---------------------------------------------------------------------------------------------------------------%s",
- VTY_NEWLINE);
+ " Rx/Tx", " Rx/Tx");
+ vty_outln (vty,
+ "---------------------------------------------------------------------------------------------------------------");
}
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
}
else
{
- vty_out (vty,
- "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %s",
+ vty_outln (vty,
+ "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u ",
ifp->name, pim_ifp->pim_ifstat_hello_recv,
pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv,
pim_ifp->pim_ifstat_join_send, pim_ifp->pim_ifstat_prune_recv,
pim_ifp->pim_ifstat_reg_stop_recv,
pim_ifp->pim_ifstat_reg_stop_send,
pim_ifp->pim_ifstat_assert_recv,
- pim_ifp->pim_ifstat_assert_send, VTY_NEWLINE);
+ pim_ifp->pim_ifstat_assert_send);
}
}
if (uj)
{
- 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 (!found_ifname)
- vty_out (vty, "%% No such interface%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No such interface");
}
}
if (uj)
json = json_object_new_object();
else
- vty_out(vty,
- "Interface Address Source Group State Uptime Expire Prune%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Source Group State Uptime Expire Prune");
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, ch_node, ch)) {
else
json_object_object_add(json_grp, ch_src_str, json_row);
} else {
- vty_out(vty, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %-6s %8s %-6s %5s",
ch->interface->name,
inet_ntoa(ifaddr),
ch_src_str,
pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags),
uptime,
expire,
- prune,
- VTY_NEWLINE);
+ prune);
}
} /* scan interface channels */
if (uj) {
- 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);
}
}
json_object_object_add(json_ifp, neigh_src_str, json_row);
} else {
- vty_out(vty, "Interface : %s%s", ifp->name, VTY_NEWLINE);
- vty_out(vty, "Neighbor : %s%s", neigh_src_str, VTY_NEWLINE);
- vty_out(vty, " Uptime : %s%s", uptime, VTY_NEWLINE);
- vty_out(vty, " Holdtime : %s%s", expire, VTY_NEWLINE);
- vty_out(vty, " DR Priority : %d%s", neigh->dr_priority, VTY_NEWLINE);
- vty_out(vty, " Generation ID : %08x%s", neigh->generation_id, VTY_NEWLINE);
- vty_out(vty, " Override Interval (msec) : %d%s", neigh->override_interval_msec, VTY_NEWLINE);
- vty_out(vty, " Propagation Delay (msec) : %d%s", neigh->propagation_delay_msec, VTY_NEWLINE);
- vty_out(vty, " Hello Option - Address List : %s%s", option_address_list ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, " Hello Option - DR Priority : %s%s", option_dr_priority ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, " Hello Option - Generation ID : %s%s", option_generation_id? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, " Hello Option - Holdtime : %s%s", option_holdtime ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, " Hello Option - LAN Prune Delay : %s%s", option_lan_prune_delay ? "yes" : "no", VTY_NEWLINE);
- vty_out(vty, " Hello Option - T-bit : %s%s", option_t_bit ? "yes" : "no", VTY_NEWLINE);
+ vty_outln (vty, "Interface : %s", ifp->name);
+ vty_outln (vty, "Neighbor : %s", neigh_src_str);
+ vty_outln (vty, " Uptime : %s", uptime);
+ vty_outln (vty, " Holdtime : %s", expire);
+ vty_outln (vty, " DR Priority : %d",
+ neigh->dr_priority);
+ vty_outln (vty, " Generation ID : %08x",
+ neigh->generation_id);
+ vty_outln (vty, " Override Interval (msec) : %d",
+ neigh->override_interval_msec);
+ vty_outln (vty, " Propagation Delay (msec) : %d",
+ neigh->propagation_delay_msec);
+ vty_outln (vty, " Hello Option - Address List : %s",
+ option_address_list ? "yes" : "no");
+ vty_outln (vty, " Hello Option - DR Priority : %s",
+ option_dr_priority ? "yes" : "no");
+ vty_outln (vty, " Hello Option - Generation ID : %s",
+ option_generation_id ? "yes" : "no");
+ vty_outln (vty, " Hello Option - Holdtime : %s",
+ option_holdtime ? "yes" : "no");
+ vty_outln (vty, " Hello Option - LAN Prune Delay : %s",
+ option_lan_prune_delay ? "yes" : "no");
+ vty_outln (vty, " Hello Option - T-bit : %s",
+ option_t_bit ? "yes" : "no");
pim_bfd_show_info (vty, neigh->bfd_info, json_ifp, uj, 0);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
}
if (uj) {
- 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 (!found_neighbor)
- vty_out (vty, "%% No such interface or neighbor%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No such interface or neighbor");
}
}
}
json = json_object_new_object();
} else {
vty_out(vty, "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G)");
- vty_out(vty, "%sInstalled Source Group IIF OIL%s", VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "%sInstalled Source Group IIF OIL",
+ VTYNL);
}
for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list, node, c_oil)) {
}
if (!uj)
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (uj) {
- 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 {
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
if (uj) {
json = json_object_new_object();
} else {
- vty_out(vty, "Interface Neighbor Uptime Holdtime DR Pri%s", VTY_NEWLINE);
+ vty_outln (vty, "Interface Neighbor Uptime Holdtime DR Pri");
}
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
json_object_object_add(json_ifp_rows, neigh_src_str, json_row);
} else {
- vty_out(vty, "%-9s %15s %8s %8s %6d%s",
+ vty_outln (vty, "%-9s %15s %8s %8s %6d",
ifp->name,
neigh_src_str,
uptime,
expire,
- neigh->dr_priority,
- VTY_NEWLINE);
+ neigh->dr_priority);
}
}
}
if (uj) {
- 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);
}
}
struct listnode *node;
struct interface *ifp;
- vty_out(vty, "Interface Address Neighbor Secondary %s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Neighbor Secondary ");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
struct pim_interface *pim_ifp;
prefix2str(p, neigh_sec_str, sizeof(neigh_sec_str));
- vty_out(vty, "%-9s %-15s %-15s %-15s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s",
ifp->name,
inet_ntoa(ifaddr),
neigh_src_str,
- neigh_sec_str,
- VTY_NEWLINE);
+ neigh_sec_str);
}
}
}
if (uj)
json = json_object_new_object();
else
- vty_out(vty, "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt");
for (ALL_LIST_ELEMENTS_RO(pim_upstream_list, upnode, up)) {
char src_str[INET_ADDRSTRLEN];
json_object_int_add(json_row, "sptBit", up->sptbit);
json_object_object_add(json_group, src_str, json_row);
} else {
- vty_out(vty, "%-10s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d%s",
+ vty_outln (vty, "%-10s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d",
up->rpf.source_nexthop.interface->name,
src_str,
grp_str,
join_timer,
rs_timer,
ka_timer,
- up->ref_count,
- VTY_NEWLINE);
+ up->ref_count);
}
}
if (uj) {
- 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);
}
}
if (uj)
json = json_object_new_object();
else
- vty_out(vty,
- "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD");
/* scan per-interface (S,G) state */
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, chnode, ch)) {
json_object_object_add(json_group, src_str, json_row);
} else {
- vty_out(vty, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s",
ch->interface->name,
src_str,
grp_str,
pim_macro_chisin_joins(ch) ? "yes" : "no",
pim_macro_chisin_pim_include(ch) ? "yes" : "no",
PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up->flags) ? "yes" : "no",
- pim_upstream_evaluate_join_desired(up) ? "yes" : "no",
- VTY_NEWLINE);
+ pim_upstream_evaluate_join_desired(up) ? "yes" : "no");
}
}
if (uj) {
- 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);
}
}
if (uj)
json = json_object_new_object();
else
- vty_out(vty,
- "Source Group RpfIface RibNextHop RpfAddress %s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Source Group RpfIface RibNextHop RpfAddress ");
for (ALL_LIST_ELEMENTS_RO(pim_upstream_list, upnode, up)) {
char src_str[INET_ADDRSTRLEN];
json_object_string_add(json_row, "rpfAddress", rpf_addr_str);
json_object_object_add(json_group, src_str, json_row);
} else {
- vty_out(vty, "%-15s %-15s %-8s %-15s %-15s%s",
+ vty_outln (vty, "%-15s %-15s %-8s %-15s %-15s",
src_str,
grp_str,
rpf_ifname,
rpf_nexthop_str,
- rpf_addr_str,
- VTY_NEWLINE);
+ rpf_addr_str);
}
}
if (uj) {
- 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);
}
}
json_object_int_add(json, "nexthopLookups", qpim_nexthop_lookups);
json_object_int_add(json, "nexthopLookupsAvoided", nexthop_lookups_avoided);
} else {
- vty_out(vty,
+ vty_outln (vty,
"RPF Cache Refresh Delay: %ld msecs%s"
"RPF Cache Refresh Timer: %ld msecs%s"
"RPF Cache Refresh Requests: %lld%s"
"RPF Cache Refresh Events: %lld%s"
"RPF Cache Refresh Last: %s%s"
"Nexthop Lookups: %lld%s"
- "Nexthop Lookups Avoided: %lld%s",
- qpim_rpf_cache_refresh_delay_msec, VTY_NEWLINE,
- pim_time_timer_remain_msec(qpim_rpf_cache_refresher), VTY_NEWLINE,
- (long long)qpim_rpf_cache_refresh_requests, VTY_NEWLINE,
- (long long)qpim_rpf_cache_refresh_events, VTY_NEWLINE,
- refresh_uptime, VTY_NEWLINE,
- (long long) qpim_nexthop_lookups, VTY_NEWLINE,
- (long long)nexthop_lookups_avoided, VTY_NEWLINE);
+ "Nexthop Lookups Avoided: %lld",
+ qpim_rpf_cache_refresh_delay_msec, VTYNL,
+ pim_time_timer_remain_msec(qpim_rpf_cache_refresher), VTYNL,
+ (long long)qpim_rpf_cache_refresh_requests, VTYNL,
+ (long long)qpim_rpf_cache_refresh_events, VTYNL,
+ refresh_uptime, VTYNL,
+ (long long) qpim_nexthop_lookups, VTYNL,
+ (long long)nexthop_lookups_avoided);
}
}
pim_time_uptime_begin(uptime_mroute_add, sizeof(uptime_mroute_add), now, qpim_mroute_add_last);
pim_time_uptime_begin(uptime_mroute_del, sizeof(uptime_mroute_del), now, qpim_mroute_del_last);
- vty_out(vty,
+ vty_outln (vty,
"Scan OIL - Last: %s Events: %lld%s"
"MFC Add - Last: %s Events: %lld%s"
- "MFC Del - Last: %s Events: %lld%s",
- uptime_scan_oil, (long long) qpim_scan_oil_events, VTY_NEWLINE,
- uptime_mroute_add, (long long) qpim_mroute_add_events, VTY_NEWLINE,
- uptime_mroute_del, (long long) qpim_mroute_del_events, VTY_NEWLINE);
+ "MFC Del - Last: %s Events: %lld",
+ uptime_scan_oil, (long long) qpim_scan_oil_events, VTYNL,
+ uptime_mroute_add, (long long) qpim_mroute_add_events, VTYNL,
+ uptime_mroute_del, (long long)qpim_mroute_del_events);
}
static void pim_show_rpf(struct vty *vty, u_char uj)
show_rpf_refresh_stats(vty, now, json);
} else {
show_rpf_refresh_stats(vty, now, json);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty,
- "Source Group RpfIface RpfAddress RibNextHop Metric Pref%s",
- VTY_NEWLINE);
+ vty_out (vty, VTYNL);
+ vty_outln (vty,
+ "Source Group RpfIface RpfAddress RibNextHop Metric Pref");
}
for (ALL_LIST_ELEMENTS_RO(pim_upstream_list, up_node, up)) {
json_object_object_add(json_group, src_str, json_row);
} else {
- vty_out(vty, "%-15s %-15s %-8s %-15s %-15s %6d %4d%s",
+ vty_outln (vty, "%-15s %-15s %-8s %-15s %-15s %6d %4d",
src_str,
grp_str,
rpf_ifname,
rpf_addr_str,
rib_nexthop_str,
rpf->source_nexthop.mrib_route_metric,
- rpf->source_nexthop.mrib_metric_preference,
- VTY_NEWLINE);
+ rpf->source_nexthop.mrib_metric_preference);
}
}
if (uj) {
- 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);
}
}
vty_out (vty, "%-15s ", inet_ntoa (pnc->rpf.rpf_addr.u.prefix4));
vty_out (vty, "%-14s ", ifp ? ifp->name : "NULL");
vty_out (vty, "%s ", inet_ntoa (nh_node->gate.ipv4));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return CMD_SUCCESS;
}
if (pimg && !pimg->rpf_hash)
{
- vty_out (vty, "no nexthop cache %s", VTY_NEWLINE);
+ vty_outln (vty, "no nexthop cache ");
return;
}
- vty_out (vty, "Number of registered addresses: %lu %s",
- pimg->rpf_hash->count, VTY_NEWLINE);
- vty_out (vty, "Address Interface Nexthop%s", VTY_NEWLINE);
- vty_out (vty, "-------------------------------------------%s", VTY_NEWLINE);
+ vty_outln (vty, "Number of registered addresses: %lu ",
+ pimg->rpf_hash->count);
+ vty_outln (vty, "Address Interface Nexthop");
+ vty_outln (vty, "-------------------------------------------");
hash_walk (pimg->rpf_hash, pim_print_pnc_cache_walkcb, vty);
if (uj)
json = json_object_new_object();
else
- vty_out(vty, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Group Mode Timer Srcs V Uptime ");
/* scan interfaces */
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
json_object_object_add(json_iface, group_str, json_row);
} else {
- vty_out(vty, "%-9s %-15s %-15s %4s %8s %4d %d %8s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %4s %8s %4d %d %8s",
ifp->name,
ifaddr_str,
group_str,
hhmmss,
grp->group_source_list ? listcount(grp->group_source_list) : 0,
grp->igmp_version,
- uptime,
- VTY_NEWLINE);
+ uptime);
}
} /* scan igmp groups */
} /* scan igmp sockets */
} /* scan interfaces */
if (uj) {
- 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);
}
}
struct listnode *ifnode;
struct interface *ifp;
- vty_out(vty, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Group RetTimer Counter RetSrcs");
/* scan interfaces */
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
}
}
- vty_out(vty, "%-9s %-15s %-15s %-8s %7d %7d%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-8s %7d %7d",
ifp->name,
ifaddr_str,
group_str,
grp_retr_mmss,
grp->group_specific_query_retransmit_count,
- grp_retr_sources,
- VTY_NEWLINE);
+ grp_retr_sources);
} /* scan igmp groups */
} /* scan igmp sockets */
now = pim_time_monotonic_sec();
- vty_out(vty, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Group Source Timer Fwd Uptime ");
/* scan interfaces */
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
pim_time_uptime(uptime, sizeof(uptime), now - src->source_creation);
- vty_out(vty, "%-9s %-15s %-15s %-15s %5s %3s %8s%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %5s %3s %8s",
ifp->name,
ifaddr_str,
group_str,
source_str,
mmss,
IGMP_SOURCE_TEST_FORWARDING(src->source_flags) ? "Y" : "N",
- uptime,
- VTY_NEWLINE);
+ uptime);
} /* scan group sources */
} /* scan igmp groups */
struct listnode *ifnode;
struct interface *ifp;
- vty_out(vty, "Interface Address Group Source Counter%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address Group Source Counter");
/* scan interfaces */
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
pim_inet4_dump("<source?>", src->source_addr, source_str, sizeof(source_str));
- vty_out(vty, "%-9s %-15s %-15s %-15s %7d%s",
+ vty_outln (vty, "%-9s %-15s %-15s %-15s %7d",
ifp->name,
ifaddr_str,
group_str,
source_str,
- src->source_query_retransmit_count,
- VTY_NEWLINE);
+ src->source_query_retransmit_count);
} /* scan group sources */
} /* scan igmp groups */
result = inet_pton (AF_INET, addr_str, &src_addr);
if (result <= 0)
{
- vty_out (vty, "Bad unicast address %s: errno=%d: %s%s",
- addr_str, errno, safe_strerror (errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad unicast address %s: errno=%d: %s",
+ addr_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
if (pim_is_group_224_4 (src_addr))
{
- vty_out (vty, "Invalid argument. Expected Valid Source Address.%s", VTY_NEWLINE);
+ vty_outln (vty, "Invalid argument. Expected Valid Source Address.");
return CMD_WARNING;
}
result = inet_pton (AF_INET, addr_str1, &grp_addr);
if (result <= 0)
{
- vty_out (vty, "Bad unicast address %s: errno=%d: %s%s",
- addr_str, errno, safe_strerror (errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad unicast address %s: errno=%d: %s",
+ addr_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
if (!pim_is_group_224_4 (grp_addr))
{
- vty_out (vty, "Invalid argument. Expected Valid Multicast Group Address.%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Invalid argument. Expected Valid Multicast Group Address.");
return CMD_WARNING;
}
pim_addr_dump ("<grp?>", &grp, grp_str, sizeof (grp_str));
pim_addr_dump ("<nexthop?>", &nexthop.mrib_nexthop_addr,
nexthop_addr_str, sizeof (nexthop_addr_str));
- vty_out (vty, "Group %s --- Nexthop %s Interface %s %s", grp_str,
- nexthop_addr_str, nexthop.interface->name, VTY_NEWLINE);
+ vty_outln (vty, "Group %s --- Nexthop %s Interface %s ", grp_str,
+ nexthop_addr_str, nexthop.interface->name);
return CMD_SUCCESS;
}
struct listnode *node;
struct interface *ifp;
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
- vty_out(vty, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
struct pim_interface *pim_ifp;
pim_ifp->mroute_vif_index,
errno,
safe_strerror(errno),
- VTY_NEWLINE);
+ VTYNL);
}
ifaddr = pim_ifp->primary_address;
- vty_out(vty, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu%s",
+ vty_outln (vty, "%-9s %-15s %3d %3d %7lu %7lu %10lu %10lu",
ifp->name,
inet_ntoa(ifaddr),
ifp->ifindex,
(unsigned long) vreq.icount,
(unsigned long) vreq.ocount,
(unsigned long) vreq.ibytes,
- (unsigned long) vreq.obytes,
- VTY_NEWLINE);
+ (unsigned long)vreq.obytes);
}
}
char uptime[10];
- vty_out(vty, "Mroute socket descriptor: %d%s",
- qpim_mroute_socket_fd,
- VTY_NEWLINE);
+ vty_outln (vty, "Mroute socket descriptor: %d",
+ qpim_mroute_socket_fd);
pim_time_uptime(uptime, sizeof(uptime), now - qpim_mroute_socket_creation);
- vty_out(vty, "Mroute socket uptime: %s%s",
- uptime,
- VTY_NEWLINE);
+ vty_outln (vty, "Mroute socket uptime: %s",
+ uptime);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
pim_zebra_zclient_update (vty);
pim_zlookup_show_ip_multicast (vty);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "Maximum highest VifIndex: %d%s",
- PIM_MAX_USABLE_VIFS,
- VTY_NEWLINE);
+ vty_out (vty, VTYNL);
+ vty_outln (vty, "Maximum highest VifIndex: %d",
+ PIM_MAX_USABLE_VIFS);
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "Upstream Join Timer: %d secs%s",
- qpim_t_periodic, VTY_NEWLINE);
- vty_out (vty, "Join/Prune Holdtime: %d secs%s",
- PIM_JP_HOLDTIME, VTY_NEWLINE);
- vty_out (vty, "PIM ECMP: %s%s",
- qpim_ecmp_enable ? "Enable" : "Disable", VTY_NEWLINE);
- vty_out (vty, "PIM ECMP Rebalance: %s%s",
- qpim_ecmp_rebalance_enable ? "Enable" : "Disable", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
+ vty_outln (vty, "Upstream Join Timer: %d secs",
+ qpim_t_periodic);
+ vty_outln (vty, "Join/Prune Holdtime: %d secs",
+ PIM_JP_HOLDTIME);
+ vty_outln (vty, "PIM ECMP: %s",
+ qpim_ecmp_enable ? "Enable" : "Disable");
+ vty_outln (vty, "PIM ECMP Rebalance: %s",
+ qpim_ecmp_rebalance_enable ? "Enable" : "Disable");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
show_rpf_refresh_stats(vty, now, NULL);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
show_scan_oil_stats(vty, now);
if (uj) {
json = json_object_new_object();
} else {
- vty_out(vty, "Source Group Proto Input Output TTL Uptime%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Source Group Proto Input Output TTL Uptime");
}
now = pim_time_monotonic_sec();
strcpy(proto, "STAR");
}
- vty_out(vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
+ vty_outln (vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s",
src_str,
grp_str,
proto,
in_ifname,
out_ifname,
ttl,
- oif_uptime,
- VTY_NEWLINE);
+ oif_uptime);
if (first)
{
}
if (!uj && !found_oif) {
- vty_out(vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
+ vty_outln (vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s",
src_str,
grp_str,
"none",
in_ifname,
"none",
0,
- "--:--:--",
- VTY_NEWLINE);
+ "--:--:--");
}
}
}
json_object_object_add(json_oil, out_ifname, json_ifp_out);
} else {
- vty_out(vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
+ vty_outln (vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s",
src_str,
grp_str,
proto,
in_ifname,
out_ifname,
ttl,
- oif_uptime,
- VTY_NEWLINE);
+ oif_uptime);
if (first)
{
src_str[0] = '\0';
}
if (!uj && !found_oif) {
- vty_out(vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s%s",
+ vty_outln (vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s",
src_str,
grp_str,
proto,
in_ifname,
"none",
0,
- "--:--:--",
- VTY_NEWLINE);
+ "--:--:--");
}
}
if (uj) {
- 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);
}
}
struct channel_oil *c_oil;
struct static_route *s_route;
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
- vty_out(vty, "Source Group LastUsed Packets Bytes WrongIf %s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Source Group LastUsed Packets Bytes WrongIf ");
/* Print PIM and IGMP route counts */
for (ALL_LIST_ELEMENTS_RO(pim_channel_oil_list, node, c_oil)) {
pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str));
pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, source_str, sizeof(source_str));
- vty_out(vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
+ vty_outln (vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld",
source_str,
group_str,
c_oil->cc.lastused/100,
c_oil->cc.pktcnt,
c_oil->cc.bytecnt,
- c_oil->cc.wrong_if,
- VTY_NEWLINE);
+ c_oil->cc.wrong_if);
}
/* Print static route counts */
pim_inet4_dump("<group?>", s_route->c_oil.oil.mfcc_mcastgrp, group_str, sizeof(group_str));
pim_inet4_dump("<source?>", s_route->c_oil.oil.mfcc_origin, source_str, sizeof(source_str));
- vty_out(vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld%s",
+ vty_outln (vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld",
source_str,
group_str,
s_route->c_oil.cc.lastused,
s_route->c_oil.cc.pktcnt,
s_route->c_oil.cc.bytecnt,
- s_route->c_oil.cc.wrong_if,
- VTY_NEWLINE);
+ s_route->c_oil.cc.wrong_if);
}
}
addr_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, addr_str, &addr);
if (result <= 0) {
- vty_out(vty, "Bad unicast address %s: errno=%d: %s%s",
- addr_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad unicast address %s: errno=%d: %s",
+ addr_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
if (pim_nexthop_lookup(&nexthop, addr, 0)) {
- vty_out(vty, "Failure querying RIB nexthop for unicast address %s%s",
- addr_str, VTY_NEWLINE);
+ vty_outln (vty, "Failure querying RIB nexthop for unicast address %s",
+ addr_str);
return CMD_WARNING;
}
- vty_out(vty, "Address NextHop Interface Metric Preference%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Address NextHop Interface Metric Preference");
pim_addr_dump("<nexthop?>", &nexthop.mrib_nexthop_addr,
nexthop_addr_str, sizeof(nexthop_addr_str));
- vty_out(vty, "%-15s %-15s %-9s %6d %10d%s",
+ vty_outln (vty, "%-15s %-15s %-9s %6d %10d",
addr_str,
nexthop_addr_str,
nexthop.interface ? nexthop.interface->name : "<ifname?>",
nexthop.mrib_route_metric,
- nexthop.mrib_metric_preference,
- VTY_NEWLINE);
+ nexthop.mrib_metric_preference);
return CMD_SUCCESS;
}
struct ssmpingd_sock *ss;
time_t now;
- vty_out(vty, "Source Socket Address Port Uptime Requests%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Source Socket Address Port Uptime Requests");
if (!qpim_ssmpingd_list)
return;
pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str));
if (pim_socket_getsockname(ss->sock_fd, (struct sockaddr *) &bind_addr, &len)) {
- vty_out(vty, "%% Failure reading socket name for ssmpingd source %s on fd=%d%s",
- source_str, ss->sock_fd, VTY_NEWLINE);
+ vty_outln (vty, "%% Failure reading socket name for ssmpingd source %s on fd=%d",
+ source_str, ss->sock_fd);
}
pim_inet4_dump("<addr?>", bind_addr.sin_addr, bind_addr_str, sizeof(bind_addr_str));
pim_time_uptime(ss_uptime, sizeof(ss_uptime), now - ss->creation);
- vty_out(vty, "%-15s %6d %-15s %5d %8s %8lld%s",
+ vty_outln (vty, "%-15s %6d %-15s %5d %8s %8lld",
source_str,
ss->sock_fd,
bind_addr_str,
ntohs(bind_addr.sin_port),
ss_uptime,
- (long long)ss->requests,
- VTY_NEWLINE);
+ (long long)ss->requests);
}
}
if (result == PIM_MALLOC_FAIL)
{
- vty_out (vty, "%% Out of memory%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Out of memory");
return CMD_WARNING;
}
if (result == PIM_GROUP_BAD_ADDRESS)
{
- vty_out (vty, "%% Bad group address specified: %s%s", group, VTY_NEWLINE);
+ vty_outln (vty, "%% Bad group address specified: %s", group);
return CMD_WARNING;
}
if (result == PIM_RP_BAD_ADDRESS)
{
- vty_out (vty, "%% Bad RP address specified: %s%s", rp, VTY_NEWLINE);
+ vty_outln (vty, "%% Bad RP address specified: %s", rp);
return CMD_WARNING;
}
if (result == PIM_RP_NO_PATH)
{
- vty_out (vty, "%% No Path to RP address specified: %s%s", rp, VTY_NEWLINE);
+ vty_outln (vty, "%% No Path to RP address specified: %s", rp);
return CMD_WARNING;
}
if (result == PIM_GROUP_OVERLAP)
{
- vty_out (vty, "%% Group range specified cannot overlap%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Group range specified cannot overlap");
return CMD_WARNING;
}
if (result == PIM_GROUP_PFXLIST_OVERLAP)
{
- vty_out (vty, "%% This group is already covered by a RP prefix-list%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "%% This group is already covered by a RP prefix-list");
return CMD_WARNING;
}
if (result == PIM_RP_PFXLIST_IN_USE)
{
- vty_out (vty, "%% The same prefix-list cannot be applied to multiple RPs%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "%% The same prefix-list cannot be applied to multiple RPs");
return CMD_WARNING;
}
if (result == PIM_GROUP_BAD_ADDRESS)
{
- vty_out (vty, "%% Bad group address specified: %s%s", group, VTY_NEWLINE);
+ vty_outln (vty, "%% Bad group address specified: %s", group);
return CMD_WARNING;
}
if (result == PIM_RP_BAD_ADDRESS)
{
- vty_out (vty, "%% Bad RP address specified: %s%s", rp, VTY_NEWLINE);
+ vty_outln (vty, "%% Bad RP address specified: %s", rp);
return CMD_WARNING;
}
if (result == PIM_RP_NOT_FOUND)
{
- vty_out (vty, "%% Unable to find specified RP%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Unable to find specified RP");
return CMD_WARNING;
}
switch (result)
{
case PIM_SSM_ERR_NO_VRF:
- vty_out (vty, "%% VRF doesn't exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% VRF doesn't exist");
break;
case PIM_SSM_ERR_DUP:
- vty_out (vty, "%% duplicate config%s", VTY_NEWLINE);
+ vty_outln (vty, "%% duplicate config");
break;
default:
- vty_out (vty, "%% ssm range config failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% ssm range config failed");
}
return CMD_WARNING;
if (ssm->plist_name && !strcmp(ssm->plist_name, argv[0]->arg))
return pim_ssm_cmd_worker (vty, NULL);
- vty_out (vty, "%% pim ssm prefix-list %s doesn't exist%s",
- argv[0]->arg, VTY_NEWLINE);
+ vty_outln (vty, "%% pim ssm prefix-list %s doesn't exist",
+ argv[0]->arg);
return CMD_WARNING;
}
json_object *json;
json = json_object_new_object();
json_object_string_add(json, "ssmGroups", range_str);
- 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
- vty_out(vty, "SSM group range : %s%s", range_str, VTY_NEWLINE);
+ vty_outln (vty, "SSM group range : %s", range_str);
}
DEFUN (show_ip_pim_ssm_range,
json_object *json;
json = json_object_new_object();
json_object_string_add(json, "groupType", type_str);
- 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
- vty_out(vty, "Group type : %s%s", type_str, VTY_NEWLINE);
+ vty_outln (vty, "Group type : %s", type_str);
}
DEFUN (show_ip_pim_group_type,
"Global IP configuration subcommands\n"
"Enable IP multicast forwarding\n")
{
- vty_out (vty, "Command is Disabled and will be removed in a future version%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Command is Disabled and will be removed in a future version");
return CMD_SUCCESS;
}
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad source address %s: errno=%d: %s%s",
- source_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad source address %s: errno=%d: %s",
+ source_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
result = pim_ssmpingd_start(source_addr);
if (result) {
- vty_out(vty, "%% Failure starting ssmpingd for source %s: %d%s",
- source_str, result, VTY_NEWLINE);
+ vty_outln (vty, "%% Failure starting ssmpingd for source %s: %d",
+ source_str, result);
return CMD_WARNING;
}
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad source address %s: errno=%d: %s%s",
- source_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad source address %s: errno=%d: %s",
+ source_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
result = pim_ssmpingd_stop(source_addr);
if (result) {
- vty_out(vty, "%% Failure stopping ssmpingd for source %s: %d%s",
- source_str, result, VTY_NEWLINE);
+ vty_outln (vty, "%% Failure stopping ssmpingd for source %s: %d",
+ source_str, result);
return CMD_WARNING;
}
pim_ifp = pim_if_new(ifp, 1 /* igmp=true */, 0 /* pim=false */);
if (!pim_ifp)
{
- vty_out(vty, "Could not enable IGMP on interface %s%s",
- ifp->name, VTY_NEWLINE);
+ vty_outln (vty, "Could not enable IGMP on interface %s",
+ ifp->name);
return CMD_WARNING;
}
need_startup = 1;
group_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
- vty_out(vty, "Bad group address %s: errno=%d: %s%s",
- group_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad group address %s: errno=%d: %s",
+ group_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
source_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
- vty_out(vty, "Bad source address %s: errno=%d: %s%s",
- source_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad source address %s: errno=%d: %s",
+ source_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
result = pim_if_igmp_join_add(ifp, group_addr, source_addr);
if (result) {
- vty_out(vty, "%% Failure joining IGMP group %s source %s on interface %s: %d%s",
- group_str, source_str, ifp->name, result, VTY_NEWLINE);
+ vty_outln (vty, "%% Failure joining IGMP group %s source %s on interface %s: %d",
+ group_str, source_str, ifp->name, result);
return CMD_WARNING;
}
group_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
- vty_out(vty, "Bad group address %s: errno=%d: %s%s",
- group_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad group address %s: errno=%d: %s",
+ group_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
source_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
- vty_out(vty, "Bad source address %s: errno=%d: %s%s",
- source_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad source address %s: errno=%d: %s",
+ source_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
result = pim_if_igmp_join_del(ifp, group_addr, source_addr);
if (result) {
- vty_out(vty, "%% Failure leaving IGMP group %s source %s on interface %s: %d%s",
- group_str, source_str, ifp->name, result, VTY_NEWLINE);
+ vty_outln (vty, "%% Failure leaving IGMP group %s source %s on interface %s: %d",
+ group_str, source_str, ifp->name, result);
return CMD_WARNING;
}
already, but we verify them anyway for extra safety.
*/
if (query_interval < IGMP_QUERY_INTERVAL_MIN) {
- vty_out(vty, "General query interval %d lower than minimum %d%s",
+ vty_outln (vty, "General query interval %d lower than minimum %d",
query_interval,
- IGMP_QUERY_INTERVAL_MIN,
- VTY_NEWLINE);
+ IGMP_QUERY_INTERVAL_MIN);
return CMD_WARNING;
}
if (query_interval > IGMP_QUERY_INTERVAL_MAX) {
- vty_out(vty, "General query interval %d higher than maximum %d%s",
+ vty_outln (vty, "General query interval %d higher than maximum %d",
query_interval,
- IGMP_QUERY_INTERVAL_MAX,
- VTY_NEWLINE);
+ IGMP_QUERY_INTERVAL_MAX);
return CMD_WARNING;
}
if (query_interval_dsec <= pim_ifp->igmp_query_max_response_time_dsec) {
- vty_out(vty,
- "Can't set general query interval %d dsec <= query max response time %d dsec.%s",
- query_interval_dsec, pim_ifp->igmp_query_max_response_time_dsec,
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Can't set general query interval %d dsec <= query max response time %d dsec.",
+ query_interval_dsec,pim_ifp->igmp_query_max_response_time_dsec);
return CMD_WARNING;
}
default_query_interval_dsec = IGMP_GENERAL_QUERY_INTERVAL * 10;
if (default_query_interval_dsec <= pim_ifp->igmp_query_max_response_time_dsec) {
- vty_out(vty,
- "Can't set default general query interval %d dsec <= query max response time %d dsec.%s",
- default_query_interval_dsec, pim_ifp->igmp_query_max_response_time_dsec,
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Can't set default general query interval %d dsec <= query max response time %d dsec.",
+ default_query_interval_dsec,
+ pim_ifp->igmp_query_max_response_time_dsec);
return CMD_WARNING;
}
query_max_response_time = atoi(argv[3]->arg);
if (query_max_response_time >= pim_ifp->igmp_default_query_interval * 10) {
- vty_out(vty,
- "Can't set query max response time %d sec >= general query interval %d sec%s",
- query_max_response_time, pim_ifp->igmp_default_query_interval,
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Can't set query max response time %d sec >= general query interval %d sec",
+ query_max_response_time,pim_ifp->igmp_default_query_interval);
return CMD_WARNING;
}
default_query_interval_dsec = 10 * pim_ifp->igmp_default_query_interval;
if (query_max_response_time_dsec >= default_query_interval_dsec) {
- vty_out(vty,
- "Can't set query max response time %d dsec >= general query interval %d dsec%s",
- query_max_response_time_dsec, default_query_interval_dsec,
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Can't set query max response time %d dsec >= general query interval %d dsec",
+ query_max_response_time_dsec,default_query_interval_dsec);
return CMD_WARNING;
}
uint32_t old_dr_prio;
if (!pim_ifp) {
- vty_out(vty, "Please enable PIM on interface, first%s", VTY_NEWLINE);
+ vty_outln (vty, "Please enable PIM on interface, first");
return CMD_WARNING;
}
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- vty_out(vty, "Pim not enabled on this interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Pim not enabled on this interface");
return CMD_WARNING;
}
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Could not enable PIM SM on interface");
return CMD_WARNING;
}
- vty_out(vty, "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed%s", VTY_NEWLINE);
+ vty_outln(vty, "WARN: Enabled PIM SM on interface; configure PIM SSM "
+ "range if needed");
return CMD_SUCCESS;
}
{
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Could not enable PIM SM on interface");
return CMD_WARNING;
}
{
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_delete(ifp)) {
- vty_out(vty, "Unable to delete interface information%s", VTY_NEWLINE);
+ vty_outln (vty, "Unable to delete interface information");
return CMD_WARNING;
}
{
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_delete(ifp)) {
- vty_out(vty, "Unable to delete interface information%s", VTY_NEWLINE);
+ vty_outln (vty, "Unable to delete interface information");
return CMD_WARNING;
}
oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) {
- vty_out(vty, "No such interface name %s%s",
- oifname, VTY_NEWLINE);
+ vty_outln (vty, "No such interface name %s",
+ oifname);
return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
- vty_out(vty, "Bad group address %s: errno=%d: %s%s",
- grp_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad group address %s: errno=%d: %s",
+ grp_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
src_addr.s_addr = INADDR_ANY;
if (pim_static_add(iif, oif, grp_addr, src_addr)) {
- vty_out(vty, "Failed to add route%s", VTY_NEWLINE);
+ vty_outln (vty, "Failed to add route");
return CMD_WARNING;
}
oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) {
- vty_out(vty, "No such interface name %s%s",
- oifname, VTY_NEWLINE);
+ vty_outln (vty, "No such interface name %s",
+ oifname);
return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
- vty_out(vty, "Bad group address %s: errno=%d: %s%s",
- grp_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad group address %s: errno=%d: %s",
+ grp_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
src_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, src_str, &src_addr);
if (result <= 0) {
- vty_out(vty, "Bad source address %s: errno=%d: %s%s",
- src_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad source address %s: errno=%d: %s",
+ src_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
if (pim_static_add(iif, oif, grp_addr, src_addr)) {
- vty_out(vty, "Failed to add route%s", VTY_NEWLINE);
+ vty_outln (vty, "Failed to add route");
return CMD_WARNING;
}
oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) {
- vty_out(vty, "No such interface name %s%s",
- oifname, VTY_NEWLINE);
+ vty_outln (vty, "No such interface name %s",
+ oifname);
return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
- vty_out(vty, "Bad group address %s: errno=%d: %s%s",
- grp_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad group address %s: errno=%d: %s",
+ grp_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
src_addr.s_addr = INADDR_ANY;
if (pim_static_del(iif, oif, grp_addr, src_addr)) {
- vty_out(vty, "Failed to remove route%s", VTY_NEWLINE);
+ vty_outln (vty, "Failed to remove route");
return CMD_WARNING;
}
oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) {
- vty_out(vty, "No such interface name %s%s",
- oifname, VTY_NEWLINE);
+ vty_outln (vty, "No such interface name %s",
+ oifname);
return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
- vty_out(vty, "Bad group address %s: errno=%d: %s%s",
- grp_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad group address %s: errno=%d: %s",
+ grp_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
src_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, src_str, &src_addr);
if (result <= 0) {
- vty_out(vty, "Bad source address %s: errno=%d: %s%s",
- src_str, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "Bad source address %s: errno=%d: %s",
+ src_str, errno, safe_strerror(errno));
return CMD_WARNING;
}
if (pim_static_del(iif, oif, grp_addr, src_addr)) {
- vty_out(vty, "Failed to remove route%s", VTY_NEWLINE);
+ vty_outln (vty, "Failed to remove route");
return CMD_WARNING;
}
{
if (!pim_cmd_interface_add(ifp))
{
- vty_out(vty, "Could not enable PIM SM on interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Could not enable PIM SM on interface");
return CMD_WARNING;
}
}
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- vty_out(vty, "Pim not enabled on this interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Pim not enabled on this interface");
return CMD_WARNING;
}
if (argv_find (argv, argc, "hello", &idx))
{
PIM_DO_DEBUG_PIM_HELLO;
- vty_out (vty, "PIM Hello debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Hello debugging is on");
}
else if (argv_find (argv, argc ,"joins", &idx))
{
PIM_DO_DEBUG_PIM_J_P;
- vty_out (vty, "PIM Join/Prune debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Join/Prune debugging is on");
}
else if (argv_find (argv, argc, "register", &idx))
{
PIM_DO_DEBUG_PIM_REG;
- vty_out (vty, "PIM Register debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Register debugging is on");
}
else
{
PIM_DO_DEBUG_PIM_PACKETS;
- vty_out (vty, "PIM Packet debugging is on %s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Packet debugging is on ");
}
return CMD_SUCCESS;
}
if (argv_find (argv, argc,"hello",&idx))
{
PIM_DONT_DEBUG_PIM_HELLO;
- vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Hello debugging is off ");
}
else if (argv_find (argv, argc, "joins", &idx))
{
PIM_DONT_DEBUG_PIM_J_P;
- vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Join/Prune debugging is off ");
}
else if (argv_find (argv, argc, "register", &idx))
{
PIM_DONT_DEBUG_PIM_REG;
- vty_out (vty, "PIM Register debugging is off%s", VTY_NEWLINE);
+ vty_outln (vty, "PIM Register debugging is off");
}
else
PIM_DONT_DEBUG_PIM_PACKETS;
result = inet_pton(AF_INET, source, &source_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad source address %s: errno=%d: %s%s",
- source, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad source address %s: errno=%d: %s",
+ source, errno, safe_strerror(errno));
return CMD_WARNING;
}
case PIM_SUCCESS:
break;
case PIM_IFACE_NOT_FOUND:
- vty_out(vty, "Pim not enabled on this interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Pim not enabled on this interface");
break;
case PIM_UPDATE_SOURCE_DUP:
- vty_out(vty, "%% Source already set to %s%s", source, VTY_NEWLINE);
+ vty_outln (vty, "%% Source already set to %s", source);
break;
default:
- vty_out(vty, "%% Source set failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Source set failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
result = inet_pton(AF_INET, peer, &peer_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad peer address %s: errno=%d: %s%s",
- peer, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad peer address %s: errno=%d: %s",
+ peer, errno, safe_strerror(errno));
return CMD_WARNING;
}
result = inet_pton(AF_INET, local, &local_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad source address %s: errno=%d: %s%s",
- local, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad source address %s: errno=%d: %s",
+ local, errno, safe_strerror(errno));
return CMD_WARNING;
}
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_OOM:
- vty_out(vty, "%% Out of memory%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Out of memory");
break;
case PIM_MSDP_ERR_PEER_EXISTS:
- vty_out(vty, "%% Peer exists%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Peer exists");
break;
case PIM_MSDP_ERR_MAX_MESH_GROUPS:
- vty_out(vty, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Only one mesh-group allowed currently");
break;
default:
- vty_out(vty, "%% peer add failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% peer add failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
result = inet_pton(AF_INET, peer, &peer_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad peer address %s: errno=%d: %s%s",
- peer, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad peer address %s: errno=%d: %s",
+ peer, errno, safe_strerror(errno));
return CMD_WARNING;
}
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_NO_PEER:
- vty_out(vty, "%% Peer does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Peer does not exist");
break;
default:
- vty_out(vty, "%% peer del failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% peer del failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
result = inet_pton(AF_INET, mbr, &mbr_ip);
if (result <= 0) {
- vty_out(vty, "%% Bad member address %s: errno=%d: %s%s",
- mbr, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad member address %s: errno=%d: %s",
+ mbr, errno, safe_strerror(errno));
return CMD_WARNING;
}
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_OOM:
- vty_out(vty, "%% Out of memory%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Out of memory");
break;
case PIM_MSDP_ERR_MG_MBR_EXISTS:
- vty_out(vty, "%% mesh-group member exists%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group member exists");
break;
case PIM_MSDP_ERR_MAX_MESH_GROUPS:
- vty_out(vty, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Only one mesh-group allowed currently");
break;
default:
- vty_out(vty, "%% member add failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% member add failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
result = inet_pton(AF_INET, mbr, &mbr_ip);
if (result <= 0) {
- vty_out(vty, "%% Bad member address %s: errno=%d: %s%s",
- mbr, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad member address %s: errno=%d: %s",
+ mbr, errno, safe_strerror(errno));
return CMD_WARNING;
}
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_NO_MG:
- vty_out(vty, "%% mesh-group does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group does not exist");
break;
case PIM_MSDP_ERR_NO_MG_MBR:
- vty_out(vty, "%% mesh-group member does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group member does not exist");
break;
default:
- vty_out(vty, "%% mesh-group member del failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group member del failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
result = inet_pton(AF_INET, src, &src_ip);
if (result <= 0) {
- vty_out(vty, "%% Bad source address %s: errno=%d: %s%s",
- src, errno, safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Bad source address %s: errno=%d: %s",
+ src, errno, safe_strerror(errno));
return CMD_WARNING;
}
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_OOM:
- vty_out(vty, "%% Out of memory%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Out of memory");
break;
case PIM_MSDP_ERR_MAX_MESH_GROUPS:
- vty_out(vty, "%% Only one mesh-group allowed currently%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Only one mesh-group allowed currently");
break;
default:
- vty_out(vty, "%% source add failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% source add failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_NO_MG:
- vty_out(vty, "%% mesh-group does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group does not exist");
break;
default:
- vty_out(vty, "%% mesh-group source del failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group source del failed");
}
return result?CMD_WARNING:CMD_SUCCESS;
case PIM_MSDP_ERR_NONE:
break;
case PIM_MSDP_ERR_NO_MG:
- vty_out(vty, "%% mesh-group does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group does not exist");
break;
default:
- vty_out(vty, "%% mesh-group source del failed%s", VTY_NEWLINE);
+ vty_outln (vty, "%% mesh-group source del failed");
}
return result ? CMD_WARNING : CMD_SUCCESS;
{
json_object *json;
json = json_object_new_object();
- 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);
}
json_object_string_add(json_mg_row, "name", mg->mesh_group_name);
json_object_string_add(json_mg_row, "source", src_str);
} else {
- vty_out(vty, "Mesh group : %s%s", mg->mesh_group_name, VTY_NEWLINE);
- vty_out(vty, " Source : %s%s", src_str, VTY_NEWLINE);
- vty_out(vty, " Member State%s", VTY_NEWLINE);
+ vty_outln (vty, "Mesh group : %s", mg->mesh_group_name);
+ vty_outln (vty, " Source : %s", src_str);
+ vty_outln (vty, " Member State");
}
for (ALL_LIST_ELEMENTS_RO(mg->mbr_list, mbrnode, mbr)) {
}
json_object_object_add(json_members, mbr_str, json_row);
} else {
- vty_out(vty, " %-15s %11s%s",
- mbr_str, state_str, VTY_NEWLINE);
+ vty_outln (vty, " %-15s %11s",
+ mbr_str, state_str);
}
}
if (uj) {
json_object_object_add(json, mg->mesh_group_name, json_mg_row);
- 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);
}
}
if (uj) {
json = json_object_new_object();
} else {
- vty_out(vty, "Peer Local State Uptime SaCnt%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Peer Local State Uptime SaCnt");
}
for (ALL_LIST_ELEMENTS_RO(msdp->peer_list, mpnode, mp)) {
json_object_int_add(json_row, "saCount", mp->sa_cnt);
json_object_object_add(json, peer_str, json_row);
} else {
- vty_out(vty, "%-15s %15s %11s %8s %6d%s",
+ vty_outln (vty, "%-15s %15s %11s %8s %6d",
peer_str, local_str, state_str,
- timebuf, mp->sa_cnt, VTY_NEWLINE);
+ timebuf, mp->sa_cnt);
}
}
if (uj) {
- 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);
}
}
json_object_int_add(json_row, "saRcvd", mp->sa_rx_cnt);
json_object_object_add(json, peer_str, json_row);
} else {
- vty_out(vty, "Peer : %s%s", peer_str, VTY_NEWLINE);
- vty_out(vty, " Local : %s%s", local_str, VTY_NEWLINE);
- vty_out(vty, " Mesh Group : %s%s", mp->mesh_group_name, VTY_NEWLINE);
- vty_out(vty, " State : %s%s", state_str, VTY_NEWLINE);
- vty_out(vty, " Uptime : %s%s", timebuf, VTY_NEWLINE);
-
- vty_out(vty, " Keepalive Timer : %s%s", katimer, VTY_NEWLINE);
- vty_out(vty, " Conn Retry Timer : %s%s", crtimer, VTY_NEWLINE);
- vty_out(vty, " Hold Timer : %s%s", holdtimer, VTY_NEWLINE);
- vty_out(vty, " Last Reset : %s%s", mp->last_reset, VTY_NEWLINE);
- vty_out(vty, " Conn Attempts : %d%s", mp->conn_attempts, VTY_NEWLINE);
- vty_out(vty, " Established Changes : %d%s", mp->est_flaps, VTY_NEWLINE);
- vty_out(vty, " SA Count : %d%s", mp->sa_cnt, VTY_NEWLINE);
- vty_out(vty, " Statistics :%s", VTY_NEWLINE);
- vty_out(vty, " Sent Rcvd%s", VTY_NEWLINE);
- vty_out(vty, " Keepalives : %10d %10d%s",
- mp->ka_tx_cnt, mp->ka_rx_cnt, VTY_NEWLINE);
- vty_out(vty, " SAs : %10d %10d%s",
- mp->sa_tx_cnt, mp->sa_rx_cnt, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Peer : %s", peer_str);
+ vty_outln (vty, " Local : %s", local_str);
+ vty_outln (vty, " Mesh Group : %s", mp->mesh_group_name);
+ vty_outln (vty, " State : %s", state_str);
+ vty_outln (vty, " Uptime : %s", timebuf);
+
+ vty_outln (vty, " Keepalive Timer : %s", katimer);
+ vty_outln (vty, " Conn Retry Timer : %s", crtimer);
+ vty_outln (vty, " Hold Timer : %s", holdtimer);
+ vty_outln (vty, " Last Reset : %s", mp->last_reset);
+ vty_outln (vty, " Conn Attempts : %d", mp->conn_attempts);
+ vty_outln (vty, " Established Changes : %d", mp->est_flaps);
+ vty_outln (vty, " SA Count : %d", mp->sa_cnt);
+ vty_outln (vty, " Statistics :");
+ vty_outln (vty, " Sent Rcvd");
+ vty_outln (vty, " Keepalives : %10d %10d",
+ mp->ka_tx_cnt, mp->ka_rx_cnt);
+ vty_outln (vty, " SAs : %10d %10d",
+ mp->sa_tx_cnt, mp->sa_rx_cnt);
+ vty_out (vty, VTYNL);
}
}
if (uj) {
- 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);
}
}
if (uj) {
json = json_object_new_object();
} else {
- vty_out(vty, "Source Group RP Local SPT Uptime%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Source Group RP Local SPT Uptime");
}
for (ALL_LIST_ELEMENTS_RO(msdp->sa_list, sanode, sa)) {
json_object_string_add(json_row, "upTime", timebuf);
json_object_object_add(json_group, src_str, json_row);
} else {
- vty_out(vty, "%-15s %15s %15s %5c %3c %8s%s",
- src_str, grp_str, rp_str, local_str[0], spt_str[0], timebuf, VTY_NEWLINE);
+ vty_outln (vty, "%-15s %15s %15s %5c %3c %8s",
+ src_str, grp_str, rp_str, local_str[0], spt_str[0], timebuf);
}
}
if (uj) {
- 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);
}
}
json_object_string_add(json_row, "stateTimer", statetimer);
json_object_object_add(json_group, src_str, json_row);
} else {
- vty_out(vty, "SA : %s%s", sa->sg_str, VTY_NEWLINE);
- vty_out(vty, " RP : %s%s", rp_str, VTY_NEWLINE);
- vty_out(vty, " Peer : %s%s", peer_str, VTY_NEWLINE);
- vty_out(vty, " Local : %s%s", local_str, VTY_NEWLINE);
- vty_out(vty, " SPT Setup : %s%s", spt_str, VTY_NEWLINE);
- vty_out(vty, " Uptime : %s%s", timebuf, VTY_NEWLINE);
- vty_out(vty, " State Timer : %s%s", statetimer, VTY_NEWLINE);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "SA : %s", sa->sg_str);
+ vty_outln (vty, " RP : %s", rp_str);
+ vty_outln (vty, " Peer : %s", peer_str);
+ vty_outln (vty, " Local : %s", local_str);
+ vty_outln (vty, " SPT Setup : %s", spt_str);
+ vty_outln (vty, " Uptime : %s", timebuf);
+ vty_outln (vty, " State Timer : %s", statetimer);
+ vty_out (vty, VTYNL);
}
}
}
if (uj) {
- 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);
}
}
}
if (uj) {
- 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);
}
}
}
if (uj) {
- 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);
}
}
if (mg->src_ip.s_addr != INADDR_ANY) {
pim_inet4_dump("<src?>", mg->src_ip, src_str, sizeof(src_str));
- vty_out(vty, "ip msdp mesh-group %s source %s%s",
- mg->mesh_group_name, src_str, VTY_NEWLINE);
+ vty_outln (vty, "ip msdp mesh-group %s source %s",
+ mg->mesh_group_name, src_str);
++count;
}
for (ALL_LIST_ELEMENTS_RO(mg->mbr_list, mbrnode, mbr)) {
pim_inet4_dump("<mbr?>", mbr->mbr_ip, mbr_str, sizeof(mbr_str));
- vty_out(vty, "ip msdp mesh-group %s member %s%s",
- mg->mesh_group_name, mbr_str, VTY_NEWLINE);
+ vty_outln (vty, "ip msdp mesh-group %s member %s",
+ mg->mesh_group_name, mbr_str);
++count;
}
return count;
continue;
if (rp_info->plist)
- vty_out(vty, "ip pim rp %s prefix-list %s%s",
+ vty_outln (vty, "ip pim rp %s prefix-list %s",
inet_ntop(AF_INET, &rp_info->rp.rpf_addr.u.prefix4, rp_buffer, 32),
- rp_info->plist, VTY_NEWLINE);
+ rp_info->plist);
else
- vty_out(vty, "ip pim rp %s %s%s",
+ vty_outln (vty, "ip pim rp %s %s",
inet_ntop(AF_INET, &rp_info->rp.rpf_addr.u.prefix4, rp_buffer, 32),
- prefix2str(&rp_info->group, group_buffer, 32), VTY_NEWLINE);
+ prefix2str(&rp_info->group, group_buffer, 32));
count++;
}
if (uj)
json = json_object_new_object();
else
- vty_out (vty, "RP address group/prefix-list OIF I am RP%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "RP address group/prefix-list OIF I am RP");
for (ALL_LIST_ELEMENTS_RO (qpim_rp_list, node, rp_info))
{
vty_out (vty, "%-10s ", "(Unknown)");
if (rp_info->i_am_rp)
- vty_out (vty, "yes%s", VTY_NEWLINE);
+ vty_outln (vty, "yes");
else
- vty_out (vty, "no%s", VTY_NEWLINE);
+ vty_outln (vty, "no");
}
prev_rp_info = rp_info;
if (prev_rp_info && json_rp_rows)
json_object_object_add(json, inet_ntoa (prev_rp_info->rp.rpf_addr.u.prefix4), json_rp_rows);
- 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);
}
}
{
struct interface *oifp = pim_if_find_by_vif_index (i);
if (sroute->source.s_addr == 0)
- vty_out (vty, " ip mroute %s %s%s", oifp->name, gbuf, VTY_NEWLINE);
+ vty_outln (vty, " ip mroute %s %s", oifp->name, gbuf);
else
- vty_out (vty, " ip mroute %s %s %s%s", oifp->name, gbuf, sbuf, VTY_NEWLINE);
+ vty_outln (vty, " ip mroute %s %s %s", oifp->name, gbuf,
+ sbuf);
count ++;
}
}
int writes = 0;
if (PIM_DEBUG_MSDP_EVENTS) {
- vty_out(vty, "debug msdp events%s", VTY_NEWLINE);
+ vty_outln (vty, "debug msdp events");
++writes;
}
if (PIM_DEBUG_MSDP_PACKETS) {
- vty_out(vty, "debug msdp packets%s", VTY_NEWLINE);
+ vty_outln (vty, "debug msdp packets");
++writes;
}
if (PIM_DEBUG_MSDP_INTERNAL) {
- vty_out(vty, "debug msdp internal%s", VTY_NEWLINE);
+ vty_outln (vty, "debug msdp internal");
++writes;
}
if (PIM_DEBUG_IGMP_EVENTS) {
- vty_out(vty, "debug igmp events%s", VTY_NEWLINE);
+ vty_outln (vty, "debug igmp events");
++writes;
}
if (PIM_DEBUG_IGMP_PACKETS) {
- vty_out(vty, "debug igmp packets%s", VTY_NEWLINE);
+ vty_outln (vty, "debug igmp packets");
++writes;
}
if (PIM_DEBUG_IGMP_TRACE) {
- vty_out(vty, "debug igmp trace%s", VTY_NEWLINE);
+ vty_outln (vty, "debug igmp trace");
++writes;
}
if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
- vty_out(vty, "debug igmp trace detail%s", VTY_NEWLINE);
+ vty_outln (vty, "debug igmp trace detail");
++writes;
}
if (PIM_DEBUG_MROUTE) {
- vty_out(vty, "debug mroute%s", VTY_NEWLINE);
+ vty_outln (vty, "debug mroute");
++writes;
}
if (PIM_DEBUG_MROUTE_DETAIL) {
- vty_out (vty, "debug mroute detail%s", VTY_NEWLINE);
+ vty_outln (vty, "debug mroute detail");
++writes;
}
if (PIM_DEBUG_PIM_EVENTS) {
- vty_out(vty, "debug pim events%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim events");
++writes;
}
if (PIM_DEBUG_PIM_PACKETS) {
- vty_out(vty, "debug pim packets%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim packets");
++writes;
}
if (PIM_DEBUG_PIM_PACKETDUMP_SEND) {
- vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim packet-dump send");
++writes;
}
if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
- vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim packet-dump receive");
++writes;
}
if (PIM_DEBUG_PIM_TRACE) {
- vty_out(vty, "debug pim trace%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim trace");
++writes;
}
if (PIM_DEBUG_PIM_TRACE_DETAIL) {
- vty_out(vty, "debug pim trace detail%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim trace detail");
++writes;
}
if (PIM_DEBUG_ZEBRA) {
- vty_out(vty, "debug pim zebra%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim zebra");
++writes;
}
if (PIM_DEBUG_SSMPINGD) {
- vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE);
+ vty_outln (vty, "debug ssmpingd");
++writes;
}
if (PIM_DEBUG_PIM_HELLO) {
- vty_out (vty, "debug pim packets hello%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim packets hello");
++writes;
}
if (PIM_DEBUG_PIM_J_P) {
- vty_out (vty, "debug pim packets joins%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim packets joins");
++writes;
}
if (PIM_DEBUG_PIM_REG) {
- vty_out (vty, "debug pim packets register%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim packets register");
++writes;
}
if (PIM_DEBUG_STATIC) {
- vty_out (vty, "debug pim static%s", VTY_NEWLINE);
+ vty_outln (vty, "debug pim static");
++writes;
}
if (!pimg->send_v6_secondary)
{
- vty_out (vty, "no ip pim send-v6-secondary%s", VTY_NEWLINE);
+ vty_outln (vty, "no ip pim send-v6-secondary");
++writes;
}
if (qpim_register_suppress_time != PIM_REGISTER_SUPPRESSION_TIME_DEFAULT)
{
- vty_out (vty, "ip pim register-suppress-time %d%s",
- qpim_register_suppress_time, VTY_NEWLINE);
+ vty_outln (vty, "ip pim register-suppress-time %d",
+ qpim_register_suppress_time);
++writes;
}
if (qpim_t_periodic != PIM_DEFAULT_T_PERIODIC)
{
- vty_out (vty, "ip pim join-prune-interval %d%s",
- qpim_t_periodic, VTY_NEWLINE);
+ vty_outln (vty, "ip pim join-prune-interval %d",
+ qpim_t_periodic);
++writes;
}
if (qpim_keep_alive_time != PIM_KEEPALIVE_PERIOD)
{
- vty_out (vty, "ip pim keep-alive-timer %d%s",
- qpim_keep_alive_time, VTY_NEWLINE);
+ vty_outln (vty, "ip pim keep-alive-timer %d",
+ qpim_keep_alive_time);
++writes;
}
if (qpim_packet_process != PIM_DEFAULT_PACKET_PROCESS)
{
- vty_out (vty, "ip pim packets %d%s",
- qpim_packet_process, VTY_NEWLINE);
+ vty_outln (vty, "ip pim packets %d",
+ qpim_packet_process);
++writes;
}
if (ssm->plist_name)
{
- vty_out (vty, "ip pim ssm prefix-list %s%s",
- ssm->plist_name, VTY_NEWLINE);
+ vty_outln (vty, "ip pim ssm prefix-list %s",
+ ssm->plist_name);
++writes;
}
if (pimg->spt.switchover == PIM_SPT_INFINITY)
{
if (pimg->spt.plist)
- vty_out (vty, "ip pim spt-switchover infinity-and-beyond prefix-list %s%s",
- pimg->spt.plist, VTY_NEWLINE);
+ vty_outln (vty, "ip pim spt-switchover infinity-and-beyond prefix-list %s",
+ pimg->spt.plist);
else
- vty_out (vty, "ip pim spt-switchover infinity-and-beyond%s",
- VTY_NEWLINE);
+ vty_outln (vty,"ip pim spt-switchover infinity-and-beyond");
++writes;
}
if (qpim_ecmp_rebalance_enable)
{
- vty_out (vty, "ip pim ecmp rebalance%s", VTY_NEWLINE);
+ vty_outln (vty, "ip pim ecmp rebalance");
++writes;
}
else if (qpim_ecmp_enable)
{
- vty_out (vty, "ip pim ecmp%s", VTY_NEWLINE);
+ vty_outln (vty, "ip pim ecmp");
++writes;
}
if (qpim_ssmpingd_list) {
struct listnode *node;
struct ssmpingd_sock *ss;
- vty_out(vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
++writes;
for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) {
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str));
- vty_out(vty, "ip ssmpingd %s%s", source_str, VTY_NEWLINE);
+ vty_outln (vty, "ip ssmpingd %s", source_str);
++writes;
}
}
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) {
/* IF name */
- vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE);
+ vty_outln (vty, "interface %s", ifp->name);
++writes;
if (ifp->info) {
struct pim_interface *pim_ifp = ifp->info;
if (PIM_IF_TEST_PIM(pim_ifp->options)) {
- vty_out(vty, " ip pim sm%s", VTY_NEWLINE);
+ vty_outln (vty, " ip pim sm");
++writes;
}
/* IF ip pim drpriority */
if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) {
- vty_out(vty, " ip pim drpriority %u%s", pim_ifp->pim_dr_priority,
- VTY_NEWLINE);
+ vty_outln (vty, " ip pim drpriority %u",pim_ifp->pim_dr_priority);
++writes;
}
vty_out(vty, " ip pim hello %d", pim_ifp->pim_hello_period);
if (pim_ifp->pim_default_holdtime != -1)
vty_out(vty, " %d", pim_ifp->pim_default_holdtime);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* update source */
char src_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", pim_ifp->update_source, src_str,
sizeof(src_str));
- vty_out(vty, " ip pim use-source %s%s", src_str, VTY_NEWLINE);
+ vty_outln (vty, " ip pim use-source %s", src_str);
++writes;
}
/* IF ip igmp */
if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
- vty_out(vty, " ip igmp%s", VTY_NEWLINE);
+ vty_outln (vty, " ip igmp");
++writes;
}
/* ip igmp version */
if (pim_ifp->igmp_version != IGMP_DEFAULT_VERSION)
{
- vty_out(vty, " ip igmp version %d%s",
- pim_ifp->igmp_version,
- VTY_NEWLINE);
+ vty_outln (vty, " ip igmp version %d",
+ pim_ifp->igmp_version);
++writes;
}
/* IF ip igmp query-interval */
if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)
{
- vty_out(vty, " ip igmp query-interval %d%s",
- pim_ifp->igmp_default_query_interval,
- VTY_NEWLINE);
+ vty_outln (vty, " ip igmp query-interval %d",
+ pim_ifp->igmp_default_query_interval);
++writes;
}
/* IF ip igmp query-max-response-time */
if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC)
{
- vty_out(vty, " ip igmp query-max-response-time %d%s",
- pim_ifp->igmp_query_max_response_time_dsec,
- VTY_NEWLINE);
+ vty_outln (vty, " ip igmp query-max-response-time %d",
+ pim_ifp->igmp_query_max_response_time_dsec);
++writes;
}
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str));
inet_ntop(AF_INET, &ij->source_addr, source_str, sizeof(source_str));
- vty_out(vty, " ip igmp join %s %s%s",
- group_str, source_str,
- VTY_NEWLINE);
+ vty_outln (vty, " ip igmp join %s %s",
+ group_str,source_str);
++writes;
}
}
writes += pim_static_write_mroute (vty, ifp);
}
- vty_out(vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
++writes;
/* PIM BFD write */
pim_bfd_write_config (vty, ifp);
vty_out(vty, "Zclient update socket: ");
if (zclient) {
- vty_out(vty, "%d failures=%d%s", zclient->sock,
- zclient->fail, VTY_NEWLINE);
+ vty_outln (vty, "%d failures=%d", zclient->sock,
+ zclient->fail);
}
else {
- vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
+ vty_outln (vty, "<null zclient>");
}
}
void
zclient_lookup_free (void)
{
+ zclient_stop (zlookup);
zclient_free (zlookup);
zlookup = NULL;
}
{
vty_out(vty, "Zclient lookup socket: ");
if (zlookup) {
- vty_out(vty, "%d failures=%d%s", zlookup->sock,
- zlookup->fail, VTY_NEWLINE);
+ vty_outln (vty, "%d failures=%d", zlookup->sock,
+ zlookup->fail);
}
else {
- vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
+ vty_outln (vty, "<null zclient>");
}
}
void pim_terminate()
{
+ struct zclient *zclient;
+
pim_free();
/* reverse prefix_list_init */
prefix_list_reset ();
pim_vrf_terminate ();
+
+ zclient = pim_zebra_zclient_get ();
+ if (zclient)
+ {
+ zclient_stop (zclient);
+ zclient_free (zclient);
+ }
}
--- /dev/null
+EXTRA_DIST = \
+ clidef.py \
+ clippy/__init__.py
--- /dev/null
+# FRR CLI preprocessor (DEFPY)
+#
+# Copyright (C) 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
+
+import clippy, traceback, sys, os
+from collections import OrderedDict
+from functools import reduce
+from pprint import pprint
+from string import Template
+from io import StringIO
+
+# the various handlers generate output C code for a particular type of
+# CLI token, choosing the most useful output C type.
+
+class RenderHandler(object):
+ def __init__(self, token):
+ pass
+ def combine(self, other):
+ if type(self) == type(other):
+ return other
+ return StringHandler(None)
+
+ deref = ''
+ drop_str = False
+
+class StringHandler(RenderHandler):
+ argtype = 'const char *'
+ decl = Template('const char *$varname = NULL;')
+ code = Template('$varname = argv[_i]->arg;')
+ drop_str = True
+
+class LongHandler(RenderHandler):
+ argtype = 'long'
+ decl = Template('long $varname = 0;')
+ code = Template('''\
+char *_end;
+$varname = strtol(argv[_i]->arg, &_end, 10);
+_fail = (_end == argv[_i]->arg) || (*_end != '\\0');''')
+
+# A.B.C.D/M (prefix_ipv4) and
+# X:X::X:X/M (prefix_ipv6) are "compatible" and can merge into a
+# struct prefix:
+
+class PrefixBase(RenderHandler):
+ def combine(self, other):
+ if type(self) == type(other):
+ return other
+ if type(other) in [Prefix4Handler, Prefix6Handler, PrefixGenHandler]:
+ return PrefixGenHandler(None)
+ return StringHandler(None)
+ deref = '&'
+class Prefix4Handler(PrefixBase):
+ argtype = 'const struct prefix_ipv4 *'
+ decl = Template('struct prefix_ipv4 $varname = { };')
+ code = Template('_fail = !str2prefix_ipv4(argv[_i]->arg, &$varname);')
+class Prefix6Handler(PrefixBase):
+ argtype = 'const struct prefix_ipv6 *'
+ decl = Template('struct prefix_ipv6 $varname = { };')
+ code = Template('_fail = !str2prefix_ipv6(argv[_i]->arg, &$varname);')
+class PrefixGenHandler(PrefixBase):
+ argtype = 'const struct prefix *'
+ decl = Template('struct prefix $varname = { };')
+ code = Template('_fail = !str2prefix(argv[_i]->arg, &$varname);')
+
+# same for IP addresses. result is union sockunion.
+class IPBase(RenderHandler):
+ def combine(self, other):
+ if type(self) == type(other):
+ return other
+ if type(other) in [IP4Handler, IP6Handler, IPGenHandler]:
+ return IPGenHandler(None)
+ return StringHandler(None)
+class IP4Handler(IPBase):
+ argtype = 'struct in_addr'
+ decl = Template('struct in_addr $varname = { INADDR_ANY };')
+ code = Template('_fail = !inet_aton(argv[_i]->arg, &$varname);')
+class IP6Handler(IPBase):
+ argtype = 'struct in6_addr'
+ decl = Template('struct in6_addr $varname = IN6ADDR_ANY_INIT;')
+ code = Template('_fail = !inet_pton(AF_INET6, argv[_i]->arg, &$varname);')
+class IPGenHandler(IPBase):
+ argtype = 'const union sockunion *'
+ decl = Template('''union sockunion s__$varname = { .sa.sa_family = AF_UNSPEC }, *$varname = NULL;''')
+ code = Template('''\
+if (argv[_i]->text[0] == 'X') {
+ s__$varname.sa.sa_family = AF_INET6;
+ _fail = !inet_pton(AF_INET6, argv[_i]->arg, &s__$varname.sin6.sin6_addr);
+ $varname = &s__$varname;
+} else {
+ s__$varname.sa.sa_family = AF_INET;
+ _fail = !inet_aton(argv[_i]->arg, &s__$varname.sin.sin_addr);
+ $varname = &s__$varname;
+}''')
+
+def mix_handlers(handlers):
+ def combine(a, b):
+ if a is None:
+ return b
+ return a.combine(b)
+ return reduce(combine, handlers, None)
+
+handlers = {
+ 'WORD_TKN': StringHandler,
+ 'VARIABLE_TKN': StringHandler,
+ 'RANGE_TKN': LongHandler,
+ 'IPV4_TKN': IP4Handler,
+ 'IPV4_PREFIX_TKN': Prefix4Handler,
+ 'IPV6_TKN': IP6Handler,
+ 'IPV6_PREFIX_TKN': Prefix6Handler,
+}
+
+# core template invoked for each occurence of DEFPY.
+templ = Template('''/* $fnname => "$cmddef" */
+DEFUN_CMD_FUNC_DECL($fnname)
+#define funcdecl_$fnname static int ${fnname}_magic(\\
+ const struct cmd_element *self __attribute__ ((unused)),\\
+ struct vty *vty __attribute__ ((unused)),\\
+ int argc __attribute__ ((unused)),\\
+ struct cmd_token *argv[] __attribute__ ((unused))$argdefs)
+funcdecl_$fnname;
+DEFUN_CMD_FUNC_TEXT($fnname)
+{
+ int _i;
+ unsigned _fail = 0, _failcnt = 0;
+$argdecls
+ for (_i = 0; _i < argc; _i++) {
+ if (!argv[_i]->varname)
+ continue;
+ _fail = 0;$argblocks
+ if (_fail)
+ vty_outln (vty, "%% invalid input for %s: %s",
+ argv[_i]->varname, argv[_i]->arg);
+ _failcnt += _fail;
+ }
+ if (_failcnt)
+ return CMD_WARNING;
+ return ${fnname}_magic(self, vty, argc, argv$arglist);
+}
+
+''')
+
+# invoked for each named parameter
+argblock = Template('''
+ if (!strcmp(argv[_i]->varname, \"$varname\")) {$strblock
+ $code
+ }''')
+
+def process_file(fn, ofd, dumpfd, all_defun):
+ filedata = clippy.parse(fn)
+
+ for entry in filedata['data']:
+ if entry['type'] == 'DEFPY' or (all_defun and entry['type'].startswith('DEFUN')):
+ cmddef = entry['args'][2]
+ for i in cmddef:
+ assert i.startswith('"') and i.endswith('"')
+ cmddef = ''.join([i[1:-1] for i in cmddef])
+
+ graph = clippy.Graph(cmddef)
+ args = OrderedDict()
+ for token, depth in clippy.graph_iterate(graph):
+ if token.type not in handlers:
+ continue
+ if token.varname is None:
+ continue
+ arg = args.setdefault(token.varname, [])
+ arg.append(handlers[token.type](token))
+
+ #print('-' * 76)
+ #pprint(entry)
+ #clippy.dump(graph)
+ #pprint(args)
+
+ params = { 'cmddef': cmddef, 'fnname': entry['args'][0][0] }
+ argdefs = []
+ argdecls = []
+ arglist = []
+ argblocks = []
+ doc = []
+
+ def do_add(handler, varname, attr = ''):
+ argdefs.append(',\\\n\t%s %s%s' % (handler.argtype, varname, attr))
+ argdecls.append('\t%s\n' % (handler.decl.substitute({'varname': varname}).replace('\n', '\n\t')))
+ arglist.append(', %s%s' % (handler.deref, varname))
+ if attr == '':
+ at = handler.argtype
+ if not at.startswith('const '):
+ at = '. . . ' + at
+ doc.append('\t%-26s %s' % (at, varname))
+
+ for varname in args.keys():
+ handler = mix_handlers(args[varname])
+ #print(varname, handler)
+ if handler is None: continue
+ do_add(handler, varname)
+ code = handler.code.substitute({'varname': varname}).replace('\n', '\n\t\t\t')
+ strblock = ''
+ if not handler.drop_str:
+ do_add(StringHandler(None), '%s_str' % (varname), ' __attribute__ ((unused))')
+ strblock = '\n\t\t\t%s_str = argv[_i]->arg;' % (varname)
+ argblocks.append(argblock.substitute({'varname': varname, 'strblock': strblock, 'code': code}))
+
+ if dumpfd is not None:
+ if len(arglist) > 0:
+ dumpfd.write('"%s":\n%s\n\n' % (cmddef, '\n'.join(doc)))
+ else:
+ dumpfd.write('"%s":\n\t---- no magic arguments ----\n\n' % (cmddef))
+
+ params['argdefs'] = ''.join(argdefs)
+ params['argdecls'] = ''.join(argdecls)
+ params['arglist'] = ''.join(arglist)
+ params['argblocks'] = ''.join(argblocks)
+ ofd.write(templ.substitute(params))
+
+if __name__ == '__main__':
+ import argparse
+
+ argp = argparse.ArgumentParser(description = 'FRR CLI preprocessor in Python')
+ argp.add_argument('--all-defun', action = 'store_const', const = True,
+ help = 'process DEFUN() statements in addition to DEFPY()')
+ argp.add_argument('--show', action = 'store_const', const = True,
+ help = 'print out list of arguments and types for each definition')
+ argp.add_argument('-o', type = str, metavar = 'OUTFILE',
+ help = 'output C file name')
+ argp.add_argument('cfile', type = str)
+ args = argp.parse_args()
+
+ dumpfd = None
+ if args.o is not None:
+ ofd = StringIO()
+ if args.show:
+ dumpfd = sys.stdout
+ else:
+ ofd = sys.stdout
+ if args.show:
+ dumpfd = sys.stderr
+
+ process_file(args.cfile, ofd, dumpfd, args.all_defun)
+
+ if args.o is not None:
+ clippy.wrdiff(args.o, ofd)
--- /dev/null
+# FRR CLI preprocessor
+#
+# Copyright (C) 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
+
+import _clippy
+from _clippy import parse, Graph, GraphNode
+
+def graph_iterate(graph):
+ '''iterator yielding all nodes of a graph
+
+ nodes arrive in input/definition order, graph circles are avoided.
+ '''
+
+ queue = [(graph.first(), frozenset(), 0)]
+ while len(queue) > 0:
+ node, stop, depth = queue.pop(0)
+ yield node, depth
+
+ join = node.join()
+ if join is not None:
+ queue.insert(0, (join, stop.union(frozenset([node])), depth))
+ join = frozenset([join])
+
+ stop = join or stop
+ nnext = node.next()
+ for n in reversed(nnext):
+ if n not in stop and n is not node:
+ queue.insert(0, (n, stop, depth + 1))
+
+def dump(graph):
+ '''print out clippy.Graph'''
+
+ for i, depth in graph_iterate(graph):
+ print('\t%s%s %r' % (' ' * (depth * 2), i.type, i.text))
+
+def wrdiff(filename, buf):
+ '''write buffer to file if contents changed'''
+
+ expl = ''
+ if hasattr(buf, 'getvalue'):
+ buf = buf.getvalue()
+ old = None
+ try: old = open(filename, 'r').read()
+ except: pass
+ if old == buf:
+ # sys.stderr.write('%s unchanged, not written\n' % (filename))
+ return
+ with open('.new.' + filename, 'w') as out:
+ out.write(buf)
+ os.rename('.new.' + filename, filename)
%{expand: %%global rpmversion %(echo '@VERSION@' | tr [:blank:]- _ )}
%define frrversion @VERSION@
-#### Check version of texi2html
-# Old versions don't support "--number-footnotes" option.
-%{expand: %%global texi2htmlversion %(if [[ -f /usr/bin/texi2html ]]; then /usr/bin/texi2html --version | cut -d. -f1; else echo 0; fi)}
-
#### Check for systemd or init.d (upstart)
# Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7)
-%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `file /sbin/init` =~ "symbolic link to \`../lib/systemd/systemd'" ]]; then echo systemd; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)}
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
+ %global initsystem systemd
+%else
+%if (0%{?fedora} && 0%{?fedora} < 15) || (0%{?rhel} && 0%{?rhel} < 7)
+ %global initsystem upstart
+%else
+ %{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `readlink -f /sbin/init` = /usr/lib/systemd/systemd ]]; then echo systemd; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)}
+%endif
+%endif
#
# If init system is systemd, then always disable watchfrr
#
#### Check for RedHat 6.x or CentOS 6.x - they are too old to support PIM.
#### Always disable it on these old systems unconditionally
-%{expand: %%global redhat6 %(if [[ `cat /etc/redhat-release 2> /dev/null` =~ release\ 6\. ]]; then echo 6; else echo 0; fi)}
#
-# if CentOS 6 / RedHat 6, then disable PIMd
-%if "%{redhat6}" == "6"
+# if CentOS / RedHat and version < 7, then disable PIMd (too old, won't work)
+%if 0%{?rhel} && 0%{?rhel} < 7
%global with_pimd 0
%endif
BuildRequires: gcc texi2html texinfo patch libcap-devel groff
BuildRequires: readline readline-devel ncurses ncurses-devel
BuildRequires: json-c-devel bison >= 2.7 flex make
+%if 0%{?rhel} && 0%{?rhel} < 7
+#python27-devel is available from ius community repo for RedHat/CentOS 6
+BuildRequires: python27-devel
+%else
+BuildRequires: python-devel >= 2.7
+%endif
Requires: ncurses json-c initscripts
%if %{with_pam}
BuildRequires: pam-devel
%else
--disable-bgp-vnc \
%endif
- --enable-gcc-rdynamic \
--enable-isisd=yes \
%if "%{initsystem}" == "systemd"
--enable-systemd=yes \
make %{?_smp_mflags} MAKEINFO="makeinfo --no-split"
pushd doc
-%if %{texi2htmlversion} < 5
+if [ $(texi2html --version | cut -d. -f1) -lt 5 ]; then
texi2html --number-sections frr.texi
-%else
+else
texi2html --number-footnotes --number-sections frr.texi
-%endif
+fi
popd
%install
DEBUG_STR
RIP_STR)
{
- vty_out (vty, "RIP debugging status:%s", VTY_NEWLINE);
+ vty_outln (vty, "RIP debugging status:");
if (IS_RIP_DEBUG_EVENT)
- vty_out (vty, " RIP event debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " RIP event debugging is on");
if (IS_RIP_DEBUG_PACKET)
{
if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV)
{
- vty_out (vty, " RIP packet debugging is on%s",
- VTY_NEWLINE);
+ vty_outln (vty," RIP packet debugging is on");
}
else
{
if (IS_RIP_DEBUG_SEND)
- vty_out (vty, " RIP packet send debugging is on%s",
- VTY_NEWLINE);
+ vty_outln (vty," RIP packet send debugging is on");
else
- vty_out (vty, " RIP packet receive debugging is on%s",
- VTY_NEWLINE);
+ vty_outln (vty," RIP packet receive debugging is on");
}
}
if (IS_RIP_DEBUG_ZEBRA)
- vty_out (vty, " RIP zebra debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " RIP zebra debugging is on");
return CMD_SUCCESS;
}
if (IS_RIP_DEBUG_EVENT)
{
- vty_out (vty, "debug rip events%s", VTY_NEWLINE);
+ vty_outln (vty, "debug rip events");
write++;
}
if (IS_RIP_DEBUG_PACKET)
{
if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV)
{
- vty_out (vty, "debug rip packet%s",
- VTY_NEWLINE);
+ vty_outln (vty,"debug rip packet");
write++;
}
else
{
if (IS_RIP_DEBUG_SEND)
- vty_out (vty, "debug rip packet send%s",
- VTY_NEWLINE);
+ vty_outln (vty,"debug rip packet send");
else
- vty_out (vty, "debug rip packet recv%s",
- VTY_NEWLINE);
+ vty_outln (vty,"debug rip packet recv");
write++;
}
}
if (IS_RIP_DEBUG_ZEBRA)
{
- vty_out (vty, "debug rip zebra%s", VTY_NEWLINE);
+ vty_outln (vty, "debug rip zebra");
write++;
}
return write;
if (ret < 0)
{
- vty_out (vty, "There is a same network configuration %s%s", argv[idx_ipv4_word]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "There is a same network configuration %s",
+ argv[idx_ipv4_word]->arg);
return CMD_WARNING;
}
if (ret < 0)
{
- vty_out (vty, "Can't find network configuration %s%s", argv[idx_ipv4_word]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "Can't find network configuration %s",
+ argv[idx_ipv4_word]->arg);
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "Please specify address by A.B.C.D%s", VTY_NEWLINE);
+ vty_outln (vty, "Please specify address by A.B.C.D");
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "Please specify address by A.B.C.D%s", VTY_NEWLINE);
+ vty_outln (vty, "Please specify address by A.B.C.D");
return CMD_WARNING;
}
{
if (auth_type != RIP_AUTH_MD5)
{
- vty_out (vty, "auth length argument only valid for md5%s", VTY_NEWLINE);
+ vty_outln (vty, "auth length argument only valid for md5");
return CMD_WARNING;
}
if (strmatch ("rfc", authlen))
if (strlen (argv[idx_line]->arg) > 16)
{
- vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "%% RIPv2 authentication string must be shorter than 16");
return CMD_WARNING;
}
if (ri->key_chain)
{
- vty_out (vty, "%% key-chain configuration exists%s", VTY_NEWLINE);
+ vty_outln (vty, "%% key-chain configuration exists");
return CMD_WARNING;
}
if (ri->auth_str)
{
- vty_out (vty, "%% authentication string configuration exists%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% authentication string configuration exists");
return CMD_WARNING;
}
(!ri->key_chain) )
continue;
- 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);
/* Split horizon. */
if (ri->split_horizon != ri->split_horizon_default)
{
switch (ri->split_horizon) {
case RIP_SPLIT_HORIZON:
- vty_out (vty, " ip rip split-horizon%s", VTY_NEWLINE);
+ vty_outln (vty, " ip rip split-horizon");
break;
case RIP_SPLIT_HORIZON_POISONED_REVERSE:
- vty_out (vty, " ip rip split-horizon poisoned-reverse%s",
- VTY_NEWLINE);
+ vty_outln (vty," ip rip split-horizon poisoned-reverse");
break;
case RIP_NO_SPLIT_HORIZON:
default:
- vty_out (vty, " no ip rip split-horizon%s", VTY_NEWLINE);
+ vty_outln (vty, " no ip rip split-horizon");
break;
}
}
/* RIP version setting. */
if (ri->ri_send != RI_RIP_UNSPEC)
- vty_out (vty, " ip rip send version %s%s",
- lookup_msg(ri_version_msg, ri->ri_send, NULL),
- VTY_NEWLINE);
+ vty_outln (vty, " ip rip send version %s",
+ lookup_msg(ri_version_msg, ri->ri_send, NULL));
if (ri->ri_receive != RI_RIP_UNSPEC)
- vty_out (vty, " ip rip receive version %s%s",
- lookup_msg(ri_version_msg, ri->ri_receive, NULL),
- VTY_NEWLINE);
+ vty_outln (vty, " ip rip receive version %s ",
+ lookup_msg(ri_version_msg, ri->ri_receive, NULL));
if (ri->v2_broadcast)
- vty_out (vty, " ip rip v2-broadcast%s", VTY_NEWLINE);
+ vty_outln (vty, " ip rip v2-broadcast");
/* RIP authentication. */
if (ri->auth_type == RIP_AUTH_SIMPLE_PASSWORD)
- vty_out (vty, " ip rip authentication mode text%s", VTY_NEWLINE);
+ vty_outln (vty, " ip rip authentication mode text");
if (ri->auth_type == RIP_AUTH_MD5)
{
vty_out (vty, " auth-length old-ripd");
else
vty_out (vty, " auth-length rfc");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (ri->auth_str)
- vty_out (vty, " ip rip authentication string %s%s",
- ri->auth_str, VTY_NEWLINE);
+ vty_outln (vty, " ip rip authentication string %s",
+ ri->auth_str);
if (ri->key_chain)
- vty_out (vty, " ip rip authentication key-chain %s%s",
- ri->key_chain, VTY_NEWLINE);
+ vty_outln (vty, " ip rip authentication key-chain %s",
+ ri->key_chain);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
}
return 0;
}
/* Network type RIP enable interface statement. */
for (node = route_top (rip_enable_network); node; node = route_next (node))
if (node->info)
- vty_out (vty, "%s%s/%d%s",
+ vty_outln (vty, "%s%s/%d",
config_mode ? " network " : " ",
inet_ntoa (node->p.u.prefix4),
- node->p.prefixlen,
- VTY_NEWLINE);
+ node->p.prefixlen);
/* Interface name RIP enable statement. */
for (i = 0; i < vector_active (rip_enable_interface); i++)
if ((ifname = vector_slot (rip_enable_interface, i)) != NULL)
- vty_out (vty, "%s%s%s",
+ vty_outln (vty, "%s%s",
config_mode ? " network " : " ",
- ifname,
- VTY_NEWLINE);
+ ifname);
/* RIP neighbors listing. */
for (node = route_top (rip->neighbor); node; node = route_next (node))
if (node->info)
- vty_out (vty, "%s%s%s",
+ vty_outln (vty, "%s%s",
config_mode ? " neighbor " : " ",
- inet_ntoa (node->p.u.prefix4),
- VTY_NEWLINE);
+ inet_ntoa(node->p.u.prefix4));
/* RIP passive interface listing. */
if (config_mode) {
if (passive_default)
- vty_out (vty, " passive-interface default%s", VTY_NEWLINE);
+ vty_outln (vty, " passive-interface default");
for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
if ((ifname = vector_slot (Vrip_passive_nondefault, i)) != NULL)
- vty_out (vty, " %spassive-interface %s%s",
- (passive_default ? "no " : ""), ifname, VTY_NEWLINE);
+ vty_outln (vty, " %spassive-interface %s",
+ (passive_default ? "no " : ""), ifname);
}
return 0;
if (! retain_mode)
rip_clean ();
+ rip_zclient_stop ();
+
exit (0);
}
direct = RIP_OFFSET_LIST_OUT;
else
{
- vty_out (vty, "Invalid direction: %s%s", direct_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid direction: %s", direct_str);
return CMD_WARNING;
}
metric = atoi (metric_str);
if (metric < 0 || metric > 16)
{
- vty_out (vty, "Invalid metric: %s%s", metric_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid metric: %s", metric_str);
return CMD_WARNING;
}
direct = RIP_OFFSET_LIST_OUT;
else
{
- vty_out (vty, "Invalid direction: %s%s", direct_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid direction: %s", direct_str);
return CMD_WARNING;
}
metric = atoi (metric_str);
if (metric < 0 || metric > 16)
{
- vty_out (vty, "Invalid metric: %s%s", metric_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid metric: %s", metric_str);
return CMD_WARNING;
}
}
else
{
- vty_out (vty, "Can't find offset-list%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find offset-list");
return CMD_WARNING;
}
return CMD_SUCCESS;
if (! offset->ifname)
{
if (offset->direct[RIP_OFFSET_LIST_IN].alist_name)
- vty_out (vty, " offset-list %s in %d%s",
+ vty_outln (vty, " offset-list %s in %d",
offset->direct[RIP_OFFSET_LIST_IN].alist_name,
- offset->direct[RIP_OFFSET_LIST_IN].metric,
- VTY_NEWLINE);
+ offset->direct[RIP_OFFSET_LIST_IN].metric);
if (offset->direct[RIP_OFFSET_LIST_OUT].alist_name)
- vty_out (vty, " offset-list %s out %d%s",
+ vty_outln (vty, " offset-list %s out %d",
offset->direct[RIP_OFFSET_LIST_OUT].alist_name,
- offset->direct[RIP_OFFSET_LIST_OUT].metric,
- VTY_NEWLINE);
+ offset->direct[RIP_OFFSET_LIST_OUT].metric);
}
else
{
if (offset->direct[RIP_OFFSET_LIST_IN].alist_name)
- vty_out (vty, " offset-list %s in %d %s%s",
+ vty_outln (vty, " offset-list %s in %d %s",
offset->direct[RIP_OFFSET_LIST_IN].alist_name,
offset->direct[RIP_OFFSET_LIST_IN].metric,
- offset->ifname, VTY_NEWLINE);
+ offset->ifname);
if (offset->direct[RIP_OFFSET_LIST_OUT].alist_name)
- vty_out (vty, " offset-list %s out %d %s%s",
+ vty_outln (vty, " offset-list %s out %d %s",
offset->direct[RIP_OFFSET_LIST_OUT].alist_name,
offset->direct[RIP_OFFSET_LIST_OUT].metric,
- offset->ifname, VTY_NEWLINE);
+ offset->ifname);
}
}
for (ALL_LIST_ELEMENTS (peer_list, node, nnode, peer))
{
- vty_out (vty, " %-16s %9d %9d %9d %s%s", inet_ntoa (peer->addr),
+ vty_outln (vty, " %-16s %9d %9d %9d %s", inet_ntoa (peer->addr),
peer->recv_badpackets, peer->recv_badroutes,
ZEBRA_RIP_DISTANCE_DEFAULT,
- rip_peer_uptime (peer, timebuf, RIP_UPTIME_LEN),
- VTY_NEWLINE);
+ rip_peer_uptime(peer, timebuf, RIP_UPTIME_LEN));
}
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[1]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s",argv[1]->arg);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[2]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s",argv[2]->arg);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
}
}
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
{
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_RIP], VRF_DEFAULT))
{
- vty_out (vty, "router zebra%s", VTY_NEWLINE);
- vty_out (vty, " no redistribute rip%s", VTY_NEWLINE);
+ vty_outln (vty, "router zebra");
+ vty_outln (vty, " no redistribute rip");
return 1;
}
return 0;
if (rip->route_map[i].metric_config)
{
if (rip->route_map[i].name)
- vty_out (vty, " redistribute %s metric %d route-map %s%s",
+ vty_outln (vty, " redistribute %s metric %d route-map %s",
zebra_route_string(i), rip->route_map[i].metric,
- rip->route_map[i].name,
- VTY_NEWLINE);
+ rip->route_map[i].name);
else
- vty_out (vty, " redistribute %s metric %d%s",
- zebra_route_string(i), rip->route_map[i].metric,
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute %s metric %d",
+ zebra_route_string(i),rip->route_map[i].metric);
}
else
{
if (rip->route_map[i].name)
- vty_out (vty, " redistribute %s route-map %s%s",
- zebra_route_string(i), rip->route_map[i].name,
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute %s route-map %s",
+ zebra_route_string(i),rip->route_map[i].name);
else
- vty_out (vty, " redistribute %s%s", zebra_route_string(i),
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute %s",zebra_route_string(i));
}
}
else
install_element (RIP_NODE, &rip_default_information_originate_cmd);
install_element (RIP_NODE, &no_rip_default_information_originate_cmd);
}
+
+void
+rip_zclient_stop (void)
+{
+ zclient_stop (zclient);
+ zclient_free (zclient);
+}
version = atoi (argv[idx_number]->arg);
if (version != RIPv1 && version != RIPv2)
{
- vty_out (vty, "invalid rip version %d%s", version,
- VTY_NEWLINE);
+ vty_outln (vty, "invalid rip version %d",version);
return CMD_WARNING;
}
rip->version_send = version;
ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p);
if (ret < 0)
{
- vty_out (vty, "Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed address");
return CMD_WARNING;
}
apply_mask_ipv4 (&p);
if (node->info)
{
- vty_out (vty, "There is already same static route.%s", VTY_NEWLINE);
+ vty_outln (vty, "There is already same static route.");
route_unlock_node (node);
return CMD_WARNING;
}
ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p);
if (ret < 0)
{
- vty_out (vty, "Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed address");
return CMD_WARNING;
}
apply_mask_ipv4 (&p);
node = route_node_lookup (rip->route, (struct prefix *) &p);
if (! node)
{
- vty_out (vty, "Can't find route %s.%s", argv[idx_ipv4_prefixlen]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "Can't find route %s.",argv[idx_ipv4_prefixlen]->arg);
return CMD_WARNING;
}
update = strtoul (argv[idx_number]->arg, &endptr, 10);
if (update > RIP_TIMER_MAX || update < RIP_TIMER_MIN || *endptr != '\0')
{
- vty_out (vty, "update timer value error%s", VTY_NEWLINE);
+ vty_outln (vty, "update timer value error");
return CMD_WARNING;
}
timeout = strtoul (argv[idx_number_2]->arg, &endptr, 10);
if (timeout > RIP_TIMER_MAX || timeout < RIP_TIMER_MIN || *endptr != '\0')
{
- vty_out (vty, "timeout timer value error%s", VTY_NEWLINE);
+ vty_outln (vty, "timeout timer value error");
return CMD_WARNING;
}
garbage = strtoul (argv[idx_number_3]->arg, &endptr, 10);
if (garbage > RIP_TIMER_MAX || garbage < RIP_TIMER_MIN || *endptr != '\0')
{
- vty_out (vty, "garbage timer value error%s", VTY_NEWLINE);
+ vty_outln (vty, "garbage timer value error");
return CMD_WARNING;
}
ret = str2prefix_ipv4 (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
ret = str2prefix_ipv4 (ip_str, &p);
if (ret == 0)
{
- vty_out (vty, "Malformed prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed prefix");
return CMD_WARNING;
}
rn = route_node_lookup (rip_distance_table, (struct prefix *)&p);
if (! rn)
{
- vty_out (vty, "Can't find specified prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find specified prefix");
return CMD_WARNING;
}
int header = 1;
char buf[BUFSIZ];
- vty_out (vty, " Distance: (default is %d)%s",
- rip->distance ? rip->distance :ZEBRA_RIP_DISTANCE_DEFAULT,
- VTY_NEWLINE);
+ vty_outln (vty, " Distance: (default is %d)",
+ rip->distance ? rip->distance : ZEBRA_RIP_DISTANCE_DEFAULT);
for (rn = route_top (rip_distance_table); rn; rn = route_next (rn))
if ((rdistance = rn->info) != NULL)
{
if (header)
{
- vty_out (vty, " Address Distance List%s",
- VTY_NEWLINE);
+ vty_outln (vty," Address Distance List");
header = 0;
}
sprintf (buf, "%s/%d", inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
- vty_out (vty, " %-20s %4d %s%s",
+ vty_outln (vty, " %-20s %4d %s",
buf, rdistance->distance,
- rdistance->access_list ? rdistance->access_list : "",
- VTY_NEWLINE);
+ rdistance->access_list ? rdistance->access_list : "");
}
}
{
if (rip->ecmp)
{
- vty_out (vty, "ECMP is already enabled.%s", VTY_NEWLINE);
+ vty_outln (vty, "ECMP is already enabled.");
return CMD_WARNING;
}
{
if (!rip->ecmp)
{
- vty_out (vty, "ECMP is already disabled.%s", VTY_NEWLINE);
+ vty_outln (vty, "ECMP is already disabled.");
return CMD_WARNING;
}
if (! rip)
return CMD_SUCCESS;
- vty_out (vty, "Codes: R - RIP, C - connected, S - Static, O - OSPF, B - BGP%s"
+ vty_outln (vty, "Codes: R - RIP, C - connected, S - Static, O - OSPF, B - BGP%s"
"Sub-codes:%s"
" (n) - normal, (s) - static, (d) - default, (r) - redistribute,%s"
" (i) - interface%s%s"
- " Network Next Hop Metric From Tag Time%s",
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ " Network Next Hop Metric From Tag Time",
+ VTYNL, VTYNL, VTYNL, VTYNL, VTYNL);
for (np = route_top (rip->table); np; np = route_next (np))
if ((list = np->info) != NULL)
vty_out (vty, "%3"ROUTE_TAG_PRI, (route_tag_t)rinfo->tag);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
return CMD_SUCCESS;
}
if (! rip)
return CMD_SUCCESS;
- vty_out (vty, "Routing Protocol is \"rip\"%s", VTY_NEWLINE);
+ vty_outln (vty, "Routing Protocol is \"rip\"");
vty_out (vty, " Sending updates every %ld seconds with +/-50%%,",
rip->update_time);
- vty_out (vty, " next due in %lu seconds%s",
- thread_timer_remain_second(rip->t_update),
- VTY_NEWLINE);
+ vty_outln (vty, " next due in %lu seconds",
+ thread_timer_remain_second(rip->t_update));
vty_out (vty, " Timeout after %ld seconds,", rip->timeout_time);
- vty_out (vty, " garbage collect after %ld seconds%s", rip->garbage_time,
- VTY_NEWLINE);
+ vty_outln (vty, " garbage collect after %ld seconds",rip->garbage_time);
/* Filtering status show. */
config_show_distribute (vty);
/* Default metric information. */
- vty_out (vty, " Default redistribution metric is %d%s",
- rip->default_metric, VTY_NEWLINE);
+ vty_outln (vty, " Default redistribution metric is %d",
+ rip->default_metric);
/* Redistribute information. */
vty_out (vty, " Redistributing:");
config_write_rip_redistribute (vty, 0);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, " Default version control: send version %s,",
lookup_msg(ri_version_msg,rip->version_send, NULL));
if (rip->version_recv == RI_RIP_VERSION_1_AND_2)
- vty_out (vty, " receive any version %s", VTY_NEWLINE);
+ vty_outln (vty, " receive any version ");
else
- vty_out (vty, " receive version %s %s",
- lookup_msg(ri_version_msg,rip->version_recv, NULL), VTY_NEWLINE);
+ vty_outln (vty, " receive version %s ",
+ lookup_msg(ri_version_msg,rip->version_recv, NULL));
- vty_out (vty, " Interface Send Recv Key-chain%s", VTY_NEWLINE);
+ vty_outln (vty, " Interface Send Recv Key-chain");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
{
else
receive_version = lookup_msg(ri_version_msg, ri->ri_receive, NULL);
- vty_out (vty, " %-17s%-3s %-3s %s%s", ifp->name,
+ vty_outln (vty, " %-17s%-3s %-3s %s", ifp->name,
send_version,
receive_version,
- ri->key_chain ? ri->key_chain : "",
- VTY_NEWLINE);
+ ri->key_chain ? ri->key_chain : "");
}
}
- vty_out (vty, " Routing for Networks:%s", VTY_NEWLINE);
+ vty_outln (vty, " Routing for Networks:");
config_write_rip_network (vty, 0);
{
{
if (!found_passive)
{
- vty_out (vty, " Passive Interface(s):%s", VTY_NEWLINE);
+ vty_outln (vty, " Passive Interface(s):");
found_passive = 1;
}
- vty_out (vty, " %s%s", ifp->name, VTY_NEWLINE);
+ vty_outln (vty, " %s", ifp->name);
}
}
}
- vty_out (vty, " Routing Information Sources:%s", VTY_NEWLINE);
- vty_out (vty, " Gateway BadPackets BadRoutes Distance Last Update%s", VTY_NEWLINE);
+ vty_outln (vty, " Routing Information Sources:");
+ vty_outln (vty,
+ " Gateway BadPackets BadRoutes Distance Last Update");
rip_peer_display (vty);
rip_distance_show (vty);
if (rip)
{
/* Router RIP statement. */
- vty_out (vty, "router rip%s", VTY_NEWLINE);
+ vty_outln (vty, "router rip");
write++;
/* RIP version statement. Default is RIP version 2. */
if (rip->version_send != RI_RIP_VERSION_2
|| rip->version_recv != RI_RIP_VERSION_1_AND_2)
- vty_out (vty, " version %d%s", rip->version_send,
- VTY_NEWLINE);
+ vty_outln (vty, " version %d",rip->version_send);
/* RIP timer configuration. */
if (rip->update_time != RIP_UPDATE_TIMER_DEFAULT
|| rip->timeout_time != RIP_TIMEOUT_TIMER_DEFAULT
|| rip->garbage_time != RIP_GARBAGE_TIMER_DEFAULT)
- vty_out (vty, " timers basic %lu %lu %lu%s",
+ vty_outln (vty, " timers basic %lu %lu %lu",
rip->update_time,
rip->timeout_time,
- rip->garbage_time,
- VTY_NEWLINE);
+ rip->garbage_time);
/* Default information configuration. */
if (rip->default_information)
{
if (rip->default_information_route_map)
- vty_out (vty, " default-information originate route-map %s%s",
- rip->default_information_route_map, VTY_NEWLINE);
+ vty_outln (vty, " default-information originate route-map %s",
+ rip->default_information_route_map);
else
- vty_out (vty, " default-information originate%s",
- VTY_NEWLINE);
+ vty_outln (vty," default-information originate");
}
/* Redistribute configuration. */
/* RIP default metric configuration */
if (rip->default_metric != RIP_DEFAULT_METRIC_DEFAULT)
- vty_out (vty, " default-metric %d%s",
- rip->default_metric, VTY_NEWLINE);
+ vty_outln (vty, " default-metric %d",
+ rip->default_metric);
/* Distribute configuration. */
write += config_write_distribute (vty);
/* Distance configuration. */
if (rip->distance)
- vty_out (vty, " distance %d%s", rip->distance, VTY_NEWLINE);
+ vty_outln (vty, " distance %d", rip->distance);
/* RIP source IP prefix distance configuration. */
for (rn = route_top (rip_distance_table); rn; rn = route_next (rn))
if ((rdistance = rn->info) != NULL)
- vty_out (vty, " distance %d %s/%d %s%s", rdistance->distance,
+ vty_outln (vty, " distance %d %s/%d %s", rdistance->distance,
inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
- rdistance->access_list ? rdistance->access_list : "",
- VTY_NEWLINE);
+ rdistance->access_list ? rdistance->access_list : "");
/* ECMP configuration. */
if (rip->ecmp)
- vty_out (vty, " allow-ecmp%s", VTY_NEWLINE);
+ vty_outln (vty, " allow-ecmp");
/* RIP static route configuration. */
for (rn = route_top (rip->route); rn; rn = route_next (rn))
if (rn->info)
- vty_out (vty, " route %s/%d%s",
+ vty_outln (vty, " route %s/%d",
inet_ntoa (rn->p.u.prefix4),
- rn->p.prefixlen,
- VTY_NEWLINE);
+ rn->p.prefixlen);
}
return write;
extern void rip_route_map_init (void);
extern void rip_route_map_reset (void);
extern void rip_zclient_init(struct thread_master *);
+extern void rip_zclient_stop(void);
extern void rip_zclient_reset (void);
extern void rip_offset_init (void);
extern int if_check_address (struct in_addr addr);
DEBUG_STR
"RIPng configuration\n")
{
- vty_out (vty, "RIPng debugging status:%s", VTY_NEWLINE);
+ vty_outln (vty, "RIPng debugging status:");
if (IS_RIPNG_DEBUG_EVENT)
- vty_out (vty, " RIPng event debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " RIPng event debugging is on");
if (IS_RIPNG_DEBUG_PACKET)
{
if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV)
{
- vty_out (vty, " RIPng packet debugging is on%s",
- VTY_NEWLINE);
+ vty_outln (vty," RIPng packet debugging is on");
}
else
{
if (IS_RIPNG_DEBUG_SEND)
- vty_out (vty, " RIPng packet send debugging is on%s",
- VTY_NEWLINE);
+ vty_outln (vty," RIPng packet send debugging is on");
else
- vty_out (vty, " RIPng packet receive debugging is on%s",
- VTY_NEWLINE);
+ vty_outln (vty," RIPng packet receive debugging is on");
}
}
if (IS_RIPNG_DEBUG_ZEBRA)
- vty_out (vty, " RIPng zebra debugging is on%s", VTY_NEWLINE);
+ vty_outln (vty, " RIPng zebra debugging is on");
return CMD_SUCCESS;
}
if (IS_RIPNG_DEBUG_EVENT)
{
- vty_out (vty, "debug ripng events%s", VTY_NEWLINE);
+ vty_outln (vty, "debug ripng events");
write++;
}
if (IS_RIPNG_DEBUG_PACKET)
{
if (IS_RIPNG_DEBUG_SEND && IS_RIPNG_DEBUG_RECV)
{
- vty_out (vty, "debug ripng packet%s",
- VTY_NEWLINE);
+ vty_outln (vty,"debug ripng packet");
write++;
}
else
{
if (IS_RIPNG_DEBUG_SEND)
- vty_out (vty, "debug ripng packet send%s",
- VTY_NEWLINE);
+ vty_outln (vty,"debug ripng packet send");
else
- vty_out (vty, "debug ripng packet recv%s",
- VTY_NEWLINE);
+ vty_outln (vty,"debug ripng packet recv");
write++;
}
}
if (IS_RIPNG_DEBUG_ZEBRA)
{
- vty_out (vty, "debug ripng zebra%s", VTY_NEWLINE);
+ vty_outln (vty, "debug ripng zebra");
write++;
}
return write;
if (node->info)
{
struct prefix *p = &node->p;
- vty_out (vty, "%s%s/%d%s",
+ vty_outln (vty, "%s%s/%d",
config_mode ? " network " : " ",
inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
- p->prefixlen,
- VTY_NEWLINE);
+ p->prefixlen);
}
/* Write enable interface. */
for (i = 0; i < vector_active (ripng_enable_if); i++)
if ((ifname = vector_slot (ripng_enable_if, i)) != NULL)
- vty_out (vty, "%s%s%s",
+ vty_outln (vty, "%s%s",
config_mode ? " network " : " ",
- ifname,
- VTY_NEWLINE);
+ ifname);
/* Write passive interface. */
if (config_mode)
for (i = 0; i < vector_active (Vripng_passive_interface); i++)
if ((ifname = vector_slot (Vripng_passive_interface, i)) != NULL)
- vty_out (vty, " passive-interface %s%s", ifname, VTY_NEWLINE);
+ vty_outln (vty, " passive-interface %s", ifname);
return 0;
}
if (ret < 0)
{
- vty_out (vty, "There is same network configuration %s%s", argv[idx_if_or_addr]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "There is same network configuration %s",
+ argv[idx_if_or_addr]->arg);
return CMD_WARNING;
}
if (ret < 0)
{
- vty_out (vty, "can't find network %s%s", argv[idx_if_or_addr]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "can't find network %s",argv[idx_if_or_addr]->arg);
return CMD_WARNING;
}
(ri->split_horizon == ri->split_horizon_default))
continue;
- 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);
/* Split horizon. */
if (ri->split_horizon != ri->split_horizon_default)
{
switch (ri->split_horizon) {
case RIPNG_SPLIT_HORIZON:
- vty_out (vty, " ipv6 ripng split-horizon%s", VTY_NEWLINE);
+ vty_outln (vty, " ipv6 ripng split-horizon");
break;
case RIPNG_SPLIT_HORIZON_POISONED_REVERSE:
- vty_out (vty, " ipv6 ripng split-horizon poisoned-reverse%s",
- VTY_NEWLINE);
+ vty_outln (vty," ipv6 ripng split-horizon poisoned-reverse");
break;
case RIPNG_NO_SPLIT_HORIZON:
default:
- vty_out (vty, " no ipv6 ripng split-horizon%s", VTY_NEWLINE);
+ vty_outln (vty, " no ipv6 ripng split-horizon");
break;
}
}
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
write++;
}
if (! retain_mode)
ripng_clean ();
+ ripng_zebra_stop ();
exit (0);
}
direct = RIPNG_OFFSET_LIST_OUT;
else
{
- vty_out (vty, "Invalid direction: %s%s", direct_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid direction: %s", direct_str);
return CMD_WARNING;
}
metric = atoi (metric_str);
if (metric < 0 || metric > 16)
{
- vty_out (vty, "Invalid metric: %s%s", metric_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid metric: %s", metric_str);
return CMD_WARNING;
}
direct = RIPNG_OFFSET_LIST_OUT;
else
{
- vty_out (vty, "Invalid direction: %s%s", direct_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid direction: %s", direct_str);
return CMD_WARNING;
}
metric = atoi (metric_str);
if (metric < 0 || metric > 16)
{
- vty_out (vty, "Invalid metric: %s%s", metric_str, VTY_NEWLINE);
+ vty_outln (vty, "Invalid metric: %s", metric_str);
return CMD_WARNING;
}
}
else
{
- vty_out (vty, "Can't find offset-list%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find offset-list");
return CMD_WARNING;
}
return CMD_SUCCESS;
if (! offset->ifname)
{
if (offset->direct[RIPNG_OFFSET_LIST_IN].alist_name)
- vty_out (vty, " offset-list %s in %d%s",
+ vty_outln (vty, " offset-list %s in %d",
offset->direct[RIPNG_OFFSET_LIST_IN].alist_name,
- offset->direct[RIPNG_OFFSET_LIST_IN].metric,
- VTY_NEWLINE);
+ offset->direct[RIPNG_OFFSET_LIST_IN].metric);
if (offset->direct[RIPNG_OFFSET_LIST_OUT].alist_name)
- vty_out (vty, " offset-list %s out %d%s",
+ vty_outln (vty, " offset-list %s out %d",
offset->direct[RIPNG_OFFSET_LIST_OUT].alist_name,
- offset->direct[RIPNG_OFFSET_LIST_OUT].metric,
- VTY_NEWLINE);
+ offset->direct[RIPNG_OFFSET_LIST_OUT].metric);
}
else
{
if (offset->direct[RIPNG_OFFSET_LIST_IN].alist_name)
- vty_out (vty, " offset-list %s in %d %s%s",
+ vty_outln (vty, " offset-list %s in %d %s",
offset->direct[RIPNG_OFFSET_LIST_IN].alist_name,
offset->direct[RIPNG_OFFSET_LIST_IN].metric,
- offset->ifname, VTY_NEWLINE);
+ offset->ifname);
if (offset->direct[RIPNG_OFFSET_LIST_OUT].alist_name)
- vty_out (vty, " offset-list %s out %d %s%s",
+ vty_outln (vty, " offset-list %s out %d %s",
offset->direct[RIPNG_OFFSET_LIST_OUT].alist_name,
offset->direct[RIPNG_OFFSET_LIST_OUT].metric,
- offset->ifname, VTY_NEWLINE);
+ offset->ifname);
}
}
for (ALL_LIST_ELEMENTS (peer_list, node, nnode, peer))
{
- vty_out (vty, " %s %s%14s %10d %10d %10d %s%s", inet6_ntoa (peer->addr),
- VTY_NEWLINE, " ",
+ vty_outln (vty, " %s %s%14s %10d %10d %10d %s", inet6_ntoa (peer->addr),
+ VTYNL, " ",
peer->recv_badpackets, peer->recv_badroutes,
ZEBRA_RIPNG_DISTANCE_DEFAULT,
- ripng_peer_uptime (peer, timebuf, RIPNG_UPTIME_LEN),
- VTY_NEWLINE);
+ ripng_peer_uptime(peer, timebuf, RIPNG_UPTIME_LEN));
}
}
if (type < 0)
{
- vty_out(vty, "Invalid type %s%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", proto);
return CMD_WARNING;
}
if (type < 0)
{
- vty_out(vty, "Invalid type %s%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", proto);
return CMD_WARNING;
}
if (type < 0)
{
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
if (type < 0)
{
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
if (type < 0)
{
- vty_out(vty, "Invalid type %s%s", argv[idx_protocol]->text, VTY_NEWLINE);
+ vty_outln (vty, "Invalid type %s", argv[idx_protocol]->text);
return CMD_WARNING;
}
if (ripng->route_map[i].metric_config)
{
if (ripng->route_map[i].name)
- vty_out (vty, " redistribute %s metric %d route-map %s%s",
+ vty_outln (vty, " redistribute %s metric %d route-map %s",
zebra_route_string(i), ripng->route_map[i].metric,
- ripng->route_map[i].name, VTY_NEWLINE);
+ ripng->route_map[i].name);
else
- vty_out (vty, " redistribute %s metric %d%s",
- zebra_route_string(i), ripng->route_map[i].metric,
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute %s metric %d",
+ zebra_route_string(i),ripng->route_map[i].metric);
}
else
{
if (ripng->route_map[i].name)
- vty_out (vty, " redistribute %s route-map %s%s",
- zebra_route_string(i), ripng->route_map[i].name,
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute %s route-map %s",
+ zebra_route_string(i),ripng->route_map[i].name);
else
- vty_out (vty, " redistribute %s%s", zebra_route_string(i),
- VTY_NEWLINE);
+ vty_outln (vty, " redistribute %s",zebra_route_string(i));
}
}
else
{
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_IP6][ZEBRA_ROUTE_RIPNG], VRF_DEFAULT))
{
- vty_out (vty, "router zebra%s", VTY_NEWLINE);
- vty_out (vty, " no redistribute ripng%s", VTY_NEWLINE);
+ vty_outln (vty, "router zebra");
+ vty_outln (vty, " no redistribute ripng");
return 1;
}
return 0;
install_element (RIPNG_NODE, &ripng_redistribute_type_metric_routemap_cmd);
install_element (RIPNG_NODE, &no_ripng_redistribute_type_cmd);
}
+
+void
+ripng_zebra_stop (void)
+{
+ zclient_stop (zclient);
+ zclient_free (zclient);
+}
return CMD_SUCCESS;
/* Header of display. */
- vty_out (vty, "Codes: R - RIPng, C - connected, S - Static, O - OSPF, B - BGP%s"
+ vty_outln (vty, "Codes: R - RIPng, C - connected, S - Static, O - OSPF, B - BGP%s"
"Sub-codes:%s"
" (n) - normal, (s) - static, (d) - default, (r) - redistribute,%s"
" (i) - interface, (a/S) - aggregated/Suppressed%s%s"
- " Network Next Hop Via Metric Tag Time%s",
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE,
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ " Network Next Hop Via Metric Tag Time",
+ VTYNL, VTYNL, VTYNL,
+ VTYNL, VTYNL);
for (rp = route_top (ripng->table); rp; rp = route_next (rp))
{
vty_out (vty, "R(a) %s/%d ",
inet6_ntoa (p->prefix), p->prefixlen);
#endif /* DEBUG */
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, "%*s", 18, " ");
vty_out (vty, "%*s", 28, " ");
- vty_out (vty, "self %2d %3"ROUTE_TAG_PRI"%s", aggregate->metric,
- (route_tag_t)aggregate->tag,
- VTY_NEWLINE);
+ vty_outln (vty, "self %2d %3"ROUTE_TAG_PRI"", aggregate->metric,
+ (route_tag_t)aggregate->tag);
}
if ((list = rp->info) != NULL)
ripng_route_subtype_print(rinfo),
inet6_ntoa (p->prefix), p->prefixlen);
#endif /* DEBUG */
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, "%*s", 18, " ");
len = vty_out (vty, "%s", inet6_ntoa (rinfo->nexthop));
ripng_vty_out_uptime (vty, rinfo);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
if (! ripng)
return CMD_SUCCESS;
- vty_out (vty, "Routing Protocol is \"RIPng\"%s", VTY_NEWLINE);
+ vty_outln (vty, "Routing Protocol is \"RIPng\"");
vty_out (vty, " Sending updates every %ld seconds with +/-50%%,",
ripng->update_time);
- vty_out (vty, " next due in %lu seconds%s",
- thread_timer_remain_second (ripng->t_update),
- VTY_NEWLINE);
+ vty_outln (vty, " next due in %lu seconds",
+ thread_timer_remain_second(ripng->t_update));
vty_out (vty, " Timeout after %ld seconds,", ripng->timeout_time);
- vty_out (vty, " garbage collect after %ld seconds%s", ripng->garbage_time,
- VTY_NEWLINE);
+ vty_outln (vty, " garbage collect after %ld seconds",ripng->garbage_time);
/* Filtering status show. */
config_show_distribute (vty);
/* Default metric information. */
- vty_out (vty, " Default redistribution metric is %d%s",
- ripng->default_metric, VTY_NEWLINE);
+ vty_outln (vty, " Default redistribution metric is %d",
+ ripng->default_metric);
/* Redistribute information. */
vty_out (vty, " Redistributing:");
ripng_redistribute_write (vty, 0);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
vty_out (vty, " Default version control: send version %d,", ripng->version);
- vty_out (vty, " receive version %d %s", ripng->version,
- VTY_NEWLINE);
+ vty_outln (vty, " receive version %d ",ripng->version);
- vty_out (vty, " Interface Send Recv%s", VTY_NEWLINE);
+ vty_outln (vty, " Interface Send Recv");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
{
if (ri->enable_network || ri->enable_interface)
{
- vty_out (vty, " %-17s%-3d %-3d%s", ifp->name,
+ vty_outln (vty, " %-17s%-3d %-3d", ifp->name,
ripng->version,
- ripng->version,
- VTY_NEWLINE);
+ ripng->version);
}
}
- vty_out (vty, " Routing for Networks:%s", VTY_NEWLINE);
+ vty_outln (vty, " Routing for Networks:");
ripng_network_write (vty, 0);
- vty_out (vty, " Routing Information Sources:%s", VTY_NEWLINE);
- vty_out (vty, " Gateway BadPackets BadRoutes Distance Last Update%s", VTY_NEWLINE);
+ vty_outln (vty, " Routing Information Sources:");
+ vty_outln (vty,
+ " Gateway BadPackets BadRoutes Distance Last Update");
ripng_peer_display (vty);
return CMD_SUCCESS;
ret = str2prefix_ipv6 (argv[idx_ipv6addr]->arg, (struct prefix_ipv6 *)&p);
if (ret <= 0)
{
- vty_out (vty, "Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed address");
return CMD_WARNING;
}
apply_mask_ipv6 (&p);
rp = route_node_get (ripng->route, (struct prefix *) &p);
if (rp->info)
{
- vty_out (vty, "There is already same static route.%s", VTY_NEWLINE);
+ vty_outln (vty, "There is already same static route.");
route_unlock_node (rp);
return CMD_WARNING;
}
ret = str2prefix_ipv6 (argv[idx_ipv6addr]->arg, (struct prefix_ipv6 *)&p);
if (ret <= 0)
{
- vty_out (vty, "Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed address");
return CMD_WARNING;
}
apply_mask_ipv6 (&p);
rp = route_node_lookup (ripng->route, (struct prefix *) &p);
if (! rp)
{
- vty_out (vty, "Can't find static route.%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find static route.");
return CMD_WARNING;
}
ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, (struct prefix_ipv6 *)&p);
if (ret <= 0)
{
- vty_out (vty, "Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed address");
return CMD_WARNING;
}
node = route_node_get (ripng->aggregate, &p);
if (node->info)
{
- vty_out (vty, "There is already same aggregate route.%s", VTY_NEWLINE);
+ vty_outln (vty, "There is already same aggregate route.");
route_unlock_node (node);
return CMD_WARNING;
}
ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, (struct prefix_ipv6 *) &p);
if (ret <= 0)
{
- vty_out (vty, "Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed address");
return CMD_WARNING;
}
rn = route_node_lookup (ripng->aggregate, &p);
if (! rn)
{
- vty_out (vty, "Can't find aggregate route.%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't find aggregate route.");
return CMD_WARNING;
}
route_unlock_node (rn);
update = strtoul (argv[0], &endptr, 10);
if (update == ULONG_MAX || *endptr != '\0')
{
- vty_out (vty, "update timer value error%s", VTY_NEWLINE);
+ vty_out (vty, "update timer value error%s", VTYNL);
return CMD_WARNING;
}
timeout = strtoul (argv[0], &endptr, 10);
if (timeout == ULONG_MAX || *endptr != '\0')
{
- vty_out (vty, "timeout timer value error%s", VTY_NEWLINE);
+ vty_out (vty, "timeout timer value error%s", VTYNL);
return CMD_WARNING;
}
garbage = strtoul (argv[0], &endptr, 10);
if (garbage == ULONG_MAX || *endptr != '\0')
{
- vty_out (vty, "garbage timer value error%s", VTY_NEWLINE);
+ vty_out (vty, "garbage timer value error%s", VTYNL);
return CMD_WARNING;
}
unsigned long timeout;
unsigned long garbage;
- VTY_GET_INTEGER_RANGE("update timer", update, argv[idx_number]->arg, 0, 65535);
- VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[idx_number_2]->arg, 0, 65535);
- VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[idx_number_3]->arg, 0, 65535);
+ update = strtoul(argv[idx_number]->arg, NULL, 10);
+ timeout = strtoul(argv[idx_number_2]->arg, NULL, 10);
+ garbage = strtoul(argv[idx_number_3]->arg, NULL, 10);
/* Set each timer value. */
ripng->update_time = update;
if (! ripng)
return CMD_SUCCESS;
- vty_out (vty, "Routing Protocol is \"ripng\"%s", VTY_NEWLINE);
+ vty_out (vty, "Routing Protocol is \"ripng\"%s", VTYNL);
vty_out (vty, "Sending updates every %ld seconds, next due in %d seconds%s",
ripng->update_time, 0,
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, "Timerout after %ld seconds, garbage correct %ld%s",
ripng->timeout_time,
ripng->garbage_time,
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, "Outgoing update filter list for all interfaces is not set");
vty_out (vty, "Incoming update filter list for all interfaces is not set");
{
if (ripng->ecmp)
{
- vty_out (vty, "ECMP is already enabled.%s", VTY_NEWLINE);
+ vty_outln (vty, "ECMP is already enabled.");
return CMD_WARNING;
}
{
if (!ripng->ecmp)
{
- vty_out (vty, "ECMP is already disabled.%s", VTY_NEWLINE);
+ vty_outln (vty, "ECMP is already disabled.");
return CMD_WARNING;
}
{
/* RIPng router. */
- vty_out (vty, "router ripng%s", VTY_NEWLINE);
+ vty_outln (vty, "router ripng");
if (ripng->default_information)
- vty_out (vty, " default-information originate%s", VTY_NEWLINE);
+ vty_outln (vty, " default-information originate");
ripng_network_write (vty, 1);
/* RIPng default metric configuration */
if (ripng->default_metric != RIPNG_DEFAULT_METRIC_DEFAULT)
- vty_out (vty, " default-metric %d%s",
- ripng->default_metric, VTY_NEWLINE);
+ vty_outln (vty, " default-metric %d",
+ ripng->default_metric);
ripng_redistribute_write (vty, 1);
/* RIPng aggregate routes. */
for (rp = route_top (ripng->aggregate); rp; rp = route_next (rp))
if (rp->info != NULL)
- vty_out (vty, " aggregate-address %s/%d%s",
+ vty_outln (vty, " aggregate-address %s/%d",
inet6_ntoa (rp->p.u.prefix6),
- rp->p.prefixlen,
-
- VTY_NEWLINE);
+ rp->p.prefixlen);
/* ECMP configuration. */
if (ripng->ecmp)
- vty_out (vty, " allow-ecmp%s", VTY_NEWLINE);
+ vty_outln (vty, " allow-ecmp");
/* RIPng static routes. */
for (rp = route_top (ripng->route); rp; rp = route_next (rp))
if (rp->info != NULL)
- vty_out (vty, " route %s/%d%s", inet6_ntoa (rp->p.u.prefix6),
- rp->p.prefixlen,
- VTY_NEWLINE);
+ vty_outln (vty, " route %s/%d", inet6_ntoa (rp->p.u.prefix6),
+ rp->p.prefixlen);
/* RIPng timers configuration. */
if (ripng->update_time != RIPNG_UPDATE_TIMER_DEFAULT ||
ripng->timeout_time != RIPNG_TIMEOUT_TIMER_DEFAULT ||
ripng->garbage_time != RIPNG_GARBAGE_TIMER_DEFAULT)
{
- vty_out (vty, " timers basic %ld %ld %ld%s",
+ vty_outln (vty, " timers basic %ld %ld %ld",
ripng->update_time,
ripng->timeout_time,
- ripng->garbage_time,
- VTY_NEWLINE);
+ ripng->garbage_time);
}
#if 0
if (ripng->update_time != RIPNG_UPDATE_TIMER_DEFAULT)
vty_out (vty, " update-timer %d%s", ripng->update_time,
- VTY_NEWLINE);
+ VTYNL);
if (ripng->timeout_time != RIPNG_TIMEOUT_TIMER_DEFAULT)
vty_out (vty, " timeout-timer %d%s", ripng->timeout_time,
- VTY_NEWLINE);
+ VTYNL);
if (ripng->garbage_time != RIPNG_GARBAGE_TIMER_DEFAULT)
vty_out (vty, " garbage-timer %d%s", ripng->garbage_time,
- VTY_NEWLINE);
+ VTYNL);
#endif /* 0 */
write += config_write_distribute (vty);
extern void ripng_terminate (void);
/* zclient_init() is done by ripng_zebra.c:zebra_init() */
extern void zebra_init(struct thread_master *);
+extern void ripng_zebra_stop (void);
extern void ripng_zclient_reset (void);
extern void ripng_offset_init (void);
+include ../common.am
+
PYTHON ?= python
AUTOMAKE_OPTIONS = subdir-objects
BGP_VNC_RFP_LIB =
endif
+lib/cli/test_cli.o: lib/cli/test_cli_clippy.c
+
check_PROGRAMS = \
lib/test_buffer \
lib/test_checksum \
{
int i = 0;
qobj_init ();
- bgp_master_init (thread_master_create ());
+ bgp_master_init (thread_master_create(NULL));
master = bm->master;
bgp_option_set (BGP_OPT_NO_LISTEN);
bgp_attr_init ();
term_bgp_debug_as4 = -1UL;
qobj_init ();
- master = thread_master_create ();
+ master = thread_master_create(NULL);
bgp_master_init (master);
vrf_init (NULL, NULL, NULL, NULL);
bgp_option_set (BGP_OPT_NO_LISTEN);
term_bgp_debug_as4 = -1UL;
qobj_init ();
- master = thread_master_create ();
+ master = thread_master_create(NULL);
bgp_master_init (master);
vrf_init (NULL, NULL, NULL, NULL);
bgp_option_set (BGP_OPT_NO_LISTEN);
global_test_init (void)
{
qobj_init ();
- master = thread_master_create ();
+ master = thread_master_create(NULL);
zclient = zclient_new(master);
bgp_master_init (master);
vrf_init (NULL, NULL, NULL, NULL);
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
/* master init. */
- master = thread_master_create ();
+ master = thread_master_create(NULL);
while (1)
{
int argc, struct cmd_token *argv[])
{
int i;
- vty_out (vty, "%s with %d args.%s", descr, argc, VTY_NEWLINE);
+ vty_outln (vty, "%s with %d args.", descr, argc);
for (i = 0; i < argc; i++)
{
- vty_out (vty, "[%02d]: %s%s", i, argv[i]->arg, VTY_NEWLINE);
+ vty_outln (vty, "[%02d] %s@%s: %s", i, argv[i]->text, argv[i]->varname, argv[i]->arg);
}
return CMD_SUCCESS;
umask (0027);
/* master init. */
- master = thread_master_create ();
+ master = thread_master_create(NULL);
openzlog("common-cli", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
LOG_DAEMON);
#include <zebra.h>
+#include "prefix.h"
#include "common_cli.h"
DUMMY_DEFUN(cmd0, "arg ipv4 A.B.C.D");
DUMMY_DEFUN(cmd1, "arg ipv4m A.B.C.D/M");
-DUMMY_DEFUN(cmd2, "arg ipv6 X:X::X:X");
+DUMMY_DEFUN(cmd2, "arg ipv6 X:X::X:X$foo");
DUMMY_DEFUN(cmd3, "arg ipv6m X:X::X:X/M");
DUMMY_DEFUN(cmd4, "arg range (5-15)");
DUMMY_DEFUN(cmd5, "pat a < a|b>");
+DUMMY_DEFUN(cmd6, "pat b <a|b A.B.C.D$bar>");
DUMMY_DEFUN(cmd7, "pat c <a | b|c> A.B.C.D");
-DUMMY_DEFUN(cmd8, "pat d { foo A.B.C.D|bar X:X::X:X| baz }");
+DUMMY_DEFUN(cmd8, "pat d { foo A.B.C.D$foo|bar X:X::X:X$bar| baz } [final]");
DUMMY_DEFUN(cmd9, "pat e [ WORD ]");
DUMMY_DEFUN(cmd10, "pat f [key]");
DUMMY_DEFUN(cmd11, "alt a WORD");
DUMMY_DEFUN(cmd12, "alt a A.B.C.D");
DUMMY_DEFUN(cmd13, "alt a X:X::X:X");
+DUMMY_DEFUN(cmd14, "pat g { foo A.B.C.D$foo|foo|bar X:X::X:X$bar| baz } [final]");
+
+#include "tests/lib/cli/test_cli_clippy.c"
+
+DEFPY(magic_test, magic_test_cmd,
+ "magic (0-100) {ipv4net A.B.C.D/M|X:X::X:X$ipv6}",
+ "1\n2\n3\n4\n5\n")
+{
+ char buf[256];
+ vty_outln(vty, "def: %s", self->string);
+ vty_outln(vty, "num: %ld", magic);
+ vty_outln(vty, "ipv4: %s", prefix2str(ipv4net, buf, sizeof(buf)));
+ vty_outln(vty, "ipv6: %s", inet_ntop(AF_INET6, &ipv6, buf, sizeof(buf)));
+ return CMD_SUCCESS;
+}
void test_init(int argc, char **argv)
{
install_element (ENABLE_NODE, &cmd3_cmd);
install_element (ENABLE_NODE, &cmd4_cmd);
install_element (ENABLE_NODE, &cmd5_cmd);
+ install_element (ENABLE_NODE, &cmd6_cmd);
install_element (ENABLE_NODE, &cmd7_cmd);
install_element (ENABLE_NODE, &cmd8_cmd);
install_element (ENABLE_NODE, &cmd9_cmd);
uninstall_element (ENABLE_NODE, &cmd13_cmd);
install_element (ENABLE_NODE, &cmd13_cmd);
}
+ install_element (ENABLE_NODE, &cmd14_cmd);
+ install_element (ENABLE_NODE, &magic_test_cmd);
}
test# \r
test# arg ipv4 1.2.3.4\r
cmd0 with 3 args.\r
-[00]: arg\r
-[01]: ipv4\r
-[02]: 1.2.3.4\r
+[00] arg@(null): arg\r
+[01] ipv4@(null): ipv4\r
+[02] A.B.C.D@ipv4: 1.2.3.4\r
test# arg ipv4 1.2.\r
A.B.C.D 02\r
test# arg ipv4 1.2.3.4\r
cmd0 with 3 args.\r
-[00]: arg\r
-[01]: ipv4\r
-[02]: 1.2.3.4\r
+[00] arg@(null): arg\r
+[01] ipv4@(null): ipv4\r
+[02] A.B.C.D@ipv4: 1.2.3.4\r
test# arg ipv4 1.2.3\r
% [NONE] Unknown command: arg ipv4 1.2.3\r
test# arg ipv4 1.2.3.4.5\r
test# \r
test# arg ipv4m 1.2.3.0/24\r
cmd1 with 3 args.\r
-[00]: arg\r
-[01]: ipv4m\r
-[02]: 1.2.3.0/24\r
+[00] arg@(null): arg\r
+[01] ipv4m@(null): ipv4m\r
+[02] A.B.C.D/M@ipv4m: 1.2.3.0/24\r
test# arg ipv4m 1.2.\r
A.B.C.D/M 02\r
test# arg ipv4m 1.2.3.0/24\r
cmd1 with 3 args.\r
-[00]: arg\r
-[01]: ipv4m\r
-[02]: 1.2.3.0/24\r
+[00] arg@(null): arg\r
+[01] ipv4m@(null): ipv4m\r
+[02] A.B.C.D/M@ipv4m: 1.2.3.0/24\r
test# arg ipv4m 1.2.3/9\r
% [NONE] Unknown command: arg ipv4m 1.2.3/9\r
test# arg ipv4m 1.2.3.4.5/6\r
test# \r
test# arg ipv6 de4d:b33f::cafe\r
cmd2 with 3 args.\r
-[00]: arg\r
-[01]: ipv6\r
-[02]: de4d:b33f::cafe\r
+[00] arg@(null): arg\r
+[01] ipv6@(null): ipv6\r
+[02] X:X::X:X@foo: de4d:b33f::cafe\r
test# arg ipv6 de4d:b3\r
X:X::X:X 02\r
test# arg ipv6 de4d:b33f::caf\r
X:X::X:X 02\r
test# arg ipv6 de4d:b33f::cafe\r
cmd2 with 3 args.\r
-[00]: arg\r
-[01]: ipv6\r
-[02]: de4d:b33f::cafe\r
+[00] arg@(null): arg\r
+[01] ipv6@(null): ipv6\r
+[02] X:X::X:X@foo: de4d:b33f::cafe\r
test# arg ipv6 de4d:b3\r
test# arg ipv6 de4d:b33f::caf\r
X:X::X:X 02\r
test# arg ipv6 de4d:b33f::cafe\r
cmd2 with 3 args.\r
-[00]: arg\r
-[01]: ipv6\r
-[02]: de4d:b33f::cafe\r
+[00] arg@(null): arg\r
+[01] ipv6@(null): ipv6\r
+[02] X:X::X:X@foo: de4d:b33f::cafe\r
test# arg ipv6 de4d:b33f:z::cafe\r
% [NONE] Unknown command: arg ipv6 de4d:b33f:z::cafe\r
test# arg ipv6 de4d:b33f:cafe:\r
% [NONE] Unknown command: arg ipv6 de4d:b33f:cafe:\r
test# arg ipv6 ::\r
cmd2 with 3 args.\r
-[00]: arg\r
-[01]: ipv6\r
-[02]: ::\r
+[00] arg@(null): arg\r
+[01] ipv6@(null): ipv6\r
+[02] X:X::X:X@foo: ::\r
test# arg ipv6 ::/\r
% [NONE] Unknown command: arg ipv6 ::/\r
test# arg ipv6 1:2:3:4:5:6:7:8:9:0:1:2:3:4:5:6:7:8:9:0:1:2:3:4:5:6:7:8:9:0\r
% [NONE] Unknown command: arg ipv6 12::34::56\r
test# arg ipv6m dead:beef:cafe::/64\r
cmd3 with 3 args.\r
-[00]: arg\r
-[01]: ipv6m\r
-[02]: dead:beef:cafe::/64\r
+[00] arg@(null): arg\r
+[01] ipv6m@(null): ipv6m\r
+[02] X:X::X:X/M@ipv6m: dead:beef:cafe::/64\r
test# arg ipv6m dead:be\r
X:X::X:X/M 02\r
test# arg ipv6m dead:beef:cafe:\r
X:X::X:X/M 02\r
test# arg ipv6m dead:beef:cafe::/64\r
cmd3 with 3 args.\r
-[00]: arg\r
-[01]: ipv6m\r
-[02]: dead:beef:cafe::/64\r
+[00] arg@(null): arg\r
+[01] ipv6m@(null): ipv6m\r
+[02] X:X::X:X/M@ipv6m: dead:beef:cafe::/64\r
test# \r
test# arg range 4\r
% [NONE] Unknown command: arg range 4\r
test# arg range 5\r
cmd4 with 3 args.\r
-[00]: arg\r
-[01]: range\r
-[02]: 5\r
+[00] arg@(null): arg\r
+[01] range@(null): range\r
+[02] (5-15)@range: 5\r
test# arg range 9\r
(5-15) 02\r
test# arg range 9\r
cmd4 with 3 args.\r
-[00]: arg\r
-[01]: range\r
-[02]: 9\r
+[00] arg@(null): arg\r
+[01] range@(null): range\r
+[02] (5-15)@range: 9\r
test# arg range 15\r
cmd4 with 3 args.\r
-[00]: arg\r
-[01]: range\r
-[02]: 15\r
+[00] arg@(null): arg\r
+[01] range@(null): range\r
+[02] (5-15)@range: 15\r
test# arg range 16\r
% [NONE] Unknown command: arg range 16\r
test# arg range -1\r
test# pa\b\bpat \r
% Command incomplete.\r
test# pat \r
-a c d e f \r
+a b c d e f \r
+g \r
test# pat \r
% Command incomplete.\r
test# \r
% Command incomplete.\r
test# pat a a\r
cmd5 with 3 args.\r
-[00]: pat\r
-[01]: a\r
-[02]: a\r
+[00] pat@(null): pat\r
+[01] a@(null): a\r
+[02] a@(null): a\r
test# pat a \r
a 02\r
b 03\r
test# pat a b\r
cmd5 with 3 args.\r
-[00]: pat\r
-[01]: a\r
-[02]: b\r
+[00] pat@(null): pat\r
+[01] a@(null): a\r
+[02] b@(null): b\r
test# pat a c\r
% There is no matched command.\r
test# pat a c\r
% Command incomplete.\r
test# pat c a 1.2.3.4\r
cmd7 with 4 args.\r
-[00]: pat\r
-[01]: c\r
-[02]: a\r
-[03]: 1.2.3.4\r
+[00] pat@(null): pat\r
+[01] c@(null): c\r
+[02] a@(null): a\r
+[03] A.B.C.D@(null): 1.2.3.4\r
test# pat c b 2.3.4\r
% [NONE] Unknown command: pat c b 2.3.4\r
test# pat c c \r
% Command incomplete.\r
test# pat d foo 1.2.3.4\r
cmd8 with 4 args.\r
-[00]: pat\r
-[01]: d\r
-[02]: foo\r
-[03]: 1.2.3.4\r
+[00] pat@(null): pat\r
+[01] d@(null): d\r
+[02] foo@(null): foo\r
+[03] A.B.C.D@foo: 1.2.3.4\r
test# pat d foo\r
% Command incomplete.\r
test# pat d noooo\r
% [NONE] Unknown command: pat d noooo\r
test# pat d bar 1::2\r
cmd8 with 4 args.\r
-[00]: pat\r
-[01]: d\r
-[02]: bar\r
-[03]: 1::2\r
+[00] pat@(null): pat\r
+[01] d@(null): d\r
+[02] bar@(null): bar\r
+[03] X:X::X:X@bar: 1::2\r
test# pat d bar 1::2 foo 3.4.5.6\r
cmd8 with 6 args.\r
-[00]: pat\r
-[01]: d\r
-[02]: bar\r
-[03]: 1::2\r
-[04]: foo\r
-[05]: 3.4.5.6\r
+[00] pat@(null): pat\r
+[01] d@(null): d\r
+[02] bar@(null): bar\r
+[03] X:X::X:X@bar: 1::2\r
+[04] foo@(null): foo\r
+[05] A.B.C.D@foo: 3.4.5.6\r
test# pat d ba\r
bar 04\r
baz 06\r
test# pat d baz\r
cmd8 with 3 args.\r
-[00]: pat\r
-[01]: d\r
-[02]: baz\r
+[00] pat@(null): pat\r
+[01] d@(null): d\r
+[02] baz@(null): baz\r
test# pat d foo 3.4.5.6 baz\r
cmd8 with 5 args.\r
-[00]: pat\r
-[01]: d\r
-[02]: foo\r
-[03]: 3.4.5.6\r
-[04]: baz\r
+[00] pat@(null): pat\r
+[01] d@(null): d\r
+[02] foo@(null): foo\r
+[03] A.B.C.D@foo: 3.4.5.6\r
+[04] baz@(null): baz\r
test# \r
test# pat e\r
cmd9 with 2 args.\r
-[00]: pat\r
-[01]: e\r
+[00] pat@(null): pat\r
+[01] e@(null): e\r
test# pat e f\r
cmd9 with 3 args.\r
-[00]: pat\r
-[01]: e\r
-[02]: f\r
+[00] pat@(null): pat\r
+[01] e@(null): e\r
+[02] WORD@e: f\r
test# pat e f g\r
% [NONE] Unknown command: pat e f g\r
test# pat e 1.2.3.4\r
cmd9 with 3 args.\r
-[00]: pat\r
-[01]: e\r
-[02]: 1.2.3.4\r
+[00] pat@(null): pat\r
+[01] e@(null): e\r
+[02] WORD@e: 1.2.3.4\r
test# \r
test# pat f\r
cmd10 with 2 args.\r
-[00]: pat\r
-[01]: f\r
+[00] pat@(null): pat\r
+[01] f@(null): f\r
test# pat f foo\r
% [NONE] Unknown command: pat f foo\r
test# pat f key\r
cmd10 with 3 args.\r
-[00]: pat\r
-[01]: f\r
-[02]: key\r
+[00] pat@(null): pat\r
+[01] f@(null): f\r
+[02] key@(null): key\r
test# \r
test# alt a \r
test# alt a a\r
X:X::X:X 02\r
test# alt a ab\r
cmd11 with 3 args.\r
-[00]: alt\r
-[01]: a\r
-[02]: ab\r
+[00] alt@(null): alt\r
+[01] a@(null): a\r
+[02] WORD@a: ab\r
test# alt a 1\r
test# alt a 1.2\r
A.B.C.D 02\r
WORD 02\r
test# alt a 1.2.3.4\r
cmd12 with 3 args.\r
-[00]: alt\r
-[01]: a\r
-[02]: 1.2.3.4\r
+[00] alt@(null): alt\r
+[01] a@(null): a\r
+[02] A.B.C.D@a: 1.2.3.4\r
test# alt a 1\r
test# alt a 1:2\r
WORD 02\r
X:X::X:X 02\r
test# alt a 1:2::3\r
cmd13 with 3 args.\r
-[00]: alt\r
-[01]: a\r
-[02]: 1:2::3\r
+[00] alt@(null): alt\r
+[01] a@(null): a\r
+[02] X:X::X:X@a: 1:2::3\r
test# \r
test# conf t\r
test(config)# do pat d baz\r
cmd8 with 3 args.\r
-[00]: pat\r
-[01]: d\r
-[02]: baz\r
+[00] pat@(null): pat\r
+[01] d@(null): d\r
+[02] baz@(null): baz\r
test(config)# exit\r
test# \r
test# show run\r
printf ("%s: hard error\n", __func__);
if ((i % ITERS_PRINT) == 0)
- printf ("%s did %d, x = %g%s", str, i, x, VTY_NEWLINE);
+ printf ("%s did %d, x = %g%s", str, i, x, VTYNL);
}
static void
char *str;
if (!argc)
{
- vty_out (vty, "%% string argument required%s", VTY_NEWLINE);
+ vty_outln (vty, "%% string argument required");
return CMD_WARNING;
}
if (!argc)
{
- vty_out (vty, "%% string argument required%s", VTY_NEWLINE);
+ vty_outln (vty, "%% string argument required");
return CMD_WARNING;
}
char *str;
if (!argc)
{
- vty_out (vty, "%% string argument required%s", VTY_NEWLINE);
+ vty_outln (vty, "%% string argument required");
return CMD_WARNING;
}
int
main (void)
{
- master = thread_master_create ();
+ master = thread_master_create(NULL);
signal_init (master, array_size(sigs), sigs);
openzlog("testsegv", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON);
int
main (void)
{
- master = thread_master_create ();
+ master = thread_master_create(NULL);
signal_init (master, array_size(sigs), sigs);
openzlog("testsig", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON);
struct thread t;
struct timeval **alarms;
- master = thread_master_create();
+ master = thread_master_create(NULL);
log_buf_len = SCHEDULE_TIMERS * (TIMESTR_LEN + 1) + 1;
log_buf_pos = 0;
struct timeval tv_start, tv_lap, tv_stop;
unsigned long t_schedule, t_remove;
- master = thread_master_create();
+ master = thread_master_create(NULL);
prng = prng_new(0);
timers = calloc(SCHEDULE_TIMERS, sizeof(*timers));
printf ("Sequence to be tested: %s\n", sequence);
- master = thread_master_create();
+ master = thread_master_create(NULL);
init_zclient (master, ZSERV_PATH);
zebra_send_label_manager_connect ();
}
# Output DEFSH
-foreach (keys %live) {
+foreach (sort keys %live) {
my ($proto);
my ($key);
$key = $live{$_};
{
EOF
-foreach (keys %odefun) {
+foreach (sort keys %odefun) {
my ($node, $str) = (split (/,/));
$cmd = $ocmd{$_};
$cmd =~ s/_cmd/_cmd_vtysh/;
fprintf (stdout, " %s", item);
XFREE (MTYPE_COMPLETION, item);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
vector_free (varcomps);
}
{
unsigned int i;
int ret = CMD_SUCCESS;
- char line[] = "show work-queues\n";
+ char line[] = "do show work-queues\n";
for (i = 0; i < array_size(vtysh_client); i++)
if ( vtysh_client[i].fd >= 0 )
{
unsigned int i;
int ret = CMD_SUCCESS;
- char line[] = "show logging\n";
+ char line[] = "do show logging\n";
for (i = 0; i < array_size(vtysh_client); i++)
if ( vtysh_client[i].fd >= 0 )
"For the pim daemon\n")
{
u_int i;
- char line[] = "write terminal\n";
+ char line[] = "do write terminal\n";
FILE *fp = NULL;
if (vtysh_pager_name)
else
fp = stdout;
- vty_out (vty, "Building configuration...%s", VTY_NEWLINE);
- vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE,
- VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "Building configuration...");
+ vty_outln (vty, "%sCurrent configuration:",VTYNL);
+ vty_outln (vty, "!");
for (i = 0; i < array_size(vtysh_client); i++)
if ((argc < 3 ) || (strmatch (vtysh_client[i].name, argv[2]->text)))
fp = NULL;
}
- vty_out (vty, "end%s", VTY_NEWLINE);
+ vty_outln (vty, "end");
return CMD_SUCCESS;
}
"Write configuration to the file (same as write memory)\n")
{
int ret = CMD_SUCCESS;
- char line[] = "write memory\n";
+ char line[] = "do write memory\n";
u_int i;
fprintf (stdout, "Note: this version of vtysh never writes vtysh.conf\n");
lines = strtol (argv[idx_number]->arg, &endptr, 10);
if (lines < 0 || lines > 512 || *endptr != '\0')
{
- vty_out (vty, "length is malformed%s", VTY_NEWLINE);
+ vty_outln (vty, "length is malformed");
return CMD_WARNING;
}
for (i = 0; i < array_size(vtysh_client); i++)
if ( vtysh_client[i].fd >= 0 )
vty_out(vty, " %s", vtysh_client[i].name);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
return CMD_SUCCESS;
}
sigset_t oldmask, sigmask;
if (integrated_write_pid != -1) {
- vty_out(vty, "%% configuration write already in progress.%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% configuration write already in progress.");
return CMD_WARNING;
}
child = fork();
if (child == -1) {
- vty_out(vty, "%% configuration write fork() failed: %s.%s",
- safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% configuration write fork() failed: %s.",
+ safe_strerror(errno));
sigprocmask(SIG_SETMASK, &oldmask, NULL);
return CMD_WARNING;
}
endif
if HAVE_PROTOBUF
zebra_fpm_la_SOURCES += zebra_fpm_protobuf.c
-endif
if DEV_BUILD
zebra_fpm_la_SOURCES += zebra_fpm_dt.c
endif
+endif
EXTRA_DIST = if_ioctl.c if_ioctl_solaris.c if_netlink.c \
if (argc == 1)
usage_exit ();
- master = thread_master_create();
+ master = thread_master_create(NULL);
/* Establish connection to zebra. */
zclient = zclient_new(master);
zclient->enable = 1;
"Debugging information\n"
"Zebra configuration\n")
{
- vty_out (vty, "Zebra debugging status:%s", VTY_NEWLINE);
+ vty_out (vty, "Zebra debugging status:%s", VTYNL);
if (IS_ZEBRA_DEBUG_EVENT)
- vty_out (vty, " Zebra event debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra event debugging is on%s", VTYNL);
if (IS_ZEBRA_DEBUG_PACKET)
{
{
vty_out (vty, " Zebra packet%s debugging is on%s",
IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
- VTY_NEWLINE);
+ VTYNL);
}
else
{
if (IS_ZEBRA_DEBUG_SEND)
vty_out (vty, " Zebra packet send%s debugging is on%s",
IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
- VTY_NEWLINE);
+ VTYNL);
else
vty_out (vty, " Zebra packet receive%s debugging is on%s",
IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
- VTY_NEWLINE);
+ VTYNL);
}
}
if (IS_ZEBRA_DEBUG_KERNEL)
- vty_out (vty, " Zebra kernel debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra kernel debugging is on%s", VTYNL);
if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND)
- vty_out (vty, " Zebra kernel netlink message dumps (send) are on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra kernel netlink message dumps (send) are on%s", VTYNL);
if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV)
- vty_out (vty, " Zebra kernel netlink message dumps (recv) are on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra kernel netlink message dumps (recv) are on%s", VTYNL);
/* Check here using flags as the 'macro' does an OR */
if (CHECK_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB))
- vty_out (vty, " Zebra RIB debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra RIB debugging is on%s", VTYNL);
if (CHECK_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED))
- vty_out (vty, " Zebra RIB detailed debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra RIB detailed debugging is on%s", VTYNL);
if (IS_ZEBRA_DEBUG_FPM)
- vty_out (vty, " Zebra FPM debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra FPM debugging is on%s", VTYNL);
if (IS_ZEBRA_DEBUG_NHT)
- vty_out (vty, " Zebra next-hop tracking debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra next-hop tracking debugging is on%s", VTYNL);
if (IS_ZEBRA_DEBUG_MPLS)
- vty_out (vty, " Zebra MPLS debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, " Zebra MPLS debugging is on%s", VTYNL);
return CMD_SUCCESS;
}
if (IS_ZEBRA_DEBUG_EVENT)
{
- vty_out (vty, "debug zebra events%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra events%s", VTYNL);
write++;
}
if (IS_ZEBRA_DEBUG_PACKET)
{
vty_out (vty, "debug zebra packet%s%s",
IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
- VTY_NEWLINE);
+ VTYNL);
write++;
}
else
if (IS_ZEBRA_DEBUG_SEND)
vty_out (vty, "debug zebra packet send%s%s",
IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
- VTY_NEWLINE);
+ VTYNL);
else
vty_out (vty, "debug zebra packet recv%s%s",
IS_ZEBRA_DEBUG_DETAIL ? " detail" : "",
- VTY_NEWLINE);
+ VTYNL);
write++;
}
}
if (IS_ZEBRA_DEBUG_KERNEL)
{
- vty_out (vty, "debug zebra kernel%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra kernel%s", VTYNL);
write++;
}
if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_RECV)
{
- vty_out (vty, "debug zebra kernel msgdump recv%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra kernel msgdump recv%s", VTYNL);
write++;
}
if (IS_ZEBRA_DEBUG_KERNEL_MSGDUMP_SEND)
{
- vty_out (vty, "debug zebra kernel msgdump send%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra kernel msgdump send%s", VTYNL);
write++;
}
/* Check here using flags as the 'macro' does an OR */
if (CHECK_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB))
{
- vty_out (vty, "debug zebra rib%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra rib%s", VTYNL);
write++;
}
if (CHECK_FLAG (zebra_debug_rib, ZEBRA_DEBUG_RIB_DETAILED))
{
- vty_out (vty, "debug zebra rib detailed%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra rib detailed%s", VTYNL);
write++;
}
if (IS_ZEBRA_DEBUG_FPM)
{
- vty_out (vty, "debug zebra fpm%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra fpm%s", VTYNL);
write++;
}
if (IS_ZEBRA_DEBUG_NHT)
{
- vty_out (vty, "debug zebra nht%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra nht%s", VTYNL);
write++;
}
if (IS_ZEBRA_DEBUG_MPLS)
{
- vty_out (vty, "debug zebra mpls%s", VTY_NEWLINE);
+ vty_out (vty, "debug zebra mpls%s", VTYNL);
write++;
}
return write;
{
/* pre-configured interface, learnt now */
if (ifp->vrf_id != vrf_id)
- if_update (ifp, name, strlen(name), vrf_id);
+ if_update_to_new_vrf (ifp, vrf_id);
}
/* Update interface information. */
zebra_interface_vrf_update_del (ifp, vrf_id);
/* update VRF */
- if_update (ifp, ifp->name, strlen (ifp->name), vrf_id);
+ if_update_to_new_vrf (ifp, vrf_id);
/* Send out notification on interface VRF change. */
/* This is to issue an ADD, if needed. */
if (connected->label)
vty_out (vty, " %s", connected->label);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* Dump interface neighbor address information to vty. */
prefix_vty_out (vty, p);
vty_out (vty, "/%d", p->prefixlen);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
#if defined (HAVE_RTADV)
if (rtadv->AdvSendAdvertisements)
{
- vty_out (vty, " ND advertised reachable time is %d milliseconds%s",
- rtadv->AdvReachableTime, VTY_NEWLINE);
- vty_out (vty, " ND advertised retransmit interval is %d milliseconds%s",
- rtadv->AdvRetransTimer, VTY_NEWLINE);
- vty_out (vty, " ND router advertisements sent: %d rcvd: %d%s",
- zif->ra_sent, zif->ra_rcvd, VTY_NEWLINE);
+ vty_outln (vty, " ND advertised reachable time is %d milliseconds",
+ rtadv->AdvReachableTime);
+ vty_outln (vty, " ND advertised retransmit interval is %d milliseconds",
+ rtadv->AdvRetransTimer);
+ vty_outln (vty, " ND router advertisements sent: %d rcvd: %d",
+ zif->ra_sent, zif->ra_rcvd);
interval = rtadv->MaxRtrAdvInterval;
if (interval % 1000)
- vty_out (vty, " ND router advertisements are sent every "
- "%d milliseconds%s", interval,
- VTY_NEWLINE);
+ vty_outln (vty, " ND router advertisements are sent every "
+ "%d milliseconds",interval);
else
- vty_out (vty, " ND router advertisements are sent every "
- "%d seconds%s", interval / 1000,
- VTY_NEWLINE);
+ vty_outln (vty, " ND router advertisements are sent every "
+ "%d seconds",interval / 1000);
if (rtadv->AdvDefaultLifetime != -1)
- vty_out (vty, " ND router advertisements live for %d seconds%s",
- rtadv->AdvDefaultLifetime, VTY_NEWLINE);
+ vty_outln (vty, " ND router advertisements live for %d seconds",
+ rtadv->AdvDefaultLifetime);
else
- vty_out (vty, " ND router advertisements lifetime tracks ra-interval%s",
- VTY_NEWLINE);
- vty_out (vty, " ND router advertisement default router preference is "
- "%s%s", rtadv_pref_strs[rtadv->DefaultPreference],
- VTY_NEWLINE);
+ vty_outln (vty,
+ " ND router advertisements lifetime tracks ra-interval");
+ vty_outln (vty, " ND router advertisement default router preference is "
+ "%s",rtadv_pref_strs[rtadv->DefaultPreference]);
if (rtadv->AdvManagedFlag)
- vty_out (vty, " Hosts use DHCP to obtain routable addresses.%s",
- VTY_NEWLINE);
+ vty_outln (vty," Hosts use DHCP to obtain routable addresses.");
else
- vty_out (vty, " Hosts use stateless autoconfig for addresses.%s",
- VTY_NEWLINE);
+ vty_outln (vty," Hosts use stateless autoconfig for addresses.");
if (rtadv->AdvHomeAgentFlag)
{
- vty_out (vty, " ND router advertisements with "
- "Home Agent flag bit set.%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ " ND router advertisements with " "Home Agent flag bit set.");
if (rtadv->HomeAgentLifetime != -1)
- vty_out (vty, " Home Agent lifetime is %u seconds%s",
- rtadv->HomeAgentLifetime, VTY_NEWLINE);
+ vty_outln (vty, " Home Agent lifetime is %u seconds",
+ rtadv->HomeAgentLifetime);
else
- vty_out (vty, " Home Agent lifetime tracks ra-lifetime%s",
- VTY_NEWLINE);
- vty_out (vty, " Home Agent preference is %u%s",
- rtadv->HomeAgentPreference, VTY_NEWLINE);
+ vty_outln (vty," Home Agent lifetime tracks ra-lifetime");
+ vty_outln (vty, " Home Agent preference is %u",
+ rtadv->HomeAgentPreference);
}
if (rtadv->AdvIntervalOption)
- vty_out (vty, " ND router advertisements with Adv. Interval option.%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ " ND router advertisements with Adv. Interval option.");
}
}
#endif /* HAVE_RTADV */
if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) {
if (if_is_running(ifp))
- vty_out (vty, "is up%s", VTY_NEWLINE);
+ vty_outln (vty, "is up");
else
- vty_out (vty, "is down%s", VTY_NEWLINE);
+ vty_outln (vty, "is down");
} else {
- vty_out (vty, "detection is disabled%s", VTY_NEWLINE);
+ vty_outln (vty, "detection is disabled");
}
} else {
- vty_out (vty, "down%s", VTY_NEWLINE);
+ vty_outln (vty, "down");
}
- vty_out (vty, " Link ups: %5u last: %s%s", zebra_if->up_count,
- zebra_if->up_last[0] ? zebra_if->up_last : "(never)", VTY_NEWLINE);
- vty_out (vty, " Link downs: %5u last: %s%s", zebra_if->down_count,
- zebra_if->down_last[0] ? zebra_if->down_last : "(never)", VTY_NEWLINE);
+ vty_outln (vty, " Link ups: %5u last: %s", zebra_if->up_count,
+ zebra_if->up_last[0] ? zebra_if->up_last : "(never)");
+ vty_outln (vty, " Link downs: %5u last: %s", zebra_if->down_count,
+ zebra_if->down_last[0] ? zebra_if->down_last : "(never)");
zebra_ptm_show_status(vty, ifp);
vrf = vrf_lookup_by_id (ifp->vrf_id);
- vty_out (vty, " vrf: %s%s", vrf->name, VTY_NEWLINE);
+ vty_outln (vty, " vrf: %s", vrf->name);
if (ifp->desc)
- vty_out (vty, " Description: %s%s", ifp->desc,
- VTY_NEWLINE);
+ vty_outln (vty, " Description: %s",ifp->desc);
if (ifp->ifindex == IFINDEX_INTERNAL)
{
- vty_out(vty, " pseudo interface%s", VTY_NEWLINE);
+ vty_outln (vty, " pseudo interface");
return;
}
else if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
- vty_out(vty, " index %d inactive interface%s",
- ifp->ifindex,
- VTY_NEWLINE);
+ vty_outln (vty, " index %d inactive interface",
+ ifp->ifindex);
return;
}
ifp->ifindex, ifp->metric, ifp->mtu, ifp->speed);
if (ifp->mtu6 != ifp->mtu)
vty_out (vty, "mtu6 %d ", ifp->mtu6);
- vty_out (vty, "%s flags: %s%s", VTY_NEWLINE,
- if_flag_dump (ifp->flags), VTY_NEWLINE);
+ vty_outln (vty, "%s flags: %s", VTYNL,
+ if_flag_dump(ifp->flags));
/* Hardware address. */
- vty_out (vty, " Type: %s%s", if_link_type_str (ifp->ll_type), VTY_NEWLINE);
+ vty_outln (vty, " Type: %s", if_link_type_str(ifp->ll_type));
if (ifp->hw_addr_len != 0)
{
int i;
vty_out (vty, " HWaddr: ");
for (i = 0; i < ifp->hw_addr_len; i++)
vty_out (vty, "%s%02x", i == 0 ? "" : ":", ifp->hw_addr[i]);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/* Bandwidth in Mbps */
if (ifp->bandwidth != 0)
{
vty_out(vty, " bandwidth %u Mbps", ifp->bandwidth);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
for (rn = route_top (zebra_if->ipv4_subnets); rn; rn = route_next (rn))
{
int i;
struct if_link_params *iflp = ifp->link_params;
- vty_out(vty, " Traffic Engineering Link Parameters:%s", VTY_NEWLINE);
+ vty_outln (vty, " Traffic Engineering Link Parameters:");
if (IS_PARAM_SET(iflp, LP_TE_METRIC))
- vty_out(vty, " TE metric %u%s",iflp->te_metric, VTY_NEWLINE);
+ vty_outln (vty, " TE metric %u",iflp->te_metric);
if (IS_PARAM_SET(iflp, LP_MAX_BW))
- vty_out(vty, " Maximum Bandwidth %g (Byte/s)%s", iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty, " Maximum Bandwidth %g (Byte/s)", iflp->max_bw);
if (IS_PARAM_SET(iflp, LP_MAX_RSV_BW))
- vty_out(vty, " Maximum Reservable Bandwidth %g (Byte/s)%s", iflp->max_rsv_bw, VTY_NEWLINE);
+ vty_outln (vty, " Maximum Reservable Bandwidth %g (Byte/s)",
+ iflp->max_rsv_bw);
if (IS_PARAM_SET(iflp, LP_UNRSV_BW)) {
- vty_out(vty, " Unreserved Bandwidth per Class Type in Byte/s:%s", VTY_NEWLINE);
+ vty_outln (vty, " Unreserved Bandwidth per Class Type in Byte/s:");
for (i = 0; i < MAX_CLASS_TYPE; i+=2)
- vty_out(vty, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)%s",
- i, iflp->unrsv_bw[i], i+1, iflp->unrsv_bw[i+1], VTY_NEWLINE);
+ vty_outln (vty, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)",
+ i, iflp->unrsv_bw[i], i+1, iflp->unrsv_bw[i + 1]);
}
if (IS_PARAM_SET(iflp, LP_ADM_GRP))
- vty_out(vty, " Administrative Group:%u%s", iflp->admin_grp, VTY_NEWLINE);
+ vty_outln (vty, " Administrative Group:%u", iflp->admin_grp);
if (IS_PARAM_SET(iflp, LP_DELAY))
{
vty_out(vty, " Link Delay Average: %u (micro-sec.)", iflp->av_delay);
vty_out(vty, " Min: %u (micro-sec.)", iflp->min_delay);
vty_out(vty, " Max: %u (micro-sec.)", iflp->max_delay);
}
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (IS_PARAM_SET(iflp, LP_DELAY_VAR))
- vty_out(vty, " Link Delay Variation %u (micro-sec.)%s", iflp->delay_var, VTY_NEWLINE);
+ vty_outln (vty, " Link Delay Variation %u (micro-sec.)",
+ iflp->delay_var);
if (IS_PARAM_SET(iflp, LP_PKT_LOSS))
- vty_out(vty, " Link Packet Loss %g (in %%)%s", iflp->pkt_loss, VTY_NEWLINE);
+ vty_outln (vty, " Link Packet Loss %g (in %%)", iflp->pkt_loss);
if (IS_PARAM_SET(iflp, LP_AVA_BW))
- vty_out(vty, " Available Bandwidth %g (Byte/s)%s", iflp->ava_bw, VTY_NEWLINE);
+ vty_outln (vty, " Available Bandwidth %g (Byte/s)", iflp->ava_bw);
if (IS_PARAM_SET(iflp, LP_RES_BW))
- vty_out(vty, " Residual Bandwidth %g (Byte/s)%s", iflp->res_bw, VTY_NEWLINE);
+ vty_outln (vty, " Residual Bandwidth %g (Byte/s)", iflp->res_bw);
if (IS_PARAM_SET(iflp, LP_USE_BW))
- vty_out(vty, " Utilized Bandwidth %g (Byte/s)%s", iflp->use_bw, VTY_NEWLINE);
+ vty_outln (vty, " Utilized Bandwidth %g (Byte/s)", iflp->use_bw);
if (IS_PARAM_SET(iflp, LP_RMT_AS))
- vty_out(vty, " Neighbor ASBR IP: %s AS: %u %s", inet_ntoa(iflp->rmt_ip), iflp->rmt_as, VTY_NEWLINE);
+ vty_outln (vty, " Neighbor ASBR IP: %s AS: %u ", inet_ntoa(iflp->rmt_ip),
+ iflp->rmt_as);
}
#ifdef RTADV
nd_dump_vty (vty, ifp);
#endif /* HAVE_RTADV */
if (listhead(ifp->nbr_connected))
- vty_out (vty, " Neighbor address(s):%s", VTY_NEWLINE);
+ vty_outln (vty, " Neighbor address(s):");
for (ALL_LIST_ELEMENTS_RO (ifp->nbr_connected, node, nbr_connected))
nbr_connected_dump_vty (vty, nbr_connected);
#ifdef HAVE_PROC_NET_DEV
/* Statistics print out using proc file system. */
- vty_out (vty, " %lu input packets (%lu multicast), %lu bytes, "
- "%lu dropped%s",
+ vty_outln (vty, " %lu input packets (%lu multicast), %lu bytes, "
+ "%lu dropped",
ifp->stats.rx_packets, ifp->stats.rx_multicast,
- ifp->stats.rx_bytes, ifp->stats.rx_dropped, VTY_NEWLINE);
+ ifp->stats.rx_bytes, ifp->stats.rx_dropped);
- vty_out (vty, " %lu input errors, %lu length, %lu overrun,"
- " %lu CRC, %lu frame%s",
+ vty_outln (vty, " %lu input errors, %lu length, %lu overrun,"
+ " %lu CRC, %lu frame",
ifp->stats.rx_errors, ifp->stats.rx_length_errors,
ifp->stats.rx_over_errors, ifp->stats.rx_crc_errors,
- ifp->stats.rx_frame_errors, VTY_NEWLINE);
+ ifp->stats.rx_frame_errors);
- vty_out (vty, " %lu fifo, %lu missed%s", ifp->stats.rx_fifo_errors,
- ifp->stats.rx_missed_errors, VTY_NEWLINE);
+ vty_outln (vty, " %lu fifo, %lu missed", ifp->stats.rx_fifo_errors,
+ ifp->stats.rx_missed_errors);
- vty_out (vty, " %lu output packets, %lu bytes, %lu dropped%s",
+ vty_outln (vty, " %lu output packets, %lu bytes, %lu dropped",
ifp->stats.tx_packets, ifp->stats.tx_bytes,
- ifp->stats.tx_dropped, VTY_NEWLINE);
+ ifp->stats.tx_dropped);
- vty_out (vty, " %lu output errors, %lu aborted, %lu carrier,"
- " %lu fifo, %lu heartbeat%s",
+ vty_outln (vty, " %lu output errors, %lu aborted, %lu carrier,"
+ " %lu fifo, %lu heartbeat",
ifp->stats.tx_errors, ifp->stats.tx_aborted_errors,
ifp->stats.tx_carrier_errors, ifp->stats.tx_fifo_errors,
- ifp->stats.tx_heartbeat_errors, VTY_NEWLINE);
+ ifp->stats.tx_heartbeat_errors);
- vty_out (vty, " %lu window, %lu collisions%s",
- ifp->stats.tx_window_errors, ifp->stats.collisions, VTY_NEWLINE);
+ vty_outln (vty, " %lu window, %lu collisions",
+ ifp->stats.tx_window_errors, ifp->stats.collisions);
#endif /* HAVE_PROC_NET_DEV */
#ifdef HAVE_NET_RT_IFLIST
#if defined (__bsdi__) || defined (__NetBSD__)
/* Statistics print out using sysctl (). */
- vty_out (vty, " input packets %llu, bytes %llu, dropped %llu,"
- " multicast packets %llu%s",
+ vty_outln (vty, " input packets %llu, bytes %llu, dropped %llu,"
+ " multicast packets %llu",
(unsigned long long)ifp->stats.ifi_ipackets,
(unsigned long long)ifp->stats.ifi_ibytes,
(unsigned long long)ifp->stats.ifi_iqdrops,
- (unsigned long long)ifp->stats.ifi_imcasts,
- VTY_NEWLINE);
+ (unsigned long long)ifp->stats.ifi_imcasts);
- vty_out (vty, " input errors %llu%s",
- (unsigned long long)ifp->stats.ifi_ierrors, VTY_NEWLINE);
+ vty_outln (vty, " input errors %llu",
+ (unsigned long long)ifp->stats.ifi_ierrors);
- vty_out (vty, " output packets %llu, bytes %llu,"
- " multicast packets %llu%s",
+ vty_outln (vty, " output packets %llu, bytes %llu,"
+ " multicast packets %llu",
(unsigned long long)ifp->stats.ifi_opackets,
(unsigned long long)ifp->stats.ifi_obytes,
- (unsigned long long)ifp->stats.ifi_omcasts,
- VTY_NEWLINE);
+ (unsigned long long)ifp->stats.ifi_omcasts);
- vty_out (vty, " output errors %llu%s",
- (unsigned long long)ifp->stats.ifi_oerrors, VTY_NEWLINE);
+ vty_outln (vty, " output errors %llu",
+ (unsigned long long)ifp->stats.ifi_oerrors);
- vty_out (vty, " collisions %llu%s",
- (unsigned long long)ifp->stats.ifi_collisions, VTY_NEWLINE);
+ vty_outln (vty, " collisions %llu",
+ (unsigned long long)ifp->stats.ifi_collisions);
#else
/* Statistics print out using sysctl (). */
- vty_out (vty, " input packets %lu, bytes %lu, dropped %lu,"
- " multicast packets %lu%s",
+ vty_outln (vty, " input packets %lu, bytes %lu, dropped %lu,"
+ " multicast packets %lu",
ifp->stats.ifi_ipackets, ifp->stats.ifi_ibytes,
- ifp->stats.ifi_iqdrops, ifp->stats.ifi_imcasts,
- VTY_NEWLINE);
+ ifp->stats.ifi_iqdrops,ifp->stats.ifi_imcasts);
- vty_out (vty, " input errors %lu%s",
- ifp->stats.ifi_ierrors, VTY_NEWLINE);
+ vty_outln (vty, " input errors %lu",
+ ifp->stats.ifi_ierrors);
- vty_out (vty, " output packets %lu, bytes %lu, multicast packets %lu%s",
+ vty_outln (vty, " output packets %lu, bytes %lu, multicast packets %lu",
ifp->stats.ifi_opackets, ifp->stats.ifi_obytes,
- ifp->stats.ifi_omcasts, VTY_NEWLINE);
+ ifp->stats.ifi_omcasts);
- vty_out (vty, " output errors %lu%s",
- ifp->stats.ifi_oerrors, VTY_NEWLINE);
+ vty_outln (vty, " output errors %lu",
+ ifp->stats.ifi_oerrors);
- vty_out (vty, " collisions %lu%s",
- ifp->stats.ifi_collisions, VTY_NEWLINE);
+ vty_outln (vty, " collisions %lu",
+ ifp->stats.ifi_collisions);
#endif /* __bsdi__ || __NetBSD__ */
#endif /* HAVE_NET_RT_IFLIST */
}
ifp = if_lookup_by_name (argv[idx_ifname]->arg, vrf_id);
if (ifp == NULL)
{
- vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find interface %s",argv[idx_ifname]->arg);
return CMD_WARNING;
}
if_dump_vty (vty, ifp);
if (!found)
{
- vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg, VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find interface %s", argv[idx_ifname]->arg);
return CMD_WARNING;
}
struct listnode *node;
struct interface *ifp;
- vty_out (vty, "Interface Status Protocol Description%s", VTY_NEWLINE);
+ vty_outln (vty, "Interface Status Protocol Description");
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp))
{
int len;
if (ifp->desc)
vty_out (vty, "%s", ifp->desc);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if (!list_isempty (vrf->iflist))
{
- vty_out (vty, "%s\tVRF %u%s%s", VTY_NEWLINE, vrf->vrf_id,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "%s\tVRF %u%s", VTYNL, vrf->vrf_id,
+ VTYNL);
if_show_description (vty, vrf->vrf_id);
}
ret = if_set_flags (ifp, IFF_MULTICAST);
if (ret < 0)
{
- vty_out (vty, "Can't set multicast flag%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't set multicast flag");
return CMD_WARNING;
}
if_refresh (ifp);
ret = if_unset_flags (ifp, IFF_MULTICAST);
if (ret < 0)
{
- vty_out (vty, "Can't unset multicast flag%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't unset multicast flag");
return CMD_WARNING;
}
if_refresh (ifp);
ret = if_unset_flags (ifp, IFF_UP);
if (ret < 0)
{
- vty_out (vty, "Can't shutdown interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't shutdown interface");
return CMD_WARNING;
}
if_refresh (ifp);
ret = if_set_flags (ifp, IFF_UP | IFF_RUNNING);
if (ret < 0)
{
- vty_out (vty, "Can't up interface%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't up interface");
return CMD_WARNING;
}
if_refresh (ifp);
/* bandwidth range is <1-100000> */
if (bandwidth < 1 || bandwidth > 100000)
{
- vty_out (vty, "Bandwidth is invalid%s", VTY_NEWLINE);
+ vty_outln (vty, "Bandwidth is invalid");
return CMD_WARNING;
}
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t metric;
- VTY_GET_ULONG("metric", metric, argv[idx_number]->arg);
+ metric = strtoul(argv[idx_number]->arg, NULL, 10);
/* Update TE metric if needed */
link_param_cmd_set_uint32 (ifp, &iflp->te_metric, LP_TE_METRIC, metric);
if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
- vty_out (vty, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_maxbw: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
|| (bw <= iflp->res_bw)
|| (bw <= iflp->use_bw))
{
- vty_out (vty,
- "Maximum Bandwidth could not be lower than others bandwidth%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Maximum Bandwidth could not be lower than others bandwidth");
return CMD_WARNING;
}
if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
- vty_out (vty, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_max_rsv_bw: fscanf: %s",
+ safe_strerror(errno));
return CMD_WARNING;
}
/* Check that bandwidth is not greater than maximum bandwidth parameter */
if (bw > iflp->max_bw)
{
- vty_out (vty,
- "Maximum Reservable Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
- iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty,
+ "Maximum Reservable Bandwidth could not be greater than Maximum Bandwidth (%g)",
+ iflp->max_bw);
return CMD_WARNING;
}
/* We don't have to consider about range check here. */
if (sscanf (argv[idx_number]->arg, "%d", &priority) != 1)
{
- vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_unrsv_bw: fscanf: %s",
+ safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
- vty_out (vty, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_unrsv_bw: fscanf: %s",
+ safe_strerror(errno));
return CMD_WARNING;
}
/* Check that bandwidth is not greater than maximum bandwidth parameter */
if (bw > iflp->max_bw)
{
- vty_out (vty,
- "UnReserved Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
- iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty,
+ "UnReserved Bandwidth could not be greater than Maximum Bandwidth (%g)",
+ iflp->max_bw);
return CMD_WARNING;
}
if (sscanf (argv[idx_bitpattern]->arg, "0x%lx", &value) != 1)
{
- vty_out (vty, "link_params_admin_grp: fscanf: %s%s",
- safe_strerror (errno), VTY_NEWLINE);
+ vty_outln (vty, "link_params_admin_grp: fscanf: %s",
+ safe_strerror(errno));
return CMD_WARNING;
}
if (!inet_aton (argv[idx_ipv4]->arg, &addr))
{
- 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;
}
- VTY_GET_ULONG("AS number", as, argv[idx_number]->arg);
+ as = strtoul(argv[idx_number]->arg, NULL, 10);
/* Update Remote IP and Remote AS fields if needed */
if (IS_PARAM_UNSET(iflp, LP_RMT_AS)
{
/* Get and Check new delay values */
u_int32_t delay = 0, low = 0, high = 0;
- VTY_GET_ULONG("delay", delay, argv[1]->arg);
+ delay = strtoul(argv[1]->arg, NULL, 10);
if (argc == 6)
{
- VTY_GET_ULONG("minimum delay", low, argv[3]->arg);
- VTY_GET_ULONG("maximum delay", high, argv[5]->arg);
+ low = strtoul(argv[3]->arg, NULL, 10);
+ high = strtoul(argv[5]->arg, NULL, 10);
}
VTY_DECLVAR_CONTEXT (interface, ifp);
if (IS_PARAM_SET(iflp, LP_MM_DELAY)
&& (delay <= iflp->min_delay || delay >= iflp->max_delay))
{
- vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
- iflp->min_delay, iflp->max_delay, VTY_NEWLINE);
+ vty_outln (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay",
+ iflp->min_delay, iflp->max_delay);
return CMD_WARNING;
}
/* Update delay if value is not set or change */
/* Check new delays value coherency */
if (delay <= low || delay >= high)
{
- vty_out (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
- low, high, VTY_NEWLINE);
+ vty_outln (vty, "Average delay should be comprise between Min (%d) and Max (%d) delay",
+ low, high);
return CMD_WARNING;
}
/* Update Delays if needed */
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t value;
- VTY_GET_ULONG("delay variation", value, argv[idx_number]->arg);
+ value = strtoul(argv[idx_number]->arg, NULL, 10);
/* Update Delay Variation if needed */
link_param_cmd_set_uint32 (ifp, &iflp->delay_var, LP_DELAY_VAR, value);
if (sscanf (argv[idx_percentage]->arg, "%g", &fval) != 1)
{
- vty_out (vty, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_pkt_loss: fscanf: %s",
+ safe_strerror(errno));
return CMD_WARNING;
}
if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
- vty_out (vty, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_res_bw: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
/* Check that bandwidth is not greater than maximum bandwidth parameter */
if (bw > iflp->max_bw)
{
- vty_out (vty,
- "Residual Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
- iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty,
+ "Residual Bandwidth could not be greater than Maximum Bandwidth (%g)",
+ iflp->max_bw);
return CMD_WARNING;
}
if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
- vty_out (vty, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_ava_bw: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
/* Check that bandwidth is not greater than maximum bandwidth parameter */
if (bw > iflp->max_bw)
{
- vty_out (vty,
- "Available Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
- iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty,
+ "Available Bandwidth could not be greater than Maximum Bandwidth (%g)",
+ iflp->max_bw);
return CMD_WARNING;
}
if (sscanf (argv[idx_bandwidth]->arg, "%g", &bw) != 1)
{
- vty_out (vty, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno),
- VTY_NEWLINE);
+ vty_outln (vty, "link_params_use_bw: fscanf: %s",safe_strerror(errno));
return CMD_WARNING;
}
/* Check that bandwidth is not greater than maximum bandwidth parameter */
if (bw > iflp->max_bw)
{
- vty_out (vty,
- "Utilised Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
- iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty,
+ "Utilised Bandwidth could not be greater than Maximum Bandwidth (%g)",
+ iflp->max_bw);
return CMD_WARNING;
}
ret = str2prefix_ipv4 (addr_str, &cp);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address ");
return CMD_WARNING;
}
if (ipv4_martian(&cp.prefix))
{
- vty_out (vty, "%% Invalid address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid address");
return CMD_WARNING;
}
ret = if_set_prefix (ifp, ifc);
if (ret < 0)
{
- vty_out (vty, "%% Can't set interface IP address: %s.%s",
- safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Can't set interface IP address: %s.",
+ safe_strerror(errno));
return CMD_WARNING;
}
ret = str2prefix_ipv4 (addr_str, &cp);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address ");
return CMD_WARNING;
}
ifc = connected_check (ifp, (struct prefix *) &cp);
if (! ifc)
{
- vty_out (vty, "%% Can't find address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find address");
return CMD_WARNING;
}
ret = if_unset_prefix (ifp, ifc);
if (ret < 0)
{
- vty_out (vty, "%% Can't unset interface IP address: %s.%s",
- safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Can't unset interface IP address: %s.",
+ safe_strerror(errno));
return CMD_WARNING;
}
UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED);
ret = str2prefix_ipv6 (addr_str, &cp);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address ");
return CMD_WARNING;
}
if (ipv6_martian(&cp.prefix))
{
- vty_out (vty, "%% Invalid address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid address");
return CMD_WARNING;
}
if (ret < 0)
{
- vty_out (vty, "%% Can't set interface IP address: %s.%s",
- safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Can't set interface IP address: %s.",
+ safe_strerror(errno));
return CMD_WARNING;
}
ret = str2prefix_ipv6 (addr_str, &cp);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address ");
return CMD_WARNING;
}
ifc = connected_check (ifp, (struct prefix *) &cp);
if (! ifc)
{
- vty_out (vty, "%% Can't find address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Can't find address");
return CMD_WARNING;
}
ret = if_prefix_delete_ipv6 (ifp, ifc);
if (ret < 0)
{
- vty_out (vty, "%% Can't unset interface IP address: %s.%s",
- safe_strerror(errno), VTY_NEWLINE);
+ vty_outln (vty, "%% Can't unset interface IP address: %s.",
+ safe_strerror(errno));
return CMD_WARNING;
}
struct if_link_params *iflp = ifp->link_params;
- vty_out (vty, " link-params%s", VTY_NEWLINE);
- vty_out(vty, " enable%s", VTY_NEWLINE);
+ vty_outln (vty, " link-params");
+ vty_outln (vty, " enable");
if (IS_PARAM_SET(iflp, LP_TE_METRIC) && iflp->te_metric != ifp->metric)
- vty_out(vty, " metric %u%s",iflp->te_metric, VTY_NEWLINE);
+ vty_outln (vty, " metric %u",iflp->te_metric);
if (IS_PARAM_SET(iflp, LP_MAX_BW) && iflp->max_bw != iflp->default_bw)
- vty_out(vty, " max-bw %g%s", iflp->max_bw, VTY_NEWLINE);
+ vty_outln (vty, " max-bw %g", iflp->max_bw);
if (IS_PARAM_SET(iflp, LP_MAX_RSV_BW) && iflp->max_rsv_bw != iflp->default_bw)
- vty_out(vty, " max-rsv-bw %g%s", iflp->max_rsv_bw, VTY_NEWLINE);
+ vty_outln (vty, " max-rsv-bw %g", iflp->max_rsv_bw);
if (IS_PARAM_SET(iflp, LP_UNRSV_BW))
{
for (i = 0; i < 8; i++)
if (iflp->unrsv_bw[i] != iflp->default_bw)
- vty_out(vty, " unrsv-bw %d %g%s",
- i, iflp->unrsv_bw[i], VTY_NEWLINE);
+ vty_outln (vty, " unrsv-bw %d %g",
+ i, iflp->unrsv_bw[i]);
}
if (IS_PARAM_SET(iflp, LP_ADM_GRP))
- vty_out(vty, " admin-grp 0x%x%s", iflp->admin_grp, VTY_NEWLINE);
+ vty_outln (vty, " admin-grp 0x%x", iflp->admin_grp);
if (IS_PARAM_SET(iflp, LP_DELAY))
{
vty_out(vty, " delay %u", iflp->av_delay);
vty_out(vty, " min %u", iflp->min_delay);
vty_out(vty, " max %u", iflp->max_delay);
}
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
if (IS_PARAM_SET(iflp, LP_DELAY_VAR))
- vty_out(vty, " delay-variation %u%s", iflp->delay_var, VTY_NEWLINE);
+ vty_outln (vty, " delay-variation %u", iflp->delay_var);
if (IS_PARAM_SET(iflp, LP_PKT_LOSS))
- vty_out(vty, " packet-loss %g%s", iflp->pkt_loss, VTY_NEWLINE);
+ vty_outln (vty, " packet-loss %g", iflp->pkt_loss);
if (IS_PARAM_SET(iflp, LP_AVA_BW))
- vty_out(vty, " ava-bw %g%s", iflp->ava_bw, VTY_NEWLINE);
+ vty_outln (vty, " ava-bw %g", iflp->ava_bw);
if (IS_PARAM_SET(iflp, LP_RES_BW))
- vty_out(vty, " res-bw %g%s", iflp->res_bw, VTY_NEWLINE);
+ vty_outln (vty, " res-bw %g", iflp->res_bw);
if (IS_PARAM_SET(iflp, LP_USE_BW))
- vty_out(vty, " use-bw %g%s", iflp->use_bw, VTY_NEWLINE);
+ vty_outln (vty, " use-bw %g", iflp->use_bw);
if (IS_PARAM_SET(iflp, LP_RMT_AS))
- vty_out(vty, " neighbor %s as %u%s", inet_ntoa(iflp->rmt_ip),
- iflp->rmt_as, VTY_NEWLINE);
- vty_out(vty, " exit-link-params%s", VTY_NEWLINE);
+ vty_outln (vty, " neighbor %s as %u", inet_ntoa(iflp->rmt_ip),
+ iflp->rmt_as);
+ vty_outln (vty, " exit-link-params");
return 0;
}
vrf = vrf_lookup_by_id (ifp->vrf_id);
if (ifp->vrf_id == VRF_DEFAULT)
- vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE);
+ vty_outln (vty, "interface %s", ifp->name);
else
- vty_out (vty, "interface %s vrf %s%s", ifp->name, vrf->name,
- VTY_NEWLINE);
+ vty_outln (vty, "interface %s vrf %s", ifp->name,vrf->name);
if (if_data)
{
if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
- vty_out (vty, " shutdown%s", VTY_NEWLINE);
+ vty_outln (vty, " shutdown");
zebra_ptm_if_write(vty, if_data);
}
if (ifp->desc)
- vty_out (vty, " description %s%s", ifp->desc,
- VTY_NEWLINE);
+ vty_outln (vty, " description %s",ifp->desc);
/* Assign bandwidth here to avoid unnecessary interface flap
while processing config script */
if (ifp->bandwidth != 0)
- vty_out(vty, " bandwidth %u%s", ifp->bandwidth, VTY_NEWLINE);
+ vty_outln (vty, " bandwidth %u", ifp->bandwidth);
if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
- vty_out(vty, " no link-detect%s", VTY_NEWLINE);
+ vty_outln (vty, " no link-detect");
for (ALL_LIST_ELEMENTS_RO (ifp->connected, addrnode, ifc))
{
if (ifc->label)
vty_out (vty, " label %s", ifc->label);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
if (if_data)
{
if (if_data->multicast != IF_ZEBRA_MULTICAST_UNSPEC)
- vty_out (vty, " %smulticast%s",
- if_data->multicast == IF_ZEBRA_MULTICAST_ON ? "" : "no ",
- VTY_NEWLINE);
+ vty_outln (vty, " %smulticast",
+ if_data->multicast == IF_ZEBRA_MULTICAST_ON ? "" : "no ");
}
#if defined (HAVE_RTADV)
link_params_config_write (vty, ifp);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
}
return 0;
}
if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) {
if( irdp->flags & IF_SHUTDOWN)
- vty_out (vty, " ip irdp shutdown %s", VTY_NEWLINE);
+ vty_outln (vty, " ip irdp shutdown ");
if( irdp->flags & IF_BROADCAST)
- vty_out (vty, " ip irdp broadcast%s", VTY_NEWLINE);
+ vty_outln (vty, " ip irdp broadcast");
else
- vty_out (vty, " ip irdp multicast%s", VTY_NEWLINE);
+ vty_outln (vty, " ip irdp multicast");
- vty_out (vty, " ip irdp preference %ld%s",
- irdp->Preference, VTY_NEWLINE);
+ vty_outln (vty, " ip irdp preference %ld",
+ irdp->Preference);
for (ALL_LIST_ELEMENTS_RO (irdp->AdvPrefList, node, adv))
- vty_out (vty, " ip irdp address %s preference %d%s",
+ vty_outln (vty, " ip irdp address %s preference %d",
inet_2a(adv->ip.s_addr, b1),
- adv->pref,
- VTY_NEWLINE);
+ adv->pref);
- vty_out (vty, " ip irdp holdtime %d%s",
- irdp->Lifetime, VTY_NEWLINE);
+ vty_outln (vty, " ip irdp holdtime %d",
+ irdp->Lifetime);
- vty_out (vty, " ip irdp minadvertinterval %ld%s",
- irdp->MinAdvertInterval, VTY_NEWLINE);
+ vty_outln (vty, " ip irdp minadvertinterval %ld",
+ irdp->MinAdvertInterval);
- vty_out (vty, " ip irdp maxadvertinterval %ld%s",
- irdp->MaxAdvertInterval, VTY_NEWLINE);
+ vty_outln (vty, " ip irdp maxadvertinterval %ld",
+ irdp->MaxAdvertInterval);
}
}
zi=ifp->info;
irdp=&zi->irdp;
- if( (unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
+ if((unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
irdp->MinAdvertInterval = atoi(argv[idx_number]->arg);
-
return CMD_SUCCESS;
}
-
- vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
- VTY_NEWLINE);
-
- vty_out (vty, "Please correct!%s",
- VTY_NEWLINE);
- return CMD_WARNING;
+ else {
+ vty_outln (vty, "%% MinAdvertInterval must be less than or equal to "
+ "MaxAdvertInterval");
+ return CMD_WARNING;
+ }
}
DEFUN (ip_irdp_maxadvertinterval,
zi=ifp->info;
irdp=&zi->irdp;
-
- if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg) ) {
- irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
-
+ if(irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg)) {
+ irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
return CMD_SUCCESS;
}
-
- vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
- VTY_NEWLINE);
-
- vty_out (vty, "Please correct!%s",
- VTY_NEWLINE);
- return CMD_WARNING;
+ else {
+ vty_outln (vty, "%% MaxAdvertInterval must be greater than or equal to "
+ "MinAdvertInterval");
+ return CMD_WARNING;
+ }
}
/* DEFUN needs to be fixed for negative ranages...
}
tmp = irdp->MaxAdvertInterval-irdp->MinAdvertInterval;
- timer = (random () % tmp ) + 1;
+ timer = random () % (tmp + 1);
timer = irdp->MinAdvertInterval + timer;
if(irdp->irdp_sent < MAX_INITIAL_ADVERTISEMENTS &&
if (rmap_name)
vty_out(vty, " route-map %s", rmap_name);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
write = 1;
}
}
if (zvrf->rid_user_assigned.u.prefix4.s_addr)
{
if (zvrf_id (zvrf) == VRF_DEFAULT)
- vty_out (vty, "router-id %s%s",
- inet_ntoa (zvrf->rid_user_assigned.u.prefix4),
- VTY_NEWLINE);
- else
- vty_out (vty, "router-id %s vrf %s%s",
- inet_ntoa (zvrf->rid_user_assigned.u.prefix4),
- zvrf_name (zvrf),
- VTY_NEWLINE);
+ vty_outln (vty, "router-id %s",
+ inet_ntoa(zvrf->rid_user_assigned.u.prefix4));
+ else
+ vty_outln (vty, "router-id %s vrf %s",
+ inet_ntoa (zvrf->rid_user_assigned.u.prefix4),
+ zvrf_name(zvrf));
}
}
if (if_is_loopback (ifp) ||
CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK))
{
- vty_out (vty, "Cannot configure IPv6 Router Advertisements on this interface%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Cannot configure IPv6 Router Advertisements on this interface");
return CMD_WARNING;
}
if (if_is_loopback (ifp) ||
CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK))
{
- vty_out (vty, "Cannot configure IPv6 Router Advertisements on this interface%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "Cannot configure IPv6 Router Advertisements on this interface");
return CMD_WARNING;
}
struct zebra_ns *zns;
zns = zvrf->zns;
- VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 70, 1800000);
+ interval = strtoul(argv[idx_number]->arg, NULL, 10);
if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000))
{
- vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "This ra-interval would conflict with configured ra-lifetime!");
return CMD_WARNING;
}
struct zebra_ns *zns;
zns = zvrf->zns;
- VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[idx_number]->arg, 1, 1800);
+ interval = strtoul(argv[idx_number]->arg, NULL, 10);
if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime))
{
- vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "This ra-interval would conflict with configured ra-lifetime!");
return CMD_WARNING;
}
struct zebra_if *zif = ifp->info;
int lifetime;
- VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[idx_number]->arg, 0, 9000);
+ lifetime = strtoul(argv[idx_number]->arg, NULL, 10);
/* The value to be placed in the Router Lifetime field
* of Router Advertisements sent from the interface,
* MaxRtrAdvInterval and 9000 seconds. -- RFC4861, 6.2.1 */
if ((lifetime != 0 && lifetime * 1000 < zif->rtadv.MaxRtrAdvInterval))
{
- vty_out (vty, "This ra-lifetime would conflict with configured ra-interval%s", VTY_NEWLINE);
+ vty_outln (vty,
+ "This ra-lifetime would conflict with configured ra-interval");
return CMD_WARNING;
}
int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[idx_number]->arg, 1, RTADV_MAX_REACHABLE_TIME);
+ zif->rtadv.AdvReachableTime = strtoul(argv[idx_number]->arg, NULL, 10);
return CMD_SUCCESS;
}
int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[idx_number]->arg, 0, 65535);
+ zif->rtadv.HomeAgentPreference = strtoul(argv[idx_number]->arg, NULL, 10);
return CMD_SUCCESS;
}
int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[idx_number]->arg, 0, RTADV_MAX_HALIFETIME);
+ zif->rtadv.HomeAgentLifetime = strtoul(argv[idx_number]->arg, NULL, 10);
return CMD_SUCCESS;
}
ret = str2prefix_ipv6 (prefix, &rp.prefix);
if (!ret)
{
- vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 prefix");
return CMD_WARNING;
}
apply_mask_ipv6 (&rp.prefix); /* RFC4861 4.6.2 */
rp.AdvPreferredLifetime = strmatch (preflifetime, "infinite") ? UINT32_MAX : strtoll (preflifetime, NULL, 10);
if (rp.AdvPreferredLifetime > rp.AdvValidLifetime)
{
- vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE);
+ vty_outln (vty, "Invalid preferred lifetime");
return CMD_WARNING;
}
}
ret = str2prefix_ipv6 (prefix, &rp.prefix);
if (!ret)
{
- vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 prefix");
return CMD_WARNING;
}
apply_mask_ipv6 (&rp.prefix); /* RFC4861 4.6.2 */
ret = rtadv_prefix_reset (zebra_if, &rp);
if (!ret)
{
- vty_out (vty, "Non-existant IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Non-existant IPv6 prefix");
return CMD_WARNING;
}
int idx_number = 3;
VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
- VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[idx_number]->arg, 1, 65535);
+ zif->rtadv.AdvLinkMTU = strtoul(argv[idx_number]->arg, NULL, 10);
return CMD_SUCCESS;
}
CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK)))
{
if (zif->rtadv.AdvSendAdvertisements)
- vty_out (vty, " no ipv6 nd suppress-ra%s", VTY_NEWLINE);
+ vty_outln (vty, " no ipv6 nd suppress-ra");
}
interval = zif->rtadv.MaxRtrAdvInterval;
if (interval % 1000)
- vty_out (vty, " ipv6 nd ra-interval msec %d%s", interval,
- VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd ra-interval msec %d",interval);
else
if (interval != RTADV_MAX_RTR_ADV_INTERVAL)
- vty_out (vty, " ipv6 nd ra-interval %d%s", interval / 1000,
- VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd ra-interval %d",interval / 1000);
if (zif->rtadv.AdvIntervalOption)
- vty_out (vty, " ipv6 nd adv-interval-option%s", VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd adv-interval-option");
if (zif->rtadv.AdvDefaultLifetime != -1)
- vty_out (vty, " ipv6 nd ra-lifetime %d%s", zif->rtadv.AdvDefaultLifetime,
- VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd ra-lifetime %d",zif->rtadv.AdvDefaultLifetime);
if (zif->rtadv.HomeAgentPreference)
- vty_out (vty, " ipv6 nd home-agent-preference %u%s",
- zif->rtadv.HomeAgentPreference, VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd home-agent-preference %u",
+ zif->rtadv.HomeAgentPreference);
if (zif->rtadv.HomeAgentLifetime != -1)
- vty_out (vty, " ipv6 nd home-agent-lifetime %u%s",
- zif->rtadv.HomeAgentLifetime, VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd home-agent-lifetime %u",
+ zif->rtadv.HomeAgentLifetime);
if (zif->rtadv.AdvHomeAgentFlag)
- vty_out (vty, " ipv6 nd home-agent-config-flag%s", VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd home-agent-config-flag");
if (zif->rtadv.AdvReachableTime)
- vty_out (vty, " ipv6 nd reachable-time %d%s", zif->rtadv.AdvReachableTime,
- VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd reachable-time %d",
+ zif->rtadv.AdvReachableTime);
if (zif->rtadv.AdvManagedFlag)
- vty_out (vty, " ipv6 nd managed-config-flag%s", VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd managed-config-flag");
if (zif->rtadv.AdvOtherConfigFlag)
- vty_out (vty, " ipv6 nd other-config-flag%s", VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd other-config-flag");
if (zif->rtadv.DefaultPreference != RTADV_PREF_MEDIUM)
- vty_out (vty, " ipv6 nd router-preference %s%s",
- rtadv_pref_strs[zif->rtadv.DefaultPreference],
- VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd router-preference %s",
+ rtadv_pref_strs[zif->rtadv.DefaultPreference]);
if (zif->rtadv.AdvLinkMTU)
- vty_out (vty, " ipv6 nd mtu %d%s", zif->rtadv.AdvLinkMTU, VTY_NEWLINE);
+ vty_outln (vty, " ipv6 nd mtu %d", zif->rtadv.AdvLinkMTU);
for (ALL_LIST_ELEMENTS_RO (zif->rtadv.AdvPrefixList, node, rprefix))
{
vty_out (vty, " no-autoconfig");
if (rprefix->AdvRouterAddressFlag)
vty_out (vty, " router-address");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
*/
#define ZFPM_SHOW_STAT(counter) \
do { \
- vty_out (vty, "%-40s %10lu %16lu%s", #counter, total_stats.counter, \
- zfpm_g->last_ivl_stats.counter, VTY_NEWLINE); \
+ vty_outln (vty, "%-40s %10lu %16lu", #counter, total_stats.counter, \
+ zfpm_g->last_ivl_stats.counter); \
} while (0)
/*
zfpm_stats_t total_stats;
time_t elapsed;
- vty_out (vty, "%s%-40s %10s Last %2d secs%s%s", VTY_NEWLINE, "Counter",
- "Total", ZFPM_STATS_IVL_SECS, VTY_NEWLINE, VTY_NEWLINE);
+ vty_outln (vty, "%s%-40s %10s Last %2d secs%s", VTYNL, "Counter",
+ "Total", ZFPM_STATS_IVL_SECS, VTYNL);
/*
* Compute the total stats up to this instant.
elapsed = zfpm_get_elapsed_time (zfpm_g->last_stats_clear_time);
- vty_out (vty, "%sStats were cleared %lu seconds ago%s", VTY_NEWLINE,
- (unsigned long) elapsed, VTY_NEWLINE);
+ vty_outln (vty, "%sStats were cleared %lu seconds ago", VTYNL,
+ (unsigned long)elapsed);
}
/*
{
if (!zfpm_is_enabled ())
{
- vty_out (vty, "The FPM module is not enabled...%s", VTY_NEWLINE);
+ vty_outln (vty, "The FPM module is not enabled...");
return;
}
zfpm_g->last_stats_clear_time = monotime(NULL);
- vty_out (vty, "Cleared FPM stats%s", VTY_NEWLINE);
+ vty_outln (vty, "Cleared FPM stats");
}
/*
if (zfpm_g->fpm_server != FPM_DEFAULT_IP ||
zfpm_g->fpm_port != FPM_DEFAULT_PORT)
- vty_out (vty,"fpm connection ip %s port %d%s", inet_ntoa (in),zfpm_g->fpm_port,VTY_NEWLINE);
+ vty_outln (vty,"fpm connection ip %s port %d", inet_ntoa (in),
+ zfpm_g->fpm_port);
return 0;
}
rn = fec->rn;
prefix2str(&rn->p, buf, BUFSIZ);
- vty_out(vty, "%s%s", buf, VTY_NEWLINE);
+ vty_outln (vty, "%s", buf);
vty_out(vty, " Label: %s", label2str(fec->label, buf, BUFSIZ));
if (fec->label_index != MPLS_INVALID_LABEL_INDEX)
vty_out(vty, ", Label Index: %u", fec->label_index);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
if (!list_isempty(fec->client_list))
{
vty_out(vty, " Client list:");
for (ALL_LIST_ELEMENTS_RO(fec->client_list, node, client))
vty_out(vty, " %s(fd %d)",
zebra_route_string(client->proto), client->sock);
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
if (!nexthop || !nexthop->nh_label) // unexpected
return;
- vty_out(vty, " type: %s remote label: %s distance: %d%s",
+ vty_outln (vty, " type: %s remote label: %s distance: %d",
nhlfe_type2str(nhlfe->type),
label2str(nexthop->nh_label->label[0], buf, BUFSIZ),
- nhlfe->distance, VTY_NEWLINE);
+ nhlfe->distance);
switch (nexthop->type)
{
case NEXTHOP_TYPE_IPV4:
}
vty_out(vty, "%s", CHECK_FLAG (nhlfe->flags, NHLFE_FLAG_INSTALLED) ?
" (installed)" : "");
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
/*
vty = (struct vty *) ctxt;
- vty_out(vty, "Local label: %u%s%s",
+ vty_outln (vty, "Local label: %u%s",
lsp->ile.in_label,
- CHECK_FLAG (lsp->flags, LSP_FLAG_INSTALLED) ? " (installed)" : "",
- VTY_NEWLINE);
+ CHECK_FLAG(lsp->flags, LSP_FLAG_INSTALLED) ? " (installed)" : "");
for (nhlfe = lsp->nhlfe_list; nhlfe; nhlfe = nhlfe->next)
nhlfe_print (nhlfe, vty);
write = 1;
prefix2str(&rn->p, buf, BUFSIZ);
- vty_out(vty, "mpls label bind %s %s%s", buf,
- label2str(fec->label, lstr, BUFSIZ), VTY_NEWLINE);
+ vty_outln (vty, "mpls label bind %s %s", buf,
+ label2str(fec->label, lstr, BUFSIZ));
}
}
if (use_json)
{
json = lsp_json(lsp);
- 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
json_object_object_add(json, label2str(lsp->ile.in_label, buf, BUFSIZ),
lsp_json(lsp));
- 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
{
- vty_out (vty, " Inbound Outbound%s", VTY_NEWLINE);
- vty_out (vty, " Label Type Nexthop Label%s", VTY_NEWLINE);
- vty_out (vty, "-------- ------- --------------- --------%s", VTY_NEWLINE);
+ vty_outln (vty, " Inbound Outbound");
+ vty_outln (vty, " Label Type Nexthop Label");
+ vty_outln (vty, "-------- ------- --------------- --------");
for (ALL_LIST_ELEMENTS_RO(lsp_list, node, lsp))
{
break;
}
- vty_out (vty, " %8d%s", nexthop->nh_label->label[0], VTY_NEWLINE);
+ vty_outln (vty, " %8d", nexthop->nh_label->label[0]);
}
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
list_delete (lsp_list);
break;
}
- vty_out (vty, "mpls lsp %u %s %s%s",
- slsp->ile.in_label, buf, lstr, VTY_NEWLINE);
+ vty_outln (vty, "mpls lsp %u %s %s",
+ slsp->ile.in_label, buf, lstr);
}
}
if ((zvrf->mpls_srgb.start_label != MPLS_DEFAULT_MIN_SRGB_LABEL) ||
(zvrf->mpls_srgb.end_label != MPLS_DEFAULT_MAX_SRGB_LABEL))
{
- vty_out(vty, "mpls label global-block %u %u%s",
- zvrf->mpls_srgb.start_label, zvrf->mpls_srgb.end_label,
- VTY_NEWLINE);
+ vty_outln (vty, "mpls label global-block %u %u",
+ zvrf->mpls_srgb.start_label,zvrf->mpls_srgb.end_label);
}
return 1;
if (!mpls_enabled)
{
- vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% MPLS not turned on in kernel, ignoring command");
return CMD_WARNING;
}
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
{
- vty_out (vty, "%% Default VRF does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Default VRF does not exist");
return CMD_WARNING;
}
if (!inlabel_str)
{
- vty_out (vty, "%% No Label Information%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No Label Information");
return CMD_WARNING;
}
label = atoi(inlabel_str);
if (!IS_MPLS_UNRESERVED_LABEL(label))
{
- vty_out (vty, "%% Invalid label%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid label");
return CMD_WARNING;
}
{
if (!gate_str)
{
- vty_out (vty, "%% No Nexthop Information%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No Nexthop Information");
return CMD_WARNING;
}
if (!outlabel_str)
{
- vty_out (vty, "%% No Outgoing label Information%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No Outgoing label Information");
return CMD_WARNING;
}
}
gtype = NEXTHOP_TYPE_IPV4;
else
{
- vty_out (vty, "%% Invalid nexthop%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid nexthop");
return CMD_WARNING;
}
}
if (!zebra_mpls_lsp_label_consistent (zvrf, in_label, out_label, gtype,
&gate, 0))
{
- vty_out (vty, "%% Label value not consistent%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% Label value not consistent");
return CMD_WARNING;
}
#endif /* HAVE_CUMULUS */
if (ret)
{
- vty_out (vty, "%% LSP cannot be %s%s",
- add_cmd ? "added" : "deleted", VTY_NEWLINE);
+ vty_outln (vty, "%% LSP cannot be %s",
+ add_cmd ? "added" : "deleted");
return CMD_WARNING;
}
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
{
- vty_out (vty, "%% Default VRF does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Default VRF does not exist");
return CMD_WARNING;
}
ret = str2prefix(prefix, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
{
if (!label_str)
{
- vty_out (vty, "%% No label binding specified%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No label binding specified");
return CMD_WARNING;
}
label = atoi(label_str);
if (!IS_MPLS_UNRESERVED_LABEL(label))
{
- vty_out (vty, "%% Invalid label%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid label");
return CMD_WARNING;
}
if (zebra_mpls_label_already_bound (zvrf, label))
{
- vty_out (vty, "%% Label already bound to a FEC%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% Label already bound to a FEC");
return CMD_WARNING;
}
}
if (ret)
{
- vty_out (vty, "%% FEC to label binding cannot be %s%s",
- add_cmd ? "added" : "deleted", VTY_NEWLINE);
+ vty_outln (vty, "%% FEC to label binding cannot be %s",
+ add_cmd ? "added" : "deleted");
return CMD_WARNING;
}
ret = str2prefix(argv[3]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
zebra_mpls_print_fec (vty, zvrf, &p);
"MPLS information\n"
"MPLS status\n")
{
- vty_out (vty, "MPLS support enabled: %s%s", (mpls_enabled) ? "yes" :
- "no (mpls kernel extensions not detected)", VTY_NEWLINE);
+ vty_outln (vty, "MPLS support enabled: %s",
+ (mpls_enabled) ? "yes" : "no (mpls kernel extensions not detected)");
return CMD_SUCCESS;
}
zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
{
- vty_out (vty, "%% Default VRF does not exist%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Default VRF does not exist");
return CMD_WARNING;
}
{
if (!start_label_str || !end_label_str)
{
- vty_out (vty, "%% Labels not specified%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Labels not specified");
return CMD_WARNING;
}
if (!IS_MPLS_UNRESERVED_LABEL(start_label) ||
!IS_MPLS_UNRESERVED_LABEL(end_label))
{
- vty_out (vty, "%% Invalid label%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Invalid label");
return CMD_WARNING;
}
if (end_label < start_label)
{
- vty_out (vty, "%% End label is less than Start label%s",
- VTY_NEWLINE);
+ vty_outln (vty,"%% End label is less than Start label");
return CMD_WARNING;
}
if (ret)
{
- vty_out (vty, "%% Global label block could not be %s%s",
- add_cmd ? "added" : "deleted", VTY_NEWLINE);
+ vty_outln (vty, "%% Global label block could not be %s",
+ add_cmd ? "added" : "deleted");
return CMD_WARNING;
}
zebra_ptm_write (struct vty *vty)
{
if (ptm_cb.ptm_enable)
- vty_out (vty, "ptm-enable%s", VTY_NEWLINE);
+ vty_outln (vty, "ptm-enable");
return;
}
{
vty_out (vty, " PTM status: ");
if (ifp->ptm_enable) {
- vty_out (vty, "%s%s", zebra_ptm_get_status_str (ifp->ptm_status),
- VTY_NEWLINE);
+ vty_outln (vty, "%s",zebra_ptm_get_status_str(ifp->ptm_status));
} else {
- vty_out (vty, "disabled%s", VTY_NEWLINE);
+ vty_outln (vty, "disabled");
}
}
zebra_ptm_if_write (struct vty *vty, struct zebra_if *zebra_ifp)
{
if (zebra_ifp->ptm_enable == ZEBRA_IF_PTM_ENABLE_OFF)
- vty_out (vty, " no ptm-enable%s", VTY_NEWLINE);
+ vty_outln (vty, " no ptm-enable");
}
default:
break;
}
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out(vty, "%s", VTYNL);
}
static void
rnh = rn->info;
vty_out(vty, "%s%s%s", inet_ntop(rn->p.family, &rn->p.u.prefix, buf, BUFSIZ),
CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED) ? "(Connected)" : "",
- VTY_NEWLINE);
+ VTYNL);
if (rnh->state)
{
vty_out(vty, " resolved via %s%s",
- zebra_route_string(rnh->state->type), VTY_NEWLINE);
+ zebra_route_string(rnh->state->type), VTYNL);
for (nexthop = rnh->state->nexthop; nexthop; nexthop = nexthop->next)
print_nh(nexthop, vty);
}
else
vty_out(vty, " unresolved%s%s",
CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED) ? "(Connected)" : "",
- VTY_NEWLINE);
+ VTYNL);
vty_out(vty, " Client list:");
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client))
client->sock, rnh->filtered[client->proto] ? "(filtered)" : "");
if (!list_isempty(rnh->zebra_static_route_list))
vty_out(vty, " zebra%s", rnh->filtered[ZEBRA_ROUTE_STATIC] ? "(filtered)" : "");
- vty_out(vty, "%s", VTY_NEWLINE);
+ vty_out(vty, "%s", VTYNL);
}
switch (ret)
{
case RMAP_RULE_MISSING:
- vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Zebra Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Zebra Argument is malformed.");
return CMD_WARNING;
}
}
switch (ret)
{
case RMAP_RULE_MISSING:
- vty_out (vty, "%% Zebra Can't find rule.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Zebra Can't find rule.");
return CMD_WARNING;
case RMAP_COMPILE_ERROR:
- vty_out (vty, "%% Zebra Argument is malformed.%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Zebra Argument is malformed.");
return CMD_WARNING;
}
}
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
return zebra_route_match_add (vty, "source-protocol", proto, RMAP_EVENT_MATCH_ADDED);
{
if (inet_pton(AF_INET6, argv[idx_ip]->arg, &src.ipv6) != 1)
{
- vty_out (vty, "%% not a valid IPv4/v6 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% not a valid IPv4/v6 address");
return CMD_WARNING;
}
if (!zebra_check_addr(&p))
{
- vty_out (vty, "%% not a valid source IPv4/v6 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% not a valid source IPv4/v6 address");
return CMD_WARNING;
}
if (!pif)
{
- vty_out (vty, "%% not a local address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% not a local address");
return CMD_WARNING;
}
int idx_number = 3;
u_int32_t rmap_delay_timer;
- VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[idx_number]->arg, 0, 600);
+ rmap_delay_timer = strtoul(argv[idx_number]->arg, NULL, 10);
zebra_route_map_set_delay_timer(rmap_delay_timer);
return (CMD_SUCCESS);
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
if (proto_rm[AFI_IP][i])
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
{
int i;
- vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
- vty_out(vty, "------------------------%s", VTY_NEWLINE);
+ vty_outln (vty, "Protocol : route-map ");
+ vty_outln (vty, "------------------------");
for (i=0;i<ZEBRA_ROUTE_MAX;i++)
{
if (proto_rm[AFI_IP][i])
- vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
- proto_rm[AFI_IP][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", zebra_route_string(i),
+ proto_rm[AFI_IP][i]);
else
- vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", zebra_route_string(i));
}
if (proto_rm[AFI_IP][i])
- vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", "any",proto_rm[AFI_IP][i]);
else
- vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", "any");
return CMD_SUCCESS;
}
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
if (proto_rm[AFI_IP6][i])
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
if (!proto_rm[AFI_IP6][i])
{
int i;
- vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
- vty_out(vty, "------------------------%s", VTY_NEWLINE);
+ vty_outln (vty, "Protocol : route-map ");
+ vty_outln (vty, "------------------------");
for (i=0;i<ZEBRA_ROUTE_MAX;i++)
{
if (proto_rm[AFI_IP6][i])
- vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
- proto_rm[AFI_IP6][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", zebra_route_string(i),
+ proto_rm[AFI_IP6][i]);
else
- vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", zebra_route_string(i));
}
if (proto_rm[AFI_IP6][i])
- vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP6][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", "any",proto_rm[AFI_IP6][i]);
else
- vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", "any");
return CMD_SUCCESS;
}
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
if (nht_rm[AFI_IP][i])
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
{
int i;
- vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
- vty_out(vty, "------------------------%s", VTY_NEWLINE);
+ vty_outln (vty, "Protocol : route-map ");
+ vty_outln (vty, "------------------------");
for (i=0;i<ZEBRA_ROUTE_MAX;i++)
{
if (nht_rm[AFI_IP][i])
- vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
- nht_rm[AFI_IP][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", zebra_route_string(i),
+ nht_rm[AFI_IP][i]);
else
- vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", zebra_route_string(i));
}
if (nht_rm[AFI_IP][i])
- vty_out (vty, "%-10s : %-10s%s", "any", nht_rm[AFI_IP][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", "any",nht_rm[AFI_IP][i]);
else
- vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", "any");
return CMD_SUCCESS;
}
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
if (nht_rm[AFI_IP6][i])
i = proto_name2num(proto);
if (i < 0)
{
- vty_out (vty, "invalid protocol name \"%s\"%s", proto, VTY_NEWLINE);
+ vty_outln (vty, "invalid protocol name \"%s\"", proto);
return CMD_WARNING;
}
if (nht_rm[AFI_IP6][i] && rmap && strcmp(rmap, nht_rm[AFI_IP6][i]))
{
- vty_out (vty, "invalid route-map \"%s\"%s", rmap, VTY_NEWLINE);
+ vty_outln (vty, "invalid route-map \"%s\"", rmap);
return CMD_WARNING;
}
{
int i;
- vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
- vty_out(vty, "------------------------%s", VTY_NEWLINE);
+ vty_outln (vty, "Protocol : route-map ");
+ vty_outln (vty, "------------------------");
for (i=0;i<ZEBRA_ROUTE_MAX;i++)
{
if (nht_rm[AFI_IP6][i])
- vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
- nht_rm[AFI_IP6][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", zebra_route_string(i),
+ nht_rm[AFI_IP6][i]);
else
- vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", zebra_route_string(i));
}
if (nht_rm[AFI_IP][i])
- vty_out (vty, "%-10s : %-10s%s", "any", nht_rm[AFI_IP6][i],
- VTY_NEWLINE);
+ vty_outln (vty, "%-10s : %-10s", "any",nht_rm[AFI_IP6][i]);
else
- vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
+ vty_outln (vty, "%-10s : none", "any");
return CMD_SUCCESS;
}
zebra_route_map_write_delay_timer (struct vty *vty)
{
if (vty && (zebra_rmap_update_timer != ZEBRA_RMAP_DEFAULT_UPDATE_TIMER))
- vty_out (vty, "zebra route-map delay-timer %d%s", zebra_rmap_update_timer,
- VTY_NEWLINE);
+ vty_outln (vty, "zebra route-map delay-timer %d",
+ zebra_rmap_update_timer);
return;
}
for (i=0;i<ZEBRA_ROUTE_MAX;i++)
{
if (proto_rm[AFI_IP][i])
- vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i),
- proto_rm[AFI_IP][i], VTY_NEWLINE);
+ vty_outln (vty, "ip protocol %s route-map %s", zebra_route_string(i),
+ proto_rm[AFI_IP][i]);
if (proto_rm[AFI_IP6][i])
- vty_out (vty, "ipv6 protocol %s route-map %s%s", zebra_route_string(i),
- proto_rm[AFI_IP6][i], VTY_NEWLINE);
+ vty_outln (vty, "ipv6 protocol %s route-map %s", zebra_route_string(i),
+ proto_rm[AFI_IP6][i]);
if (nht_rm[AFI_IP][i])
- vty_out (vty, "ip nht %s route-map %s%s", zebra_route_string(i),
- nht_rm[AFI_IP][i], VTY_NEWLINE);
+ vty_outln (vty, "ip nht %s route-map %s", zebra_route_string(i),
+ nht_rm[AFI_IP][i]);
if (nht_rm[AFI_IP6][i])
- vty_out (vty, "ipv6 nht %s route-map %s%s", zebra_route_string(i),
- nht_rm[AFI_IP6][i], VTY_NEWLINE);
+ vty_outln (vty, "ipv6 nht %s route-map %s", zebra_route_string(i),
+ nht_rm[AFI_IP6][i]);
}
if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX])
- vty_out (vty, "ip protocol %s route-map %s%s", "any",
- proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
+ vty_outln (vty, "ip protocol %s route-map %s", "any",
+ proto_rm[AFI_IP][ZEBRA_ROUTE_MAX]);
if (proto_rm[AFI_IP6][ZEBRA_ROUTE_MAX])
- vty_out (vty, "ipv6 protocol %s route-map %s%s", "any",
- proto_rm[AFI_IP6][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
+ vty_outln (vty, "ipv6 protocol %s route-map %s", "any",
+ proto_rm[AFI_IP6][ZEBRA_ROUTE_MAX]);
if (nht_rm[AFI_IP][ZEBRA_ROUTE_MAX])
- vty_out (vty, "ip nht %s route-map %s%s", "any",
- nht_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
+ vty_outln (vty, "ip nht %s route-map %s", "any",
+ nht_rm[AFI_IP][ZEBRA_ROUTE_MAX]);
if (nht_rm[AFI_IP6][ZEBRA_ROUTE_MAX])
- vty_out (vty, "ipv6 nht %s route-map %s%s", "any",
- nht_rm[AFI_IP6][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
+ vty_outln (vty, "ipv6 nht %s route-map %s", "any",
+ nht_rm[AFI_IP6][ZEBRA_ROUTE_MAX]);
if (zebra_rmap_update_timer != ZEBRA_RMAP_DEFAULT_UPDATE_TIMER)
- vty_out (vty, "zebra route-map delay-timer %d%s", zebra_rmap_update_timer,
- VTY_NEWLINE);
+ vty_outln (vty, "zebra route-map delay-timer %d",
+ zebra_rmap_update_timer);
}
void
zvrf = vrf->info;
if (! zvrf || strcmp (zvrf_name (zvrf), VRF_DEFAULT_NAME))
{
- vty_out (vty, "vrf %s%s", zvrf_name (zvrf), VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "vrf %s", zvrf_name(zvrf));
+ vty_outln (vty, "!");
}
}
return 0;
ret = str2prefix (dest_str, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
ret = inet_aton (mask_str, &mask);
if (ret == 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
p.prefixlen = ip_masklen (mask);
/* tag */
if (tag_str)
- VTY_GET_INTEGER_RANGE("tag", tag, tag_str, 0, 4294967295);
+ tag = strtoul(tag_str, NULL, 10);
/* VRF id */
zvrf = zebra_vrf_lookup_by_name (vrf_id_str);
if (!zvrf)
{
- vty_out (vty, "%% vrf %s is not defined%s", vrf_id_str, VTY_NEWLINE);
+ vty_outln (vty, "%% vrf %s is not defined", vrf_id_str);
return CMD_WARNING;
}
{
if (!mpls_enabled)
{
- vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "%% MPLS not turned on in kernel, ignoring command");
return CMD_WARNING;
}
int rc = mpls_str2label (label_str, &snh_label.num_labels,
{
switch (rc) {
case -1:
- vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed label(s)");
break;
case -2:
- vty_out (vty, "%% Cannot use reserved label(s) (%d-%d)%s",
- MPLS_MIN_RESERVED_LABEL, MPLS_MAX_RESERVED_LABEL,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Cannot use reserved label(s) (%d-%d)",
+ MPLS_MIN_RESERVED_LABEL,MPLS_MAX_RESERVED_LABEL);
break;
case -3:
- vty_out (vty, "%% Too many labels. Enter %d or fewer%s",
- MPLS_MAX_LABELS, VTY_NEWLINE);
+ vty_outln (vty, "%% Too many labels. Enter %d or fewer",
+ MPLS_MAX_LABELS);
break;
}
return CMD_WARNING;
{
if (flag_str)
{
- vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% can not have flag %s with Null0", flag_str);
return CMD_WARNING;
}
if (add_cmd)
SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
break;
default:
- vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed flag %s ", flag_str);
return CMD_WARNING;
}
}
struct interface *ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp)
{
- vty_out (vty, "%% Unknown interface: %s%s", gate_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Unknown interface: %s", gate_str);
ifindex = IFINDEX_DELETED;
}
else
multicast_mode_ipv4_set (MCAST_MIX_PFXLEN);
else
{
- vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE);
+ vty_outln (vty, "Invalid mode specified");
return CMD_WARNING;
}
ret = inet_aton (argv[idx_ipv4]->arg, &addr);
if (ret == 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
if (re)
vty_show_ip_route_detail (vty, rn, 1);
else
- vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No match for RPF lookup");
return CMD_SUCCESS;
}
vty_out (vty, "Routing entry for %s%s%s",
srcdest_rnode2str(rn, buf, sizeof(buf)), mcast_info,
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, " Known via \"%s", zebra_route_string (re->type));
if (re->instance)
vty_out (vty, "[%d]", re->instance);
vty_out (vty, ", blackhole");
if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
vty_out (vty, ", reject");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
if (re->type == ZEBRA_ROUTE_RIP
|| re->type == ZEBRA_ROUTE_OSPF
vty_out (vty, "%02dw%dd%02dh",
tm->tm_yday/7,
tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
- vty_out (vty, " ago%s", VTY_NEWLINE);
+ vty_out (vty, " ago%s", VTYNL);
}
for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
nexthop->nh_label->label, buf, sizeof buf, 1));
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
tm->tm_yday/7,
tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
if (!(zvrf = zebra_vrf_lookup_by_name (vrf_name)))
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "vrf %s not defined%s", vrf_name, VTY_NEWLINE);
+ vty_outln (vty, "vrf %s not defined", vrf_name);
return CMD_SUCCESS;
}
if (zvrf_id (zvrf) == VRF_UNKNOWN)
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "vrf %s inactive%s", vrf_name, VTY_NEWLINE);
+ vty_outln (vty, "vrf %s inactive", vrf_name);
return CMD_SUCCESS;
}
if (! table)
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
return CMD_SUCCESS;
}
vty_out (vty, SHOW_ROUTE_V6_HEADER);
if (zvrf_id (zvrf) != VRF_DEFAULT)
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+ vty_outln (vty, "%sVRF %s:", VTYNL,
+ zvrf_name(zvrf));
first = 0;
}
if (use_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);
}
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if ((zvrf = vrf->info) != NULL)
{
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+ vty_outln (vty, "%sVRF %s:", VTYNL, zvrf_name(zvrf));
zebra_print_rnh_table(zvrf_id (zvrf), AF_INET, vty, RNH_NEXTHOP_TYPE);
}
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if ((zvrf = vrf->info) != NULL)
{
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+ vty_outln (vty, "%sVRF %s:", VTYNL, zvrf_name(zvrf));
zebra_print_rnh_table(zvrf_id (zvrf), AF_INET6, vty, RNH_NEXTHOP_TYPE);
}
}
if (argv_find (argv, argc, "tag", &idx))
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
+ tag = strtoul(argv[idx + 1]->arg, NULL, 10);
else if (argv_find (argv, argc, "A.B.C.D/M", &idx))
{
type = proto_redistnum (AFI_IP, argv[idx]->text);
if (argv_find (argv, argc, "(1-65535)", &idx))
- VTY_GET_INTEGER ("Instance", ospf_instance_id, argv[idx]->arg);
+ ospf_instance_id = strtoul(argv[idx]->arg, NULL, 10);
if (type < 0)
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ vty_outln (vty, "Unknown route type");
return CMD_WARNING;
}
}
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
rn = route_node_match (table, (struct prefix *) &p);
if (! rn)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
rn = route_node_match (table, (struct prefix *) &p);
if (! rn || rn->p.prefixlen != p.prefixlen)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
}
}
- vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
+ vty_outln (vty, "%-20s %-20s %s (vrf %s)",
"Route Source", "Routes", "FIB",
- zvrf_name (((rib_table_info_t *)table->info)->zvrf),
- VTY_NEWLINE);
+ zvrf_name(((rib_table_info_t *)table->info)->zvrf));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
{
{
if (i == ZEBRA_ROUTE_BGP)
{
- vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
- rib_cnt[ZEBRA_ROUTE_BGP], fib_cnt[ZEBRA_ROUTE_BGP],
- VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
- rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
- VTY_NEWLINE);
+ vty_outln (vty, "%-20s %-20d %-20d ", "ebgp",
+ rib_cnt[ZEBRA_ROUTE_BGP],fib_cnt[ZEBRA_ROUTE_BGP]);
+ vty_outln (vty, "%-20s %-20d %-20d ", "ibgp",
+ rib_cnt[ZEBRA_ROUTE_IBGP],fib_cnt[ZEBRA_ROUTE_IBGP]);
}
else
- vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
- rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
+ vty_outln (vty, "%-20s %-20d %-20d ", zebra_route_string(i),
+ rib_cnt[i], fib_cnt[i]);
}
}
- vty_out (vty, "------%s", VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
- fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "------");
+ vty_outln (vty, "%-20s %-20d %-20d ", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
+ fib_cnt[ZEBRA_ROUTE_TOTAL]);
+ vty_out (vty, VTYNL);
}
/*
}
}
- vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
+ vty_outln (vty, "%-20s %-20s %s (vrf %s)",
"Route Source", "Prefix Routes", "FIB",
- zvrf_name (((rib_table_info_t *)table->info)->zvrf),
- VTY_NEWLINE);
+ zvrf_name(((rib_table_info_t *)table->info)->zvrf));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
{
{
if (i == ZEBRA_ROUTE_BGP)
{
- vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
+ vty_outln (vty, "%-20s %-20d %-20d ", "ebgp",
rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
- fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
- VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
- rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
- VTY_NEWLINE);
+ fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP]);
+ vty_outln (vty, "%-20s %-20d %-20d ", "ibgp",
+ rib_cnt[ZEBRA_ROUTE_IBGP],fib_cnt[ZEBRA_ROUTE_IBGP]);
}
else
- vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
- rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
+ vty_outln (vty, "%-20s %-20d %-20d ", zebra_route_string(i),
+ rib_cnt[i], fib_cnt[i]);
}
}
- vty_out (vty, "------%s", VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
- fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "------");
+ vty_outln (vty, "%-20s %-20d %-20d ", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
+ fib_cnt[ZEBRA_ROUTE_TOTAL]);
+ vty_out (vty, VTYNL);
}
/* Show route summary. */
ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
mpls_label2str (si->snh_label.num_labels,
si->snh_label.label, buf, sizeof buf, 0));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
write = 1;
}
ret = str2prefix (dest_str, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
ret = str2prefix (src_str, &src);
if (ret <= 0 || src.family != AF_INET6)
{
- vty_out (vty, "%% Malformed source address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed source address");
return CMD_WARNING;
}
src_p = (struct prefix_ipv6*)&src;
/* tag */
if (tag_str)
- VTY_GET_INTEGER_RANGE("tag", tag, tag_str, 0, 4294967295);
+ tag = strtoul(tag_str, NULL, 10);
/* When gateway is valid IPv6 addrees, then gate is treated as
nexthop address other case gate is treated as interface name. */
if (!zvrf)
{
- vty_out (vty, "%% vrf %s is not defined%s", vrf_id_str, VTY_NEWLINE);
+ vty_outln (vty, "%% vrf %s is not defined", vrf_id_str);
return CMD_WARNING;
}
{
if (!mpls_enabled)
{
- vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "%% MPLS not turned on in kernel, ignoring command");
return CMD_WARNING;
}
int rc = mpls_str2label (label_str, &snh_label.num_labels,
{
switch (rc) {
case -1:
- vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed label(s)");
break;
case -2:
- vty_out (vty, "%% Cannot use reserved label(s) (%d-%d)%s",
- MPLS_MIN_RESERVED_LABEL, MPLS_MAX_RESERVED_LABEL,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Cannot use reserved label(s) (%d-%d)",
+ MPLS_MIN_RESERVED_LABEL,MPLS_MAX_RESERVED_LABEL);
break;
case -3:
- vty_out (vty, "%% Too many labels. Enter %d or fewer%s",
- MPLS_MAX_LABELS, VTY_NEWLINE);
+ vty_outln (vty, "%% Too many labels. Enter %d or fewer",
+ MPLS_MAX_LABELS);
break;
}
return CMD_WARNING;
{
if (flag_str)
{
- vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% can not have flag %s with Null0", flag_str);
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, ifname,
+ static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, tag,
+ static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, tag,
distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
break;
default:
- vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed flag %s ", flag_str);
return CMD_WARNING;
}
}
address. */
if (ret != 1)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
type = STATIC_IPV6_GATEWAY_IFINDEX;
ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
if (!ifp)
{
- vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Interface name %s", ifname);
return CMD_WARNING;
}
ifindex = ifp->ifindex;
ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp)
{
- vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Interface name %s", gate_str);
ifindex = IFINDEX_DELETED;
}
else
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6_ifname = 5;
"IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
- "Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6_ifname = 5;
int idx_curr = 5;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6 = 5;
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6 = 5;
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6_ifname = 6;
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6_ifname = 6;
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6 = 6;
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6 = 6;
}
if (argv_find (argv, argc, "tag", &idx))
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
+ tag = strtoul(argv[idx + 1]->arg, NULL, 10);
else if (argv_find (argv, argc, "X:X::X:X/M", &idx))
{
if (type < 0)
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ vty_outln (vty, "Unknown route type");
return CMD_WARNING;
}
}
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 address");
return CMD_WARNING;
}
rn = route_node_match (table, (struct prefix *) &p);
if (! rn)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 prefix");
return CMD_WARNING;
}
rn = route_node_match (table, (struct prefix *) &p);
if (! rn || rn->p.prefixlen != p.prefixlen)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
ret = str2prefix_ipv6 (argv[idx_ipv6]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 address");
return CMD_WARNING;
}
ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 prefix");
return CMD_WARNING;
}
vty_out (vty, "inactive");
else
vty_out (vty, "id %u table %u", zvrf_id (zvrf), zvrf->table_id);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
{
u_int32_t table_id = 0;
- VTY_GET_INTEGER("table", table_id, argv[2]->arg);
+ table_id = strtoul(argv[2]->arg, NULL, 10);
int distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
char *rmap = strmatch (argv[argc - 2]->text, "route-map") ?
XSTRDUP(MTYPE_ROUTE_MAP_NAME, argv[argc - 1]->arg) : NULL;
int ret;
if (argc == 7 || (argc == 5 && !rmap))
- VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255);
+ distance = strtoul(argv[4]->arg, NULL, 10);
if (!is_zebra_valid_kernel_table(table_id))
{
- vty_out(vty, "Invalid routing table ID, %d. Must be in range 1-252%s",
- table_id, VTY_NEWLINE);
+ vty_outln (vty, "Invalid routing table ID, %d. Must be in range 1-252",
+ table_id);
return CMD_WARNING;
}
if (is_zebra_main_routing_table(table_id))
{
- vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s",
- table_id, VTY_NEWLINE);
+ vty_outln (vty, "Invalid routing table ID, %d. Must be non-default table",
+ table_id);
return CMD_WARNING;
}
"route-map name\n")
{
u_int32_t table_id = 0;
- VTY_GET_INTEGER("table", table_id, argv[3]->arg);
+ table_id = strtoul(argv[3]->arg, NULL, 10);
if (!is_zebra_valid_kernel_table(table_id))
{
- vty_out(vty, "Invalid routing table ID. Must be in range 1-252%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Invalid routing table ID. Must be in range 1-252");
return CMD_WARNING;
}
if (is_zebra_main_routing_table(table_id))
{
- vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s",
- table_id, VTY_NEWLINE);
+ vty_outln (vty, "Invalid routing table ID, %d. Must be non-default table",
+ table_id);
return CMD_WARNING;
}
config_write_protocol (struct vty *vty)
{
if (allow_delete)
- vty_out(vty, "allow-external-route-update%s", VTY_NEWLINE);
+ vty_outln (vty, "allow-external-route-update");
if (zebra_rnh_ip_default_route)
- vty_out(vty, "ip nht resolve-via-default%s", VTY_NEWLINE);
+ vty_outln (vty, "ip nht resolve-via-default");
if (zebra_rnh_ipv6_default_route)
- vty_out(vty, "ipv6 nht resolve-via-default%s", VTY_NEWLINE);
+ vty_outln (vty, "ipv6 nht resolve-via-default");
enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get ();
if (ipv4_multicast_mode != MCAST_NO_CONFIG)
- vty_out (vty, "ip multicast rpf-lookup-mode %s%s",
- ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" :
- ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" :
- ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" :
- ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" :
- "longer-prefix",
- VTY_NEWLINE);
+ vty_outln (vty, "ip multicast rpf-lookup-mode %s",
+ ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" : ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" : ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" : ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" : "longer-prefix");
zebra_routemap_config_write_protocol(vty);
vty_out (vty, "Client: %s", zebra_route_string(client->proto));
if (client->instance)
vty_out (vty, " Instance: %d", client->instance);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
- vty_out (vty, "------------------------ %s", VTY_NEWLINE);
- vty_out (vty, "FD: %d %s", client->sock, VTY_NEWLINE);
- vty_out (vty, "Route Table ID: %d %s", client->rtm_table, VTY_NEWLINE);
+ vty_outln (vty, "------------------------ ");
+ vty_outln (vty, "FD: %d ", client->sock);
+ vty_outln (vty, "Route Table ID: %d ", client->rtm_table);
- vty_out (vty, "Connect Time: %s %s",
- zserv_time_buf(&client->connect_time, cbuf, ZEBRA_TIME_BUF),
- VTY_NEWLINE);
+ vty_outln (vty, "Connect Time: %s ",
+ zserv_time_buf(&client->connect_time, cbuf, ZEBRA_TIME_BUF));
if (client->nh_reg_time)
{
- vty_out (vty, "Nexthop Registry Time: %s %s",
- zserv_time_buf(&client->nh_reg_time, nhbuf, ZEBRA_TIME_BUF),
- VTY_NEWLINE);
+ vty_outln (vty, "Nexthop Registry Time: %s ",
+ zserv_time_buf(&client->nh_reg_time, nhbuf, ZEBRA_TIME_BUF));
if (client->nh_last_upd_time)
- vty_out (vty, "Nexthop Last Update Time: %s %s",
- zserv_time_buf(&client->nh_last_upd_time, mbuf, ZEBRA_TIME_BUF),
- VTY_NEWLINE);
- else
- vty_out (vty, "No Nexthop Update sent%s", VTY_NEWLINE);
+ vty_outln (vty, "Nexthop Last Update Time: %s ",
+ zserv_time_buf(&client->nh_last_upd_time, mbuf, ZEBRA_TIME_BUF));
+ else
+ vty_outln (vty, "No Nexthop Update sent");
}
else
- vty_out (vty, "Not registered for Nexthop Updates%s", VTY_NEWLINE);
+ vty_outln (vty, "Not registered for Nexthop Updates");
- vty_out (vty, "Last Msg Rx Time: %s %s",
- zserv_time_buf(&client->last_read_time, rbuf, ZEBRA_TIME_BUF),
- VTY_NEWLINE);
- vty_out (vty, "Last Msg Tx Time: %s %s",
- zserv_time_buf(&client->last_write_time, wbuf, ZEBRA_TIME_BUF),
- VTY_NEWLINE);
+ vty_outln (vty, "Last Msg Rx Time: %s ",
+ zserv_time_buf(&client->last_read_time, rbuf, ZEBRA_TIME_BUF));
+ vty_outln (vty, "Last Msg Tx Time: %s ",
+ zserv_time_buf(&client->last_write_time, wbuf, ZEBRA_TIME_BUF));
if (client->last_read_time)
- vty_out (vty, "Last Rcvd Cmd: %s %s",
- zserv_command_string(client->last_read_cmd), VTY_NEWLINE);
+ vty_outln (vty, "Last Rcvd Cmd: %s ",
+ zserv_command_string(client->last_read_cmd));
if (client->last_write_time)
- vty_out (vty, "Last Sent Cmd: %s %s",
- zserv_command_string(client->last_write_cmd), VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
-
- vty_out (vty, "Type Add Update Del %s", VTY_NEWLINE);
- vty_out (vty, "================================================== %s", VTY_NEWLINE);
- vty_out (vty, "IPv4 %-12d%-12d%-12d%s", client->v4_route_add_cnt,
- client->v4_route_upd8_cnt, client->v4_route_del_cnt, VTY_NEWLINE);
- vty_out (vty, "IPv6 %-12d%-12d%-12d%s", client->v6_route_add_cnt,
- client->v6_route_upd8_cnt, client->v6_route_del_cnt, VTY_NEWLINE);
- vty_out (vty, "Redist:v4 %-12d%-12d%-12d%s", client->redist_v4_add_cnt, 0,
- client->redist_v4_del_cnt, VTY_NEWLINE);
- vty_out (vty, "Redist:v6 %-12d%-12d%-12d%s", client->redist_v6_add_cnt, 0,
- client->redist_v6_del_cnt, VTY_NEWLINE);
- vty_out (vty, "Connected %-12d%-12d%-12d%s", client->ifadd_cnt, 0,
- client->ifdel_cnt, VTY_NEWLINE);
- vty_out (vty, "BFD peer %-12d%-12d%-12d%s", client->bfd_peer_add_cnt,
- client->bfd_peer_upd8_cnt, client->bfd_peer_del_cnt, VTY_NEWLINE);
- vty_out (vty, "Interface Up Notifications: %d%s", client->ifup_cnt,
- VTY_NEWLINE);
- vty_out (vty, "Interface Down Notifications: %d%s", client->ifdown_cnt,
- VTY_NEWLINE);
-
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "Last Sent Cmd: %s ",
+ zserv_command_string(client->last_write_cmd));
+ vty_out (vty, VTYNL);
+
+ vty_outln (vty, "Type Add Update Del ");
+ vty_outln (vty, "================================================== ");
+ vty_outln (vty, "IPv4 %-12d%-12d%-12d", client->v4_route_add_cnt,
+ client->v4_route_upd8_cnt, client->v4_route_del_cnt);
+ vty_outln (vty, "IPv6 %-12d%-12d%-12d", client->v6_route_add_cnt,
+ client->v6_route_upd8_cnt, client->v6_route_del_cnt);
+ vty_outln (vty, "Redist:v4 %-12d%-12d%-12d", client->redist_v4_add_cnt, 0,
+ client->redist_v4_del_cnt);
+ vty_outln (vty, "Redist:v6 %-12d%-12d%-12d", client->redist_v6_add_cnt, 0,
+ client->redist_v6_del_cnt);
+ vty_outln (vty, "Connected %-12d%-12d%-12d", client->ifadd_cnt, 0,
+ client->ifdel_cnt);
+ vty_outln (vty, "BFD peer %-12d%-12d%-12d", client->bfd_peer_add_cnt,
+ client->bfd_peer_upd8_cnt, client->bfd_peer_del_cnt);
+ vty_outln (vty, "Interface Up Notifications: %d",client->ifup_cnt);
+ vty_outln (vty, "Interface Down Notifications: %d",client->ifdown_cnt);
+
+ vty_out (vty, VTYNL);
return;
}
char cbuf[ZEBRA_TIME_BUF], rbuf[ZEBRA_TIME_BUF];
char wbuf[ZEBRA_TIME_BUF];
- vty_out (vty, "%-8s%12s %12s%12s%8d/%-8d%8d/%-8d%s",
+ vty_outln (vty, "%-8s%12s %12s%12s%8d/%-8d%8d/%-8d",
zebra_route_string(client->proto),
zserv_time_buf(&client->connect_time, cbuf, ZEBRA_TIME_BUF),
zserv_time_buf(&client->last_read_time, rbuf, ZEBRA_TIME_BUF),
client->v4_route_add_cnt+client->v4_route_upd8_cnt,
client->v4_route_del_cnt,
client->v6_route_add_cnt+client->v6_route_upd8_cnt,
- client->v6_route_del_cnt, VTY_NEWLINE);
+ client->v6_route_del_cnt);
}
SHOW_STR
"default routing table to use for all clients\n")
{
- vty_out (vty, "table %d%s", zebrad.rtm_table_default,
- VTY_NEWLINE);
+ vty_outln (vty, "table %d",zebrad.rtm_table_default);
return CMD_SUCCESS;
}
if (ret == 0)
{
- vty_out (vty, "Can't turn on IP forwarding%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't turn on IP forwarding");
return CMD_WARNING;
}
if (ret != 0)
{
- vty_out (vty, "Can't turn off IP forwarding%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't turn off IP forwarding");
return CMD_WARNING;
}
{
struct vrf *vrf;
- vty_out (vty, " Route Route Neighbor LSP LSP%s", VTY_NEWLINE);
- vty_out (vty, "VRF Installs Removals Updates Installs Removals%s", VTY_NEWLINE);
+ vty_outln (vty,
+ " Route Route Neighbor LSP LSP");
+ vty_outln (vty,
+ "VRF Installs Removals Updates Installs Removals");
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
struct zebra_vrf *zvrf = vrf->info;
- vty_out (vty,"%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "%s",
+ vty_outln (vty,"%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "",
vrf->name, zvrf->installs, zvrf->removals,
- zvrf->neigh_updates, zvrf->lsp_installs, zvrf->lsp_removals,
- VTY_NEWLINE);
+ zvrf->neigh_updates, zvrf->lsp_installs,zvrf->lsp_removals);
}
return CMD_SUCCESS;
struct listnode *node;
struct zserv *client;
- vty_out (vty, "Name Connect Time Last Read Last Write IPv4 Routes IPv6 Routes %s",
- VTY_NEWLINE);
- vty_out (vty,"--------------------------------------------------------------------------------%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "Name Connect Time Last Read Last Write IPv4 Routes IPv6 Routes ");
+ vty_outln (vty,
+ "--------------------------------------------------------------------------------");
for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client))
zebra_show_client_brief(vty, client);
- vty_out (vty, "Routes column shows (added+updated)/deleted%s", VTY_NEWLINE);
+ vty_outln (vty, "Routes column shows (added+updated)/deleted");
return CMD_SUCCESS;
}
config_write_table (struct vty *vty)
{
if (zebrad.rtm_table_default)
- vty_out (vty, "table %d%s", zebrad.rtm_table_default,
- VTY_NEWLINE);
+ vty_outln (vty, "table %d",zebrad.rtm_table_default);
return 0;
}
ret = ipforward ();
if (ret == 0)
- vty_out (vty, "IP forwarding is off%s", VTY_NEWLINE);
+ vty_outln (vty, "IP forwarding is off");
else
- vty_out (vty, "IP forwarding is on%s", VTY_NEWLINE);
+ vty_outln (vty, "IP forwarding is on");
return CMD_SUCCESS;
}
switch (ret)
{
case -1:
- vty_out (vty, "ipv6 forwarding is unknown%s", VTY_NEWLINE);
+ vty_outln (vty, "ipv6 forwarding is unknown");
break;
case 0:
- vty_out (vty, "ipv6 forwarding is %s%s", "off", VTY_NEWLINE);
+ vty_outln (vty, "ipv6 forwarding is %s", "off");
break;
case 1:
- vty_out (vty, "ipv6 forwarding is %s%s", "on", VTY_NEWLINE);
+ vty_outln (vty, "ipv6 forwarding is %s", "on");
break;
default:
- vty_out (vty, "ipv6 forwarding is %s%s", "off", VTY_NEWLINE);
+ vty_outln (vty, "ipv6 forwarding is %s", "off");
break;
}
return CMD_SUCCESS;
if (ret == 0)
{
- vty_out (vty, "Can't turn on IPv6 forwarding%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't turn on IPv6 forwarding");
return CMD_WARNING;
}
if (ret != 0)
{
- vty_out (vty, "Can't turn off IPv6 forwarding%s", VTY_NEWLINE);
+ vty_outln (vty, "Can't turn off IPv6 forwarding");
return CMD_WARNING;
}
router_id_write (vty);
if (!ipforward ())
- vty_out (vty, "no ip forwarding%s", VTY_NEWLINE);
+ vty_outln (vty, "no ip forwarding");
if (!ipforward_ipv6 ())
- vty_out (vty, "no ipv6 forwarding%s", VTY_NEWLINE);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "no ipv6 forwarding");
+ vty_outln (vty, "!");
return 0;
}