summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-06-30 17:52:56 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-06-30 17:52:56 +0000
commit1161690b93b48fbd07f4ee25c1261574db8d71c5 (patch)
tree7ffbe5c3b333b1fe0b8a3f042d8b1af602d48019 /zebra/interface.c
parentab782c96f881b1fdd59f52ba972cd82b5eeadc66 (diff)
parent5fca4e3635c2778e8349bce0eaf944c26913d321 (diff)
Merge branch 'master' of https://github.com/dwalton76/frr into bgpd-ipv4-plus-label-misc3
Conflicts: bgpd/bgp_route.c
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c420
1 files changed, 201 insertions, 219 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 9393305f06..b8426c6890 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -737,7 +737,7 @@ if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id)
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. */
@@ -944,7 +944,7 @@ connected_dump_vty (struct vty *vty, struct connected *connected)
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. */
@@ -959,7 +959,7 @@ nbr_connected_dump_vty (struct vty *vty, struct nbr_connected *connected)
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)
@@ -976,53 +976,46 @@ nd_dump_vty (struct vty *vty, struct interface *ifp)
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 */
@@ -1046,39 +1039,37 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
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;
}
@@ -1086,11 +1077,11 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
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;
@@ -1098,14 +1089,14 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
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))
@@ -1128,22 +1119,23 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
{
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);
@@ -1152,20 +1144,22 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
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
@@ -1175,86 +1169,83 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
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 */
}
@@ -1349,8 +1340,7 @@ DEFUN (show_interface_name_vrf,
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);
@@ -1388,7 +1378,7 @@ DEFUN (show_interface_name_vrf_all,
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;
}
@@ -1402,7 +1392,7 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id)
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;
@@ -1432,7 +1422,7 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id)
if (ifp->desc)
vty_out (vty, "%s", ifp->desc);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
}
@@ -1468,8 +1458,8 @@ DEFUN (show_interface_desc_vrf_all,
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);
}
@@ -1490,7 +1480,7 @@ DEFUN (multicast,
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);
@@ -1516,7 +1506,7 @@ DEFUN (no_multicast,
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);
@@ -1582,7 +1572,7 @@ DEFUN (shutdown_if,
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);
@@ -1608,7 +1598,7 @@ DEFUN (no_shutdown_if,
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);
@@ -1640,7 +1630,7 @@ DEFUN (bandwidth_if,
/* 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;
}
@@ -1806,7 +1796,7 @@ DEFUN (link_params_metric,
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);
@@ -1842,8 +1832,7 @@ DEFUN (link_params_maxbw,
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;
}
@@ -1861,9 +1850,8 @@ DEFUN (link_params_maxbw,
|| (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;
}
@@ -1886,17 +1874,17 @@ DEFUN (link_params_max_rsv_bw,
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;
}
@@ -1923,24 +1911,24 @@ DEFUN (link_params_unrsv_bw,
/* 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;
}
@@ -1963,8 +1951,8 @@ DEFUN (link_params_admin_grp,
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;
}
@@ -2007,11 +1995,11 @@ DEFUN (link_params_inter_as,
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)
@@ -2064,11 +2052,11 @@ DEFUN (link_params_delay,
{
/* 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);
@@ -2081,8 +2069,8 @@ DEFUN (link_params_delay,
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 */
@@ -2106,8 +2094,8 @@ DEFUN (link_params_delay,
/* 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 */
@@ -2167,7 +2155,7 @@ DEFUN (link_params_delay_var,
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);
@@ -2202,8 +2190,8 @@ DEFUN (link_params_pkt_loss,
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;
}
@@ -2243,17 +2231,16 @@ DEFUN (link_params_res_bw,
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;
}
@@ -2290,17 +2277,16 @@ DEFUN (link_params_ava_bw,
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;
}
@@ -2337,17 +2323,16 @@ DEFUN (link_params_use_bw,
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;
}
@@ -2387,13 +2372,13 @@ ip_address_install (struct vty *vty, struct interface *ifp,
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;
}
@@ -2444,8 +2429,8 @@ ip_address_install (struct vty *vty, struct interface *ifp,
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;
}
@@ -2471,7 +2456,7 @@ ip_address_uninstall (struct vty *vty, struct interface *ifp,
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;
}
@@ -2479,7 +2464,7 @@ ip_address_uninstall (struct vty *vty, struct interface *ifp,
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;
}
@@ -2502,8 +2487,8 @@ ip_address_uninstall (struct vty *vty, struct interface *ifp,
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);
@@ -2587,13 +2572,13 @@ ipv6_address_install (struct vty *vty, struct interface *ifp,
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;
}
@@ -2640,8 +2625,8 @@ ipv6_address_install (struct vty *vty, struct interface *ifp,
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;
}
@@ -2680,7 +2665,7 @@ ipv6_address_uninstall (struct vty *vty, struct interface *ifp,
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;
}
@@ -2688,7 +2673,7 @@ ipv6_address_uninstall (struct vty *vty, struct interface *ifp,
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;
}
@@ -2711,8 +2696,8 @@ ipv6_address_uninstall (struct vty *vty, struct interface *ifp,
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;
}
@@ -2757,23 +2742,23 @@ link_params_config_write (struct vty *vty, struct interface *ifp)
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);
@@ -2782,22 +2767,22 @@ link_params_config_write (struct vty *vty, struct interface *ifp)
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;
}
@@ -2823,30 +2808,28 @@ if_config_write (struct vty *vty)
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))
{
@@ -2861,16 +2844,15 @@ if_config_write (struct vty *vty)
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)
@@ -2883,7 +2865,7 @@ if_config_write (struct vty *vty)
link_params_config_write (vty, ifp);
- vty_out (vty, "!%s", VTY_NEWLINE);
+ vty_outln (vty, "!");
}
return 0;
}