]> git.puffer.fish Git - matthieu/frr.git/commitdiff
quagga: Remove iflist global variable
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 8 Apr 2016 13:16:14 +0000 (09:16 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 8 Apr 2016 17:15:59 +0000 (13:15 -0400)
The file if.c has a iflist that had the list of interfaces
in the default vrf.  Remove this variable and replace
with a vrf_iflist lookup on the default vrf where it
was used.

Additionally, modify ptm code to iterate over all vrf's
when enabling ptm.

Ticket: CM-10338
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
17 files changed:
isisd/isis_circuit.c
lib/if.c
lib/if.h
lib/vrf.c
ospf6d/ospf6_bfd.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_main.c
ospfd/ospf_interface.c
ospfd/ospf_te.c
ospfd/ospf_vty.c
ospfd/ospfd.c
ripd/rip_interface.c
ripd/ripd.c
ripngd/ripng_interface.c
ripngd/ripngd.c
zebra/irdp_main.c
zebra/zebra_ptm.c

index 83d0aa432785215032291e24bd40a3ab64d149c9..16ec409d4cfd664e855c1a23d12a92177ccbde68 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "log.h"
 #include "memory.h"
+#include "vrf.h"
 #include "if.h"
 #include "linklist.h"
 #include "command.h"
@@ -1024,7 +1025,7 @@ isis_interface_config_write (struct vty *vty)
   struct isis_circuit *circuit;
   int i;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       if (ifp->ifindex == IFINDEX_DELETED)
         continue;
index 33481c32f8682a3d451923ee96d7c1cb13ec73b8..1d0518956a8a96cc577ca16be032795f04393f60 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -38,7 +38,6 @@
 #include "log.h"
 
 /* List of interfaces in only the default VRF */
-struct list *iflist;
 int ptm_enable = 0;
 
 /* One for each program.  This structure is needed to store hooks. */
@@ -1261,7 +1260,7 @@ ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
 
 /* Initialize interface list. */
 void
-if_init (vrf_id_t vrf_id, struct list **intf_list)
+if_init (struct list **intf_list)
 {
   *intf_list = list_new ();
 #if 0
@@ -1269,13 +1268,10 @@ if_init (vrf_id_t vrf_id, struct list **intf_list)
 #endif /* ifaddr_ipv4_table */
 
   (*intf_list)->cmp = (int (*)(void *, void *))if_cmp_func;
-
-  if (vrf_id == VRF_DEFAULT)
-    iflist = *intf_list;
 }
 
 void
-if_terminate (vrf_id_t vrf_id, struct list **intf_list)
+if_terminate (struct list **intf_list)
 {
   for (;;)
     {
@@ -1290,7 +1286,4 @@ if_terminate (vrf_id_t vrf_id, struct list **intf_list)
 
   list_delete (*intf_list);
   *intf_list = NULL;
-
-  if (vrf_id == VRF_DEFAULT)
-    iflist = NULL;
 }
index b65d9551524e92b968c8624ee7ef0054e8d24fb2..9c57cf769d33ccf5aa4e36f02f8a8c8099f85950 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -324,8 +324,8 @@ extern int if_is_broadcast (struct interface *);
 extern int if_is_pointopoint (struct interface *);
 extern int if_is_multicast (struct interface *);
 extern void if_add_hook (int, int (*)(struct interface *));
-extern void if_init (vrf_id_t, struct list **);
-extern void if_terminate (vrf_id_t, struct list **);
+extern void if_init (struct list **);
+extern void if_terminate (struct list **);
 extern void if_dump_all (void);
 extern const char *if_flag_dump(unsigned long);
 
@@ -364,7 +364,6 @@ extern char *if_indextoname (unsigned int, char *);
 #endif
 
 /* Exported variables. */
-extern struct list *iflist;
 extern struct cmd_element interface_desc_cmd;
 extern struct cmd_element no_interface_desc_cmd;
 extern struct cmd_element interface_cmd;
index 329e9a4d062ff0053a3b5b4159d6467b66524fcf..f730c539f5a388ce747620a30ae3f744522525cc 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -70,7 +70,7 @@ vrf_list_lookup_by_name (const char *name)
   return NULL;
 }
 
-/* Create new interface structure. */
+/* Create new vrf structure. */
 struct vrf *
 vrf_create (const char *name, size_t namelen)
 {
@@ -184,7 +184,7 @@ vrf_get (vrf_id_t vrf_id, const char *name)
       vrf->node = rn;
 
       /* Initialize interfaces. */
-      if_init (vrf_id, &vrf->iflist);
+      if_init (&vrf->iflist);
     }
 
   if (vrf_master.vrf_new_hook && name) {
@@ -210,7 +210,7 @@ vrf_delete (struct vrf *vrf)
     (*vrf_master.vrf_delete_hook) (vrf->vrf_id, vrf->name, &vrf->info);
 
   if (CHECK_FLAG (vrf->status, VRF_ACTIVE))
-    if_terminate (vrf->vrf_id, &vrf->iflist);
+    if_terminate (&vrf->iflist);
 
   if (vrf->node)
     {
@@ -491,7 +491,7 @@ vrf_iflist_create (vrf_id_t vrf_id)
 {
    struct vrf * vrf = vrf_lookup (vrf_id);
    if (vrf && !vrf->iflist)
-     if_init (vrf_id, &vrf->iflist);
+     if_init (&vrf->iflist);
 }
 
 /* Free the interface list of the specified VRF. */
@@ -500,7 +500,7 @@ vrf_iflist_terminate (vrf_id_t vrf_id)
 {
    struct vrf * vrf = vrf_lookup (vrf_id);
    if (vrf && vrf->iflist)
-     if_terminate (vrf->vrf_id, &vrf->iflist);
+     if_terminate (&vrf->iflist);
 }
 
 /*
index f14571d1f9a6bb8314858977c5c58f1b974eb23c..adcfcbf19c0f62abbd30cc47bfd86efc4c436a13 100644 (file)
@@ -161,7 +161,7 @@ ospf6_bfd_nbr_replay (int command, struct zclient *zclient, zebra_size_t length,
   bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER);
 
   /* Replay the neighbor, if BFD is enabled on the interface*/
-  for (ALL_LIST_ELEMENTS_RO (iflist, inode, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), inode, ifp))
     {
       oi = (struct ospf6_interface *) ifp->info;
 
index d09f8b313689b7106c1a029367f79062e7209d3b..a111a2148dc646f31c2fdc12a623f1d3de630a23 100644 (file)
@@ -1009,7 +1009,7 @@ DEFUN (show_ipv6_ospf6_interface,
     }
   else
     {
-      for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
+      for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), i, ifp))
         ospf6_interface_show (vty, ifp);
     }
 
@@ -1102,7 +1102,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix,
   struct ospf6_interface *oi;
   struct interface *ifp;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), i, ifp))
     {
       oi = (struct ospf6_interface *) ifp->info;
       if (oi == NULL)
@@ -1816,7 +1816,7 @@ config_write_ospf6_interface (struct vty *vty)
   struct ospf6_interface *oi;
   struct interface *ifp;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), i, ifp))
     {
       oi = (struct ospf6_interface *) ifp->info;
       if (oi == NULL)
@@ -1984,7 +1984,7 @@ DEFUN (clear_ipv6_ospf6_interface,
 
   if (argc == 0) /* Clear all the ospfv3 interfaces. */
     {
-      for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+      for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
         ospf6_interface_clear (vty, ifp);
     }
   else /* Interface name is specified. */
index 4eb22c15a3312f35c15da32fbee24fac582067b5..9017e8b3469e3aa0b40eef1a5f5c61ae4cbe2849 100644 (file)
@@ -145,7 +145,7 @@ ospf6_exit (int status)
   if (ospf6)
     ospf6_delete (ospf6);
 
-  for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     if (ifp->info != NULL)
       ospf6_interface_delete(ifp->info);
 
index c0b4e7abea698dd6d806b9c01ab7e5d7e8bc5bde..628091963edfed7a779166411a67c9b965e2f44f 100644 (file)
@@ -1269,7 +1269,7 @@ void
 ospf_if_init ()
 {
   /* Initialize Zebra interface data structure. */
-  om->iflist = iflist;
+  om->iflist = vrf_iflist (VRF_DEFAULT);
   if_add_hook (IF_NEW_HOOK, ospf_if_new_hook);
   if_add_hook (IF_DELETE_HOOK, ospf_if_delete_hook);
 }
index 6f19a28327422421434358cb7d6be0705cf4391f..565a61aaae2165ceb929031e7e81ce0fa2c1ec3b 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "linklist.h"
 #include "prefix.h"
+#include "vrf.h"
 #include "if.h"
 #include "table.h"
 #include "memory.h"
@@ -1890,7 +1891,7 @@ DEFUN (show_mpls_te_link,
   /* Show All Interfaces. */
   if (argc == 0)
     {
-      for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+      for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
         show_mpls_te_link_sub (vty, ifp);
     }
   /* Interface name is specified. */
index 8cdf6e9d68969237510a3a1ddd1cdfb1b81422af..ab0ed14f1b63e76415b9ea45f15f1e4088c15c90 100644 (file)
@@ -3927,7 +3927,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
   if (argc == (iface_argv + 1))
     {
       /* Show All Interfaces.*/
-      for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+      for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
         {
           if (ospf_oi_count(ifp))
             {
@@ -3938,7 +3938,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
   else if (argv[iface_argv] && strcmp(argv[iface_argv], "json") == 0)
     {
       /* Show All Interfaces. */
-      for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+      for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
         {
           if (ospf_oi_count(ifp))
             {
@@ -9280,7 +9280,7 @@ config_write_interface (struct vty *vty)
   struct ospf_if_params *params;
   struct ospf *ospf = ospf_lookup();
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), n1, ifp))
     {
       if (memcmp (ifp->name, "VLINK", 5) == 0)
        continue;
@@ -10284,7 +10284,7 @@ DEFUN (clear_ip_ospf_interface,
 
   if (argc == 0) /* Clear all the ospfv2 interfaces. */
     {
-      for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+      for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
         ospf_interface_clear(ifp);
     }
   else /* Interface name is specified. */
index 8fbecee0507261a2942d2afd3dfd2cf55532087c..d7d22a27254219fe24ae3836b5131ec449a61195 100644 (file)
@@ -539,7 +539,7 @@ ospf_finish_final (struct ospf *ospf)
   list_delete (ospf->vlinks);
 
   /* Remove any ospf interface config params */
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       struct ospf_if_params *params;
 
index c269ae07bcf92aa4cfae68910ddb39d187683e4c..c9cccbbe1f0505f66bb7149aca351e85e390d359 100644 (file)
@@ -357,7 +357,7 @@ if_check_address (struct in_addr addr)
   struct listnode *node;
   struct interface *ifp;
   
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       struct listnode *cnode;
       struct connected *connected;
@@ -504,7 +504,7 @@ rip_interface_clean (void)
   struct interface *ifp;
   struct rip_interface *ri;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
@@ -527,7 +527,7 @@ rip_interface_reset (void)
   struct interface *ifp;
   struct rip_interface *ri;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
@@ -634,7 +634,7 @@ rip_if_down_all ()
   struct interface *ifp;
   struct listnode *node, *nnode;
 
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+  for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
     rip_if_down (ifp);
 }
 
@@ -1059,7 +1059,7 @@ rip_enable_apply_all ()
   struct listnode *node, *nnode;
 
   /* Check each interface. */
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+  for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
     rip_enable_apply (ifp);
 }
 
@@ -1180,7 +1180,7 @@ rip_passive_interface_apply_all (void)
   struct interface *ifp;
   struct listnode *node, *nnode;
 
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+  for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
     rip_passive_interface_apply (ifp);
 }
 
@@ -1924,7 +1924,7 @@ rip_interface_config_write (struct vty *vty)
   struct listnode *node;
   struct interface *ifp;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       struct rip_interface *ri;
 
index acac8c1be7bbfe94a327ca43f956361604581a28..d16abcf72474a97de75c2ead182d7cff2a2c338f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <zebra.h>
 
+#include "vrf.h"
 #include "if.h"
 #include "command.h"
 #include "prefix.h"
@@ -343,7 +344,8 @@ rip_nexthop_check (struct in_addr *addr)
 
   /* If nexthop address matches local configured address then it is
      invalid nexthop. */
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, ifc))
        {           
@@ -2477,7 +2479,7 @@ rip_update_process (int route_type)
   struct prefix_ipv4 *p;
 
   /* Send RIP update to each interface. */
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       if (if_is_loopback (ifp))
        continue;
@@ -3535,7 +3537,7 @@ DEFUN (show_ip_rip_status,
 
   vty_out (vty, "    Interface        Send  Recv   Key-chain%s", VTY_NEWLINE);
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
@@ -3567,7 +3569,7 @@ DEFUN (show_ip_rip_status,
 
   {
     int found_passive = 0;
-    for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+    for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
       {
        ri = ifp->info;
 
@@ -3766,7 +3768,7 @@ rip_distribute_update_all (struct prefix_list *notused)
   struct interface *ifp;
   struct listnode *node, *nnode;
 
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+  for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
     rip_distribute_update_interface (ifp);
 }
 /* ARGSUSED */
@@ -3957,7 +3959,7 @@ rip_routemap_update (const char *notused)
   struct interface *ifp;
   struct listnode *node, *nnode;
 
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+  for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
     rip_if_rmap_update_interface (ifp);
 
   rip_routemap_update_redistribute ();
index ca7f02ef5965080b24c1463cce7dfa71b48e6f28..15ce0a238d6bb11101f15f98a6b3f1ceff710230 100644 (file)
@@ -332,7 +332,7 @@ ripng_interface_clean (void)
   struct interface *ifp;
   struct ripng_interface *ri;
 
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
+  for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), node, nnode, ifp))
     {
       ri = ifp->info;
 
@@ -355,7 +355,7 @@ ripng_interface_reset (void)
   struct interface *ifp;
   struct ripng_interface *ri;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
@@ -812,7 +812,7 @@ ripng_enable_apply_all (void)
   struct interface *ifp;
   struct listnode *node;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     ripng_enable_apply (ifp);
 }
 
@@ -877,7 +877,7 @@ ripng_passive_interface_apply_all (void)
   struct interface *ifp;
   struct listnode *node;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     ripng_passive_interface_apply (ifp);
 }
 
@@ -1148,7 +1148,7 @@ interface_config_write (struct vty *vty)
   struct ripng_interface *ri;
   int write = 0;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
index 85c866e060139e612b17674199583464ab350f93..8b71269c04cae619778cfef757ccdbd8f6df0dde 100644 (file)
@@ -1449,7 +1449,7 @@ ripng_update (struct thread *t)
     zlog_debug ("RIPng update timer expired!");
 
   /* Supply routes to each interface. */
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
@@ -1532,7 +1532,7 @@ ripng_triggered_update (struct thread *t)
 
   /* Split Horizon processing is done when generating triggered
      updates as well as normal updates (see section 2.6). */
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       ri = ifp->info;
 
@@ -2143,7 +2143,7 @@ DEFUN (show_ipv6_ripng_status,
 
   vty_out (vty, "    Interface        Send  Recv%s", VTY_NEWLINE);
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     {
       struct ripng_interface *ri;
       
@@ -2760,7 +2760,7 @@ ripng_distribute_update_all (struct prefix_list *notused)
   struct interface *ifp;
   struct listnode *node;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     ripng_distribute_update_interface (ifp);
 }
 
@@ -2935,7 +2935,7 @@ ripng_routemap_update (const char *unused)
   struct interface *ifp;
   struct listnode *node;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
     ripng_if_rmap_update_interface (ifp);
 
   ripng_routemap_update_redistribute ();
index c297979cfc9d8bfec729a3d9fd2a3976ed7a063c..af493c5c01e63629beaf0fad4936927dc2635e5e 100644 (file)
@@ -310,25 +310,27 @@ void irdp_finish()
   struct interface *ifp;
   struct zebra_if *zi;
   struct irdp_interface *irdp;
+  vrf_iter_t iter;
 
   zlog_info("IRDP: Received shutdown notification.");
-  
-  for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
-    {
-      zi = ifp->info;
-      
-      if (!zi) 
-        continue;
-      irdp = &zi->irdp;
-      if (!irdp) 
-        continue;
-
-      if (irdp->flags & IF_ACTIVE ) 
-        {
-         irdp->flags |= IF_SHUTDOWN;
-         irdp_advert_off(ifp);
-        }
-    }
+  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) 
+    for (ALL_LIST_ELEMENTS (vrf_iter2iflist (iter), node, nnode, ifp))
+      {
+        zi = ifp->info;
+
+        if (!zi) 
+          continue;
+        irdp = &zi->irdp;
+        if (!irdp) 
+          continue;
+
+        if (irdp->flags & IF_ACTIVE ) 
+          {
+           irdp->flags |= IF_SHUTDOWN;
+           irdp_advert_off(ifp);
+          }
+      }
 }
 
 #endif /* HAVE_IRDP */
index bd4c03d1d1f0f1c97592bdd43f20aeb70f60495f..819f05162cb669f744f3da1958de69446690ae93 100644 (file)
@@ -246,16 +246,18 @@ DEFUN (zebra_ptm_enable,
 {
   struct listnode *i;
   struct interface *ifp;
+  vrf_iter_t iter;
 
   ptm_cb.ptm_enable = 1;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
-    if (!ifp->ptm_enable)
-      {
-       ifp->ptm_enable = 1;
-        /* Assign a default unknown status */
-       ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
-      }
+  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
+    for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter), i, ifp))
+      if (!ifp->ptm_enable)
+        {
+         ifp->ptm_enable = 1;
+          /* Assign a default unknown status */
+         ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
+        }
 
   zebra_ptm_connect(NULL);
 
@@ -984,25 +986,28 @@ zebra_ptm_reset_status(int ptm_disable)
   struct listnode *i;
   struct interface *ifp;
   int send_linkup;
+  vrf_iter_t iter;
 
-  for (ALL_LIST_ELEMENTS_RO (iflist, i, ifp))
-    {
-      send_linkup = 0;
-      if (ifp->ptm_enable)
-       {
-         if (!if_is_operative(ifp))
-           send_linkup = 1;
-
-          if (ptm_disable)
-           ifp->ptm_enable = 0;
-          ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
-
-         if (if_is_operative (ifp) && send_linkup) {
-            if (IS_ZEBRA_DEBUG_EVENT)
-             zlog_debug ("%s: Bringing up interface %s", __func__,
-                           ifp->name);
-           if_up (ifp);
-         }
-       }
-    }
+  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
+    for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter), i, ifp))
+      {
+        send_linkup = 0;
+        if (ifp->ptm_enable)
+         {
+           if (!if_is_operative(ifp))
+             send_linkup = 1;
+
+            if (ptm_disable)
+             ifp->ptm_enable = 0;
+            ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
+
+           if (if_is_operative (ifp) && send_linkup)
+              {
+                 if (IS_ZEBRA_DEBUG_EVENT)
+                  zlog_debug ("%s: Bringing up interface %s", __func__,
+                              ifp->name);
+                if_up (ifp);
+             }
+          }
+      }
 }