]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: use qobj and enable concurrent config edits
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 30 Sep 2016 13:38:03 +0000 (15:38 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 7 Oct 2016 13:09:52 +0000 (09:09 -0400)
This puts all the proper VTY_DECLVAR_CONTEXT calls in place, removing
all vty->index uses in the process.  With that, vty_config_lockless can
be enabled in zebra.

[v2: fix ordering screw-up in "interface XXX" command]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra/Makefile.am
zebra/interface.c
zebra/irdp_interface.c
zebra/main.c
zebra/rtadv.c
zebra/test_main.c
zebra/zebra_ptm.c
zebra/zebra_routemap.c

index e22dea099864c374ab0cf96a42f8dc5eb8678e9e..52766f37ba9087ddc7a2f4548a9f327e4f5050ca 100644 (file)
@@ -2,7 +2,8 @@ include ../common.am
 
 ## 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
 
index 9be97e2214e3b6ad75bc2651e2f7a819093e73cf..6b575f3c83f03f91a83e03a3e8e9ff88d6b09554 100644 (file)
@@ -1233,13 +1233,12 @@ DEFUN_NOSH (zebra_interface,
            "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
@@ -1286,14 +1285,13 @@ DEFUN_NOSH (zebra_vrf,
            "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;
 }
 
@@ -1518,11 +1516,10 @@ DEFUN (multicast,
        "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);
@@ -1545,11 +1542,10 @@ DEFUN (no_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);
@@ -1571,10 +1567,9 @@ DEFUN (linkdetect,
        "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);
 
@@ -1594,10 +1589,9 @@ DEFUN (no_linkdetect,
        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);
   
@@ -1614,11 +1608,10 @@ DEFUN (shutdown_if,
        "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);
@@ -1641,12 +1634,10 @@ DEFUN (no_shutdown_if,
        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);
@@ -1675,10 +1666,9 @@ DEFUN (bandwidth_if,
        "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> */
@@ -1703,9 +1693,7 @@ DEFUN (no_bandwidth_if,
        NO_STR
        "Set bandwidth informational parameter\n")
 {
-  struct interface *ifp;   
-  
-  ifp = (struct interface *) vty->index;
+  VTY_DECLVAR_CONTEXT (interface, ifp);
 
   ifp->bandwidth = 0;
   
@@ -1779,6 +1767,7 @@ DEFUN (link_params,
        "link-params",
        LINK_PARAMS_STR)
 {
+  /* vty->qobj_index stays the same @ interface pointer */
   vty->node = LINK_PARAMS_NODE;
 
   return CMD_SUCCESS;
@@ -1790,7 +1779,7 @@ DEFUN (link_params_enable,
        "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 */
@@ -1819,7 +1808,7 @@ DEFUN (no_link_params_enable,
        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);
 
@@ -1839,7 +1828,7 @@ DEFUN (link_params_metric,
        "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;
 
@@ -1855,9 +1844,9 @@ DEFUN (no_link_params_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);
@@ -1871,7 +1860,7 @@ DEFUN (link_params_maxbw,
        "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;
@@ -1915,7 +1904,7 @@ DEFUN (link_params_max_rsv_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;
 
@@ -1948,7 +1937,7 @@ DEFUN (link_params_unrsv_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;
@@ -1989,7 +1978,7 @@ DEFUN (link_params_admin_grp,
        "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;
 
@@ -2010,9 +1999,9 @@ DEFUN (no_link_params_admin_grp,
        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);
@@ -2029,8 +2018,7 @@ DEFUN (link_params_inter_as,
        "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;
@@ -2066,8 +2054,7 @@ DEFUN (no_link_params_inter_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 */
@@ -2089,8 +2076,7 @@ DEFUN (link_params_delay,
        "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;
@@ -2180,9 +2166,9 @@ DEFUN (no_link_params_delay,
        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 */
@@ -2205,7 +2191,7 @@ DEFUN (link_params_delay_var,
        "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;
 
@@ -2221,9 +2207,9 @@ DEFUN (no_link_params_delay_var,
        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);
@@ -2237,7 +2223,7 @@ DEFUN (link_params_pkt_loss,
        "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;
 
@@ -2261,9 +2247,9 @@ DEFUN (no_link_params_pkt_loss,
        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);
@@ -2277,7 +2263,7 @@ DEFUN (link_params_res_bw,
        "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;
 
@@ -2307,9 +2293,9 @@ DEFUN (no_link_params_res_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);
@@ -2323,7 +2309,7 @@ DEFUN (link_params_ava_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;
 
@@ -2353,9 +2339,9 @@ DEFUN (no_link_params_ava_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);
@@ -2369,7 +2355,7 @@ DEFUN (link_params_use_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;
 
@@ -2399,9 +2385,9 @@ DEFUN (no_link_params_use_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);
@@ -2557,7 +2543,8 @@ DEFUN (ip_address,
        "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,
@@ -2568,7 +2555,8 @@ 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);
 }
 
 
@@ -2582,7 +2570,8 @@ DEFUN (ip_address_label,
        "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,
@@ -2595,7 +2584,8 @@ 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 */
 
@@ -2758,7 +2748,8 @@ DEFUN (ipv6_address,
        "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,
@@ -2769,7 +2760,8 @@ 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 */
 
index 8fb4fcad10b2a7416051bd2d9150200f40bb426b..9d8c2e67bf1e58bfbd3e53f038c24994ee74bba5 100644 (file)
@@ -380,12 +380,7 @@ DEFUN (ip_irdp_multicast,
        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;
@@ -397,12 +392,7 @@ DEFUN (ip_irdp_broadcast,
        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;
@@ -415,12 +405,7 @@ DEFUN (no_ip_irdp,
        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;
@@ -432,12 +417,7 @@ DEFUN (ip_irdp_shutdown,
        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;
@@ -450,12 +430,7 @@ DEFUN (no_ip_irdp_shutdown,
        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;
@@ -469,13 +444,9 @@ DEFUN (ip_irdp_holdtime,
        "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;
@@ -492,13 +463,9 @@ DEFUN (ip_irdp_minadvertinterval,
        "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;
@@ -525,13 +492,9 @@ DEFUN (ip_irdp_maxadvertinterval,
        "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;
@@ -564,13 +527,9 @@ DEFUN (ip_irdp_preference,
        "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;
@@ -588,20 +547,15 @@ DEFUN (ip_irdp_address_preference,
        "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;
 
@@ -633,19 +587,14 @@ DEFUN (no_ip_irdp_address_preference,
        "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;
 
@@ -671,13 +620,9 @@ DEFUN (ip_irdp_debug_messages,
        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;
@@ -693,13 +638,9 @@ DEFUN (ip_irdp_debug_misc,
        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;
@@ -715,13 +656,9 @@ DEFUN (ip_irdp_debug_packet,
        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;
@@ -738,13 +675,9 @@ DEFUN (ip_irdp_debug_disable,
        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;
index da7e6b6fb8e907e25b3ffe74f957ec02d0e2830f..9247d435071213336c68867d5f4245105280afa4 100644 (file)
@@ -346,6 +346,7 @@ main (int argc, char **argv)
   /* 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 ();
 
index ac297890a5e64f23cfb61970f2a5dc8278b22ec8..3e0a19870226079d6381e336abbe17b8a96e9381 100644 (file)
@@ -871,10 +871,8 @@ DEFUN (ipv6_nd_suppress_ra,
        "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))
@@ -884,7 +882,6 @@ DEFUN (ipv6_nd_suppress_ra,
     }
 
   ipv6_nd_suppress_ra_set (ifp, RA_SUPPRESS);
-  zif = ifp->info;
   zif->rtadv.configured = 0;
   return CMD_SUCCESS;
 }
@@ -897,10 +894,8 @@ DEFUN (no_ipv6_nd_suppress_ra,
        "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))
@@ -910,7 +905,6 @@ DEFUN (no_ipv6_nd_suppress_ra,
     }
 
   ipv6_nd_suppress_ra_set (ifp, RA_ENABLE);
-  zif = ifp->info;
   zif->rtadv.configured = 1;
   return CMD_SUCCESS;
 }
@@ -923,8 +917,8 @@ DEFUN (ipv6_nd_ra_interval_msec,
        "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;
@@ -958,8 +952,8 @@ DEFUN (ipv6_nd_ra_interval,
        "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;
@@ -993,13 +987,11 @@ DEFUN (no_ipv6_nd_ra_interval,
        "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;
 
@@ -1038,12 +1030,9 @@ DEFUN (ipv6_nd_ra_lifetime,
        "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);
 
@@ -1070,11 +1059,8 @@ DEFUN (no_ipv6_nd_ra_lifetime,
        "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;
 
@@ -1098,7 +1084,7 @@ DEFUN (ipv6_nd_reachable_time,
        "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;
@@ -1112,11 +1098,8 @@ DEFUN (no_ipv6_nd_reachable_time,
        "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;
 
@@ -1140,7 +1123,7 @@ DEFUN (ipv6_nd_homeagent_preference,
        "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;
@@ -1154,11 +1137,8 @@ DEFUN (no_ipv6_nd_homeagent_preference,
        "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;
 
@@ -1182,7 +1162,7 @@ DEFUN (ipv6_nd_homeagent_lifetime,
        "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;
@@ -1196,11 +1176,8 @@ DEFUN (no_ipv6_nd_homeagent_lifetime,
        "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;
 
@@ -1223,11 +1200,8 @@ DEFUN (ipv6_nd_managed_config_flag,
        "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;
 
@@ -1242,11 +1216,8 @@ DEFUN (no_ipv6_nd_managed_config_flag,
        "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;
 
@@ -1260,11 +1231,8 @@ DEFUN (ipv6_nd_homeagent_config_flag,
        "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;
 
@@ -1279,11 +1247,8 @@ DEFUN (no_ipv6_nd_homeagent_config_flag,
        "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;
 
@@ -1297,11 +1262,8 @@ DEFUN (ipv6_nd_adv_interval_config_option,
        "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;
 
@@ -1316,11 +1278,8 @@ DEFUN (no_ipv6_nd_adv_interval_config_option,
        "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;
 
@@ -1334,11 +1293,8 @@ DEFUN (ipv6_nd_other_config_flag,
        "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;
 
@@ -1353,11 +1309,8 @@ DEFUN (no_ipv6_nd_other_config_flag,
        "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;
 
@@ -1380,16 +1333,13 @@ DEFUN (ipv6_nd_prefix,
        "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)
     {
@@ -1611,14 +1561,11 @@ DEFUN (no_ipv6_nd_prefix,
        "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)
     {
@@ -1801,13 +1748,10 @@ DEFUN (ipv6_nd_router_preference,
        "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)
@@ -1829,11 +1773,8 @@ DEFUN (no_ipv6_nd_router_preference,
        "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. */
 
@@ -1859,7 +1800,7 @@ DEFUN (ipv6_nd_mtu,
        "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;
@@ -1873,7 +1814,7 @@ DEFUN (no_ipv6_nd_mtu,
        "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;
index bbaf45028284ff6d2851c1143b4fde523048efc3..828b61af919a5a49a7f72029cdbcd0a1cbf349a9 100644 (file)
@@ -124,11 +124,10 @@ DEFUN (test_interface_state,
        "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;
@@ -294,6 +293,7 @@ main (int argc, char **argv)
   /* 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 ();
index 133b0fc2e9f2aa3586f8df548c04af6d47507f60..ebae1bd4b93ce454561eb1a5d96bcdf2c2fd1405 100644 (file)
@@ -298,12 +298,11 @@ DEFUN (zebra_ptm_enable_if,
        "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;
@@ -338,12 +337,10 @@ DEFUN (no_zebra_ptm_enable_if,
        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))
index e6c5a3e917d187be0152c903815712892d412c14..685f5cc4b9ea20359083b07f39c6af9249173843 100644 (file)
@@ -58,10 +58,11 @@ static void zebra_route_map_set_delay_timer(u_int32_t value);
 
 /* 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);
@@ -87,10 +88,11 @@ zebra_route_match_add(struct vty *vty, struct route_map_index *index,
 
 /* 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;
@@ -138,9 +140,10 @@ zebra_route_match_delete (struct vty *vty, struct route_map_index *index,
 
 /* 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);
@@ -161,9 +164,10 @@ zebra_route_set_add (struct vty *vty, struct route_map_index *index,
 
 /* 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);
@@ -301,7 +305,7 @@ DEFUN (match_interface,
        "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);
 }
 
@@ -313,9 +317,9 @@ DEFUN (no_match_interface,
        "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,
@@ -333,7 +337,7 @@ DEFUN (match_tag,
        "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);
 }
 
@@ -345,10 +349,10 @@ DEFUN (no_match_tag,
        "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);
 }
 
@@ -369,7 +373,7 @@ DEFUN (match_ip_next_hop,
        "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,
@@ -381,10 +385,10 @@ 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);
 }
 
@@ -408,7 +412,7 @@ DEFUN (match_ip_next_hop_prefix_list,
        "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);
 }
 
@@ -422,11 +426,11 @@ DEFUN (no_match_ip_next_hop_prefix_list,
        "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);
 }
@@ -452,7 +456,7 @@ DEFUN (match_ip_address,
        "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);
 }
 
@@ -465,10 +469,10 @@ DEFUN (no_match_ip_address,
        "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);
 }
 
@@ -492,7 +496,7 @@ DEFUN (match_ip_address_prefix_list,
        "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);
 }
 
@@ -506,11 +510,11 @@ DEFUN (no_match_ip_address_prefix_list,
        "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);
 }
@@ -534,7 +538,7 @@ DEFUN (match_ip_address_prefix_len,
        "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);
 }
 
@@ -548,11 +552,11 @@ DEFUN (no_match_ip_address_prefix_len,
        "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);
 }
@@ -575,7 +579,7 @@ DEFUN (match_ip_nexthop_prefix_len,
        "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);
 }
 
@@ -589,11 +593,11 @@ DEFUN (no_match_ip_nexthop_prefix_len,
        "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);
 }
@@ -620,7 +624,7 @@ DEFUN (match_source_protocol,
                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);
 }
 
@@ -643,7 +647,7 @@ DEFUN (no_match_source_protocol,
          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);
 }
@@ -706,7 +710,7 @@ DEFUN (set_src,
       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,
@@ -717,9 +721,9 @@ 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,