bridge: Move tunnel_egress_iface to status column.
[sliver-openvswitch.git] / lib / netdev-vport.c
index f3985e9..cf717cc 100644 (file)
@@ -100,6 +100,7 @@ static void netdev_vport_route_change(const struct rtnetlink_route_change *,
                                       void *);
 static void netdev_vport_link_change(const struct rtnetlink_link_change *,
                                      void *);
+static const char *netdev_vport_get_tnl_iface(const struct netdev *netdev);
 
 static bool
 is_vport_class(const struct netdev_class *class)
@@ -364,6 +365,18 @@ netdev_vport_set_stats(struct netdev *netdev, const struct netdev_stats *stats)
     return err;
 }
 
+static int
+netdev_vport_get_status(const struct netdev *netdev, struct shash *sh)
+{
+    const char *iface = netdev_vport_get_tnl_iface(netdev);
+
+    if (iface) {
+        shash_add(sh, "tunnel_egress_iface", xstrdup(iface));
+    }
+
+    return 0;
+}
+
 static int
 netdev_vport_update_flags(struct netdev *netdev OVS_UNUSED,
                         enum netdev_flags off, enum netdev_flags on OVS_UNUSED,
@@ -924,7 +937,7 @@ parse_patch_config(const struct netdev_dev *dev, const struct shash *args,
     return 0;
 }
 \f
-#define VPORT_FUNCTIONS(TNL_IFACE)                          \
+#define VPORT_FUNCTIONS(GET_STATUS)                         \
     netdev_vport_init,                                      \
     netdev_vport_run,                                       \
     netdev_vport_wait,                                      \
@@ -974,7 +987,7 @@ parse_patch_config(const struct netdev_dev *dev, const struct shash *args,
     NULL,                       /* get_in6 */               \
     NULL,                       /* add_router */            \
     NULL,                       /* get_next_hop */          \
-    TNL_IFACE,                                              \
+    GET_STATUS,                                             \
     NULL,                       /* arp_lookup */            \
                                                             \
     netdev_vport_update_flags,                              \
@@ -986,11 +999,11 @@ void
 netdev_vport_register(void)
 {
     static const struct vport_class vport_classes[] = {
-        { { "gre", VPORT_FUNCTIONS(netdev_vport_get_tnl_iface) },
+        { { "gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
             parse_tunnel_config },
-        { { "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_tnl_iface) },
+        { { "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
             parse_tunnel_config },
-        { { "capwap", VPORT_FUNCTIONS(netdev_vport_get_tnl_iface) },
+        { { "capwap", VPORT_FUNCTIONS(netdev_vport_get_status) },
             parse_tunnel_config },
         { { "patch", VPORT_FUNCTIONS(NULL) }, parse_patch_config }
     };