## Process this file with automake to produce Makefile.in.
-AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
+AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
+ -DVTY_DEPRECATE_INDEX
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
"Interface's name\n")
{
int ret;
- struct interface *ifp;
-
+
/* Call lib interface() */
if ((ret = interface_cmd.func (self, vty, argc, argv)) != CMD_SUCCESS)
return ret;
- ifp = vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
if (ifp->ifindex == IFINDEX_INTERNAL)
/* Is this really necessary? Shouldn't status be initialized to 0
"Select a VRF to configure\n"
"VRF's name\n")
{
+ // VTY_DECLVAR_CONTEXT (vrf, vrfp);
int ret;
/* Call lib vrf() */
if ((ret = vrf_cmd.func (self, vty, argc, argv)) != CMD_SUCCESS)
return ret;
- // vrfp = vty->index;
-
return ret;
}
"multicast",
"Set multicast flag to interface\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int ret;
- struct interface *ifp;
struct zebra_if *if_data;
- ifp = (struct interface *) vty->index;
if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
ret = if_set_flags (ifp, IFF_MULTICAST);
NO_STR
"Unset multicast flag to interface\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int ret;
- struct interface *ifp;
struct zebra_if *if_data;
- ifp = (struct interface *) vty->index;
if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
ret = if_unset_flags (ifp, IFF_MULTICAST);
"link-detect",
"Enable link detection on interface\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int if_was_operative;
-
- ifp = (struct interface *) vty->index;
+
if_was_operative = if_is_no_ptm_operative(ifp);
SET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
NO_STR
"Disable link detection on interface\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int if_was_operative;
- ifp = (struct interface *) vty->index;
if_was_operative = if_is_no_ptm_operative(ifp);
UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
"shutdown",
"Shutdown the selected interface\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int ret;
- struct interface *ifp;
struct zebra_if *if_data;
- ifp = (struct interface *) vty->index;
if (ifp->ifindex != IFINDEX_INTERNAL)
{
ret = if_unset_flags (ifp, IFF_UP);
NO_STR
"Shutdown the selected interface\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int ret;
- struct interface *ifp;
struct zebra_if *if_data;
- ifp = (struct interface *) vty->index;
-
if (ifp->ifindex != IFINDEX_INTERNAL)
{
ret = if_set_flags (ifp, IFF_UP | IFF_RUNNING);
"Set bandwidth informational parameter\n"
"Bandwidth in megabits\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
unsigned int bandwidth;
-
- ifp = (struct interface *) vty->index;
+
bandwidth = strtol(argv[0], NULL, 10);
/* bandwidth range is <1-100000> */
NO_STR
"Set bandwidth informational parameter\n")
{
- struct interface *ifp;
-
- ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
ifp->bandwidth = 0;
"link-params",
LINK_PARAMS_STR)
{
+ /* vty->qobj_index stays the same @ interface pointer */
vty->node = LINK_PARAMS_NODE;
return CMD_SUCCESS;
"enable",
"Activate link parameters on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* This command could be issue at startup, when activate MPLS TE */
/* on a new interface or after a ON / OFF / ON toggle */
NO_STR
"Disable link parameters on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
zlog_debug ("MPLS-TE: disable TE link parameters on interface %s", ifp->name);
"Link metric for MPLS-TE purpose\n"
"Metric value in decimal\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t metric;
no_link_params_metric_cmd,
"no metric",
NO_STR
- "Disbale Link Metric on this interface\n")
+ "Disable Link Metric on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset TE Metric */
link_param_cmd_unset(ifp, LP_TE);
"Maximum bandwidth that can be used\n"
"Bytes/second (IEEE floating point format)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
"Maximum bandwidth that may be reserved\n"
"Bytes/second (IEEE floating point format)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
"Priority\n"
"Bytes/second (IEEE floating point format)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
int priority;
float bw;
"Administrative group membership\n"
"32-bit Hexadecimal value (e.g. 0xa1)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
unsigned long value;
no_link_params_admin_grp_cmd,
"no admin-grp",
NO_STR
- "Disbale Administrative group membership on this interface\n")
+ "Disable Administrative group membership on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset Admin Group */
link_param_cmd_unset(ifp, LP_ADM_GRP);
"Remote AS number\n"
"AS number in the range <1-4294967295>\n")
{
-
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
struct in_addr addr;
u_int32_t as;
NO_STR
"Remove Neighbor IP address and AS number for Inter-AS TE\n")
{
-
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
/* Reset Remote IP and AS neighbor */
"Unidirectional Average Link Delay\n"
"Average delay in micro-second as decimal (0...16777215)\n")
{
-
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t delay = 0, low = 0, high = 0;
u_int8_t update = 0;
no_link_params_delay_cmd,
"no delay",
NO_STR
- "Disbale Unidirectional Average, Min & Max Link Delay on this interface\n")
+ "Disable Unidirectional Average, Min & Max Link Delay on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
/* Unset Delays */
"Unidirectional Link Delay Variation\n"
"delay variation in micro-second as decimal (0...16777215)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
u_int32_t value;
no_link_params_delay_var_cmd,
"no delay-variation",
NO_STR
- "Disbale Unidirectional Delay Variation on this interface\n")
+ "Disable Unidirectional Delay Variation on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset Delay Variation */
link_param_cmd_unset(ifp, LP_DELAY_VAR);
"Unidirectional Link Packet Loss\n"
"percentage of total traffic by 0.000003% step and less than 50.331642%\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float fval;
no_link_params_pkt_loss_cmd,
"no packet-loss",
NO_STR
- "Disbale Unidirectional Link Packet Loss on this interface\n")
+ "Disable Unidirectional Link Packet Loss on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset Packet Loss */
link_param_cmd_unset(ifp, LP_PKT_LOSS);
"Unidirectional Residual Bandwidth\n"
"Bytes/second (IEEE floating point format)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
no_link_params_res_bw_cmd,
"no res-bw",
NO_STR
- "Disbale Unidirectional Residual Bandwidth on this interface\n")
+ "Disable Unidirectional Residual Bandwidth on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset Residual Bandwidth */
link_param_cmd_unset(ifp, LP_RES_BW);
"Unidirectional Available Bandwidth\n"
"Bytes/second (IEEE floating point format)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
no_link_params_ava_bw_cmd,
"no ava-bw",
NO_STR
- "Disbale Unidirectional Available Bandwidth on this interface\n")
+ "Disable Unidirectional Available Bandwidth on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset Available Bandwidth */
link_param_cmd_unset(ifp, LP_AVA_BW);
"Unidirectional Utilised Bandwidth\n"
"Bytes/second (IEEE floating point format)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct if_link_params *iflp = if_link_params_get (ifp);
float bw;
no_link_params_use_bw_cmd,
"no use-bw",
NO_STR
- "Disbale Unidirectional Utilised Bandwidth on this interface\n")
+ "Disable Unidirectional Utilised Bandwidth on this interface\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
/* Unset Utilised Bandwidth */
link_param_cmd_unset(ifp, LP_USE_BW);
"Set the IP address of an interface\n"
"IP address (e.g. 10.0.0.1/8)\n")
{
- return ip_address_install (vty, vty->index, argv[0], NULL, NULL);
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ return ip_address_install (vty, ifp, argv[0], NULL, NULL);
}
DEFUN (no_ip_address,
"Set the IP address of an interface\n"
"IP Address (e.g. 10.0.0.1/8)")
{
- return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL);
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ return ip_address_uninstall (vty, ifp, argv[0], NULL, NULL);
}
"Label of this address\n"
"Label\n")
{
- return ip_address_install (vty, vty->index, argv[0], NULL, argv[1]);
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ return ip_address_install (vty, ifp, argv[0], NULL, argv[1]);
}
DEFUN (no_ip_address_label,
"Label of this address\n"
"Label\n")
{
- return ip_address_uninstall (vty, vty->index, argv[0], NULL, argv[1]);
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ return ip_address_uninstall (vty, ifp, argv[0], NULL, argv[1]);
}
#endif /* HAVE_NETLINK */
"Set the IP address of an interface\n"
"IPv6 address (e.g. 3ffe:506::1/48)\n")
{
- return ipv6_address_install (vty, vty->index, argv[0], NULL, NULL, 0);
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ return ipv6_address_install (vty, ifp, argv[0], NULL, NULL, 0);
}
DEFUN (no_ipv6_address,
"Set the IP address of an interface\n"
"IPv6 address (e.g. 3ffe:506::1/48)\n")
{
- return ipv6_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 0);
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ return ipv6_address_uninstall (vty, ifp, argv[0], NULL, NULL, 0);
}
#endif /* HAVE_IPV6 */
IP_STR
"ICMP Router discovery on this interface using multicast\n")
{
- struct interface *ifp;
-
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
+ VTY_DECLVAR_CONTEXT (interface, ifp);
irdp_if_start(ifp, TRUE, TRUE);
return CMD_SUCCESS;
IP_STR
"ICMP Router discovery on this interface using broadcast\n")
{
- struct interface *ifp;
-
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
+ VTY_DECLVAR_CONTEXT (interface, ifp);
irdp_if_start(ifp, FALSE, TRUE);
return CMD_SUCCESS;
IP_STR
"Disable ICMP Router discovery on this interface\n")
{
- struct interface *ifp;
-
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
+ VTY_DECLVAR_CONTEXT (interface, ifp);
irdp_if_stop(ifp);
return CMD_SUCCESS;
IP_STR
"ICMP Router discovery shutdown on this interface\n")
{
- struct interface *ifp;
-
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
+ VTY_DECLVAR_CONTEXT (interface, ifp);
irdp_if_shutdown(ifp);
return CMD_SUCCESS;
IP_STR
"ICMP Router discovery no shutdown on this interface\n")
{
- struct interface *ifp;
-
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
+ VTY_DECLVAR_CONTEXT (interface, ifp);
irdp_if_no_shutdown(ifp);
return CMD_SUCCESS;
"Set holdtime value\n"
"Holdtime value in seconds. Default is 1800 seconds\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
"Set minimum time between advertisement\n"
"Minimum advertisement interval in seconds\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
"Set maximum time between advertisement\n"
"Maximum advertisement interval in seconds\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
"Set default preference level for this interface\n"
"Preference level\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
"Set IRDP address for advertise\n"
"Preference level\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct listnode *node;
struct in_addr ip;
int pref;
int ret;
- struct interface *ifp;
struct zebra_if *zi;
struct irdp_interface *irdp;
struct Adv *adv;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
-
zi=ifp->info;
irdp=&zi->irdp;
"Select IRDP address\n"
"Old preference level\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct listnode *node, *nnode;
struct in_addr ip;
int ret;
- struct interface *ifp;
struct zebra_if *zi;
struct irdp_interface *irdp;
struct Adv *adv;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
-
zi=ifp->info;
irdp=&zi->irdp;
IP_STR
"ICMP Router discovery debug Averts. and Solicits (short)\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
IP_STR
"ICMP Router discovery debug Averts. and Solicits (short)\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
IP_STR
"ICMP Router discovery debug Averts. and Solicits (short)\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
IP_STR
"ICMP Router discovery debug Averts. and Solicits (short)\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zi;
struct irdp_interface *irdp;
- ifp = (struct interface *) vty->index;
- if(!ifp) {
- return CMD_WARNING;
- }
zi=ifp->info;
irdp=&zi->irdp;
/* Vty related initialize. */
signal_init (zebrad.master, array_size(zebra_signals), zebra_signals);
cmd_init (1);
+ vty_config_lockless ();
vty_init (zebrad.master);
memory_init ();
"Neighbor discovery\n"
"Suppress Router Advertisement\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
if (if_is_loopback (ifp) ||
CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK))
}
ipv6_nd_suppress_ra_set (ifp, RA_SUPPRESS);
- zif = ifp->info;
zif->rtadv.configured = 0;
return CMD_SUCCESS;
}
"Neighbor discovery\n"
"Suppress Router Advertisement\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
if (if_is_loopback (ifp) ||
CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK))
}
ipv6_nd_suppress_ra_set (ifp, RA_ENABLE);
- zif = ifp->info;
zif->rtadv.configured = 1;
return CMD_SUCCESS;
}
"Router Advertisement interval\n"
"Router Advertisement interval in milliseconds\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
unsigned interval;
- struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
struct zebra_vrf *zvrf = vrf_info_lookup (ifp->vrf_id);
struct zebra_ns *zns;
"Router Advertisement interval\n"
"Router Advertisement interval in seconds\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
unsigned interval;
- struct interface *ifp = (struct interface *) vty->index;
struct zebra_if *zif = ifp->info;
struct zebra_vrf *zvrf = vrf_info_lookup (ifp->vrf_id);
struct zebra_ns *zns;
"Neighbor discovery\n"
"Router Advertisement interval\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
struct zebra_vrf *zvrf;
struct zebra_ns *zns;
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
zvrf = vrf_info_lookup (ifp->vrf_id);
zns = zvrf->zns;
"Router lifetime\n"
"Router lifetime in seconds (0 stands for a non-default gw)\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
int lifetime;
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0], 0, 9000);
"Neighbor discovery\n"
"Router lifetime\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvDefaultLifetime = -1;
"Reachable time\n"
"Reachable time in milliseconds\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0], 1, RTADV_MAX_REACHABLE_TIME);
return CMD_SUCCESS;
"Neighbor discovery\n"
"Reachable time\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvReachableTime = 0;
"Home Agent preference\n"
"preference value (default is 0, least preferred)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0], 0, 65535);
return CMD_SUCCESS;
"Neighbor discovery\n"
"Home Agent preference\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.HomeAgentPreference = 0;
"Home Agent lifetime\n"
"Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0], 0, RTADV_MAX_HALIFETIME);
return CMD_SUCCESS;
"Neighbor discovery\n"
"Home Agent lifetime\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.HomeAgentLifetime = -1;
"Neighbor discovery\n"
"Managed address configuration flag\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvManagedFlag = 1;
"Neighbor discovery\n"
"Managed address configuration flag\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvManagedFlag = 0;
"Neighbor discovery\n"
"Home Agent configuration flag\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvHomeAgentFlag = 1;
"Neighbor discovery\n"
"Home Agent configuration flag\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvHomeAgentFlag = 0;
"Neighbor discovery\n"
"Advertisement Interval Option\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvIntervalOption = 1;
"Neighbor discovery\n"
"Advertisement Interval Option\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvIntervalOption = 0;
"Neighbor discovery\n"
"Other statefull configuration flag\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvOtherConfigFlag = 1;
"Neighbor discovery\n"
"Other statefull configuration flag\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.AdvOtherConfigFlag = 0;
"Do not use prefix for autoconfiguration\n"
"Set Router Address flag\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zebra_if = ifp->info;
int i;
int ret;
int cursor = 1;
- struct interface *ifp;
- struct zebra_if *zebra_if;
struct rtadv_prefix rp;
- ifp = (struct interface *) vty->index;
- zebra_if = ifp->info;
-
ret = str2prefix_ipv6 (argv[0], &rp.prefix);
if (!ret)
{
"Prefix information\n"
"IPv6 prefix\n")
{
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zebra_if = ifp->info;
int ret;
- struct interface *ifp;
- struct zebra_if *zebra_if;
struct rtadv_prefix rp;
- ifp = (struct interface *) vty->index;
- zebra_if = ifp->info;
-
ret = str2prefix_ipv6 (argv[0], &rp.prefix);
if (!ret)
{
"Low default router preference\n"
"Medium default router preference (default)\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
int i = 0;
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
-
while (0 != rtadv_pref_strs[i])
{
if (strncmp (argv[0], rtadv_pref_strs[i], 1) == 0)
"Neighbor discovery\n"
"Default router preference\n")
{
- struct interface *ifp;
- struct zebra_if *zif;
-
- ifp = (struct interface *) vty->index;
- zif = ifp->info;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
+ struct zebra_if *zif = ifp->info;
zif->rtadv.DefaultPreference = RTADV_PREF_MEDIUM; /* Default per RFC4191. */
"Advertised MTU\n"
"MTU in bytes\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0], 1, 65535);
return CMD_SUCCESS;
"Neighbor discovery\n"
"Advertised MTU\n")
{
- struct interface *ifp = (struct interface *) vty->index;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *zif = ifp->info;
zif->rtadv.AdvLinkMTU = 0;
return CMD_SUCCESS;
"up\n"
"down\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
if (argc < 1)
return CMD_WARNING;
-
- ifp = vty->index;
+
if (ifp->ifindex == IFINDEX_INTERNAL)
{
ifp->ifindex = ++test_ifindex;
/* Vty related initialize. */
signal_init (zebrad.master, array_size(zebra_signals), zebra_signals);
cmd_init (1);
+ vty_config_lockless ();
vty_init (zebrad.master);
memory_init ();
zebra_debug_init ();
"ptm-enable",
"Enable neighbor check with specified topology\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct zebra_if *if_data;
int old_ptm_enable;
int send_linkdown = 0;
- ifp = (struct interface *) vty->index;
if (ifp->ifindex == IFINDEX_INTERNAL)
{
return CMD_SUCCESS;
NO_STR
"Enable neighbor check with specified topology\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
int send_linkup = 0;
struct zebra_if *if_data;
- ifp = (struct interface *) vty->index;
-
if ((ifp->ifindex != IFINDEX_INTERNAL) && (ifp->ptm_enable))
{
if (!if_is_operative(ifp))
/* Add zebra route map rule */
static int
-zebra_route_match_add(struct vty *vty, struct route_map_index *index,
+zebra_route_match_add(struct vty *vty,
const char *command, const char *arg,
route_map_event_t type)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_add_match (index, command, arg);
/* Delete zebra route map rule. */
static int
-zebra_route_match_delete (struct vty *vty, struct route_map_index *index,
+zebra_route_match_delete (struct vty *vty,
const char *command, const char *arg,
route_map_event_t type)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
char *dep_name = NULL;
const char *tmpstr;
/* Add zebra route map rule. */
static int
-zebra_route_set_add (struct vty *vty, struct route_map_index *index,
+zebra_route_set_add (struct vty *vty,
const char *command, const char *arg)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_add_set (index, command, arg);
/* Delete zebra route map rule. */
static int
-zebra_route_set_delete (struct vty *vty, struct route_map_index *index,
+zebra_route_set_delete (struct vty *vty,
const char *command, const char *arg)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_delete_set (index, command, arg);
"match first hop interface of route\n"
"Interface name\n")
{
- return zebra_route_match_add (vty, vty->index, "interface", argv[0],
+ return zebra_route_match_add (vty, "interface", argv[0],
RMAP_EVENT_MATCH_ADDED);
}
"Match first hop interface of route\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index, "interface", NULL, RMAP_EVENT_MATCH_DELETED);
+ return zebra_route_match_delete (vty, "interface", NULL, RMAP_EVENT_MATCH_DELETED);
- return zebra_route_match_delete (vty, vty->index, "interface", argv[0], RMAP_EVENT_MATCH_DELETED);
+ return zebra_route_match_delete (vty, "interface", argv[0], RMAP_EVENT_MATCH_DELETED);
}
ALIAS (no_match_interface,
"Match tag of route\n"
"Tag value\n")
{
- return zebra_route_match_add (vty, vty->index, "tag", argv[0],
+ return zebra_route_match_add (vty, "tag", argv[0],
RMAP_EVENT_MATCH_ADDED);
}
"Match tag of route\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index, "tag", NULL,
+ return zebra_route_match_delete (vty, "tag", NULL,
RMAP_EVENT_MATCH_DELETED);
- return zebra_route_match_delete (vty, vty->index, "tag", argv[0],
+ return zebra_route_match_delete (vty, "tag", argv[0],
RMAP_EVENT_MATCH_DELETED);
}
"IP access-list number (expanded range)\n"
"IP Access-list name\n")
{
- return zebra_route_match_add (vty, vty->index, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED);
+ return zebra_route_match_add (vty, "ip next-hop", argv[0], RMAP_EVENT_FILTER_ADDED);
}
DEFUN (no_match_ip_next_hop,
"Match next-hop address of route\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index, "ip next-hop", NULL,
+ return zebra_route_match_delete (vty, "ip next-hop", NULL,
RMAP_EVENT_FILTER_DELETED);
- return zebra_route_match_delete (vty, vty->index, "ip next-hop", argv[0],
+ return zebra_route_match_delete (vty, "ip next-hop", argv[0],
RMAP_EVENT_FILTER_DELETED);
}
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
- return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-list",
+ return zebra_route_match_add (vty, "ip next-hop prefix-list",
argv[0], RMAP_EVENT_PLIST_ADDED);
}
"Match entries of prefix-lists\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip next-hop prefix-list", NULL,
RMAP_EVENT_PLIST_DELETED);
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip next-hop prefix-list", argv[0],
RMAP_EVENT_PLIST_DELETED);
}
"IP Access-list name\n")
{
- return zebra_route_match_add (vty, vty->index, "ip address", argv[0],
+ return zebra_route_match_add (vty, "ip address", argv[0],
RMAP_EVENT_FILTER_ADDED);
}
"Match address of route\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index, "ip address", NULL,
+ return zebra_route_match_delete (vty, "ip address", NULL,
RMAP_EVENT_FILTER_DELETED);
- return zebra_route_match_delete (vty, vty->index, "ip address", argv[0],
+ return zebra_route_match_delete (vty, "ip address", argv[0],
RMAP_EVENT_FILTER_DELETED);
}
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
- return zebra_route_match_add (vty, vty->index, "ip address prefix-list",
+ return zebra_route_match_add (vty, "ip address prefix-list",
argv[0], RMAP_EVENT_PLIST_ADDED);
}
"Match entries of prefix-lists\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip address prefix-list", NULL,
RMAP_EVENT_PLIST_DELETED);
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip address prefix-list", argv[0],
RMAP_EVENT_PLIST_DELETED);
}
"Match prefix length of ip address\n"
"Prefix length\n")
{
- return zebra_route_match_add (vty, vty->index, "ip address prefix-len",
+ return zebra_route_match_add (vty, "ip address prefix-len",
argv[0], RMAP_EVENT_MATCH_ADDED);
}
"prefix length of ip address\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip address prefix-len", NULL,
RMAP_EVENT_MATCH_DELETED);
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip address prefix-len", argv[0],
RMAP_EVENT_MATCH_DELETED);
}
"Match prefixlen of given nexthop\n"
"Prefix length\n")
{
- return zebra_route_match_add (vty, vty->index, "ip next-hop prefix-len",
+ return zebra_route_match_add (vty, "ip next-hop prefix-len",
argv[0], RMAP_EVENT_MATCH_ADDED);
}
"Match prefix length of nexthop\n")
{
if (argc == 0)
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip next-hop prefix-len", NULL,
RMAP_EVENT_MATCH_DELETED);
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"ip next-hop prefix-len", argv[0],
RMAP_EVENT_MATCH_DELETED);
}
VTY_NEWLINE);
return CMD_WARNING;
}
- return zebra_route_match_add (vty, vty->index, "source-protocol",
+ return zebra_route_match_add (vty, "source-protocol",
argv[0], RMAP_EVENT_MATCH_ADDED);
}
return CMD_WARNING;
}
}
- return zebra_route_match_delete (vty, vty->index,
+ return zebra_route_match_delete (vty,
"source-protocol", argv[0] ? argv[0] : NULL,
RMAP_EVENT_MATCH_DELETED);
}
vty_out (vty, "%% not a local address%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return zebra_route_set_add (vty, vty->index, "src", argv[0]);
+ return zebra_route_set_add (vty, "src", argv[0]);
}
DEFUN (no_set_src,
"Source address for route\n")
{
if (argc == 0)
- return zebra_route_set_delete (vty, vty->index, "src", NULL);
+ return zebra_route_set_delete (vty, "src", NULL);
- return zebra_route_set_delete (vty, vty->index, "src", argv[0]);
+ return zebra_route_set_delete (vty, "src", argv[0]);
}
DEFUN (zebra_route_map_timer,