]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, zebra: add "vrf_id" into the "struct interface"
authorFeng Lu <lu.feng@6wind.com>
Fri, 22 May 2015 09:39:57 +0000 (11:39 +0200)
committerVipin Kumar <vipin@cumulusnetworks.com>
Thu, 29 Oct 2015 23:49:39 +0000 (16:49 -0700)
Later, an interface will belong to a specific VRF. Now we add a
property "vrf_id" to the "struct interface", and keep it as the
default value 0.

This property is shown when displaying interfaces information.
It is also added in some logs.

This is just the preparation to move the interace list into the
"struct vrf". The main logic is not changed.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
lib/if.c
zebra/interface.c

lib/if.c
lib/if.h
zebra/interface.c

index 3003e4c2f4fed6cf82d62706ac57859a1a88d137..a9ab68029620285bb6687e11e5e50f5a8f6b7d8a 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -521,12 +521,12 @@ if_flag_dump (unsigned long flag)
 static void
 if_dump (const struct interface *ifp)
 {
-    zlog_info ("Interface %s index %d metric %d mtu %d "
+    zlog_info ("Interface %s vrf %u index %d metric %d mtu %d "
 #ifdef HAVE_IPV6
                "mtu6 %d "
 #endif /* HAVE_IPV6 */
                "%s",
-               ifp->name, ifp->ifindex, ifp->metric, ifp->mtu, 
+               ifp->name, ifp->vrf_id, ifp->ifindex, ifp->metric, ifp->mtu,
 #ifdef HAVE_IPV6
                ifp->mtu6,
 #endif /* HAVE_IPV6 */
@@ -773,8 +773,8 @@ connected_log (struct connected *connected, char *str)
   ifp = connected->ifp;
   p = connected->address;
 
-  snprintf (logbuf, BUFSIZ, "%s interface %s %s %s/%d ", 
-           str, ifp->name, prefix_family_str (p),
+  snprintf (logbuf, BUFSIZ, "%s interface %s vrf %u %s %s/%d ",
+           str, ifp->name, ifp->vrf_id, prefix_family_str (p),
            inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
            p->prefixlen);
 
index 6d4ca2f77eeba2fff4dc81f01d47f7ae00b03a99..f29e514e96b1aa26c14589f1129f853c6483c316 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -145,6 +145,8 @@ struct interface
 #ifdef HAVE_NET_RT_IFLIST
   struct if_data stats;
 #endif /* HAVE_NET_RT_IFLIST */
+
+  vrf_id_t vrf_id;
 };
 
 /* Connected address structure. */
index 9d4a2f89d264da524bb3da08a40b546174c4aebb..248f77d8f5dd7490a33f2856e9942878a407431a 100644 (file)
@@ -388,21 +388,23 @@ if_add_update (struct interface *ifp)
       if (if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)
        {
          if (IS_ZEBRA_DEBUG_KERNEL)
-           zlog_debug ("interface %s index %d is shutdown. Won't wake it up.",
-                       ifp->name, ifp->ifindex);
+           zlog_debug ("interface %s vrf %u index %d is shutdown. "
+                       "Won't wake it up.",
+                       ifp->name, ifp->vrf_id, ifp->ifindex);
          return;
        }
 
       if_addr_wakeup (ifp);
 
       if (IS_ZEBRA_DEBUG_KERNEL)
-       zlog_debug ("interface %s index %d becomes active.", 
-                   ifp->name, ifp->ifindex);
+       zlog_debug ("interface %s vrf %u index %d becomes active.",
+                   ifp->name, ifp->vrf_id, ifp->ifindex);
     }
   else
     {
       if (IS_ZEBRA_DEBUG_KERNEL)
-       zlog_debug ("interface %s index %d is added.", ifp->name, ifp->ifindex);
+       zlog_debug ("interface %s vrf %u index %d is added.",
+                   ifp->name, ifp->vrf_id, ifp->ifindex);
     }
 }
 
@@ -419,8 +421,8 @@ if_delete_update (struct interface *ifp)
 
   if (if_is_up(ifp))
     {
-      zlog_err ("interface %s index %d is still up while being deleted.",
-           ifp->name, ifp->ifindex);
+      zlog_err ("interface %s vrf %u index %d is still up while being deleted.",
+                ifp->name, ifp->vrf_id, ifp->ifindex);
       return;
     }
 
@@ -428,8 +430,8 @@ if_delete_update (struct interface *ifp)
   UNSET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE);
   
   if (IS_ZEBRA_DEBUG_KERNEL)
-    zlog_debug ("interface %s index %d is now inactive.",
-              ifp->name, ifp->ifindex);
+    zlog_debug ("interface %s vrf %u index %d is now inactive.",
+                ifp->name, ifp->vrf_id, ifp->ifindex);
 
   /* Delete connected routes from the kernel. */
   if (ifp->connected)
@@ -846,6 +848,8 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
 
   zebra_ptm_show_status(vty, ifp);
 
+  vty_out (vty, "  vrf: %u%s", ifp->vrf_id, VTY_NEWLINE);
+
   if (ifp->desc)
     vty_out (vty, "  Description: %s%s", ifp->desc,
             VTY_NEWLINE);