diff options
Diffstat (limited to 'zebra/rtadv.c')
| -rw-r--r-- | zebra/rtadv.c | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 5b0b44572f..677189751d 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -877,7 +877,8 @@ DEFUN (ipv6_nd_suppress_ra, 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; } @@ -900,7 +901,8 @@ DEFUN (no_ipv6_nd_suppress_ra, 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; } @@ -926,10 +928,11 @@ DEFUN (ipv6_nd_ra_interval_msec, 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; } @@ -962,10 +965,11 @@ DEFUN (ipv6_nd_ra_interval, 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; } @@ -1024,7 +1028,7 @@ DEFUN (ipv6_nd_ra_lifetime, 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, @@ -1032,7 +1036,8 @@ DEFUN (ipv6_nd_ra_lifetime, * 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; } @@ -1069,7 +1074,7 @@ DEFUN (ipv6_nd_reachable_time, 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; } @@ -1101,7 +1106,7 @@ DEFUN (ipv6_nd_homeagent_preference, 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; } @@ -1133,7 +1138,7 @@ DEFUN (ipv6_nd_homeagent_lifetime, 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; } @@ -1328,7 +1333,7 @@ DEFUN (ipv6_nd_prefix, 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 */ @@ -1344,7 +1349,7 @@ DEFUN (ipv6_nd_prefix, 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; } } @@ -1381,7 +1386,7 @@ DEFUN (no_ipv6_nd_prefix, 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 */ @@ -1389,7 +1394,7 @@ DEFUN (no_ipv6_nd_prefix, 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; } @@ -1454,7 +1459,7 @@ DEFUN (ipv6_nd_mtu, 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; } @@ -1490,53 +1495,49 @@ rtadv_config_write (struct vty *vty, struct interface *ifp) 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)) { @@ -1560,7 +1561,7 @@ rtadv_config_write (struct vty *vty, struct interface *ifp) vty_out (vty, " no-autoconfig"); if (rprefix->AdvRouterAddressFlag) vty_out (vty, " router-address"); - vty_out (vty, "%s", VTY_NEWLINE); + vty_out (vty, VTYNL); } } |
