netdev-vport: Report carrier state of tunnel egress interfaces.
authorAndrew Evans <aevans@nicira.com>
Wed, 19 Jan 2011 22:50:01 +0000 (14:50 -0800)
committerAndrew Evans <aevans@nicira.com>
Thu, 20 Jan 2011 02:25:12 +0000 (18:25 -0800)
Record carrier state of tunnel egress interface in
"tunnel_egress_iface_carrier" key in "status" map of Interface table.

lib/netdev-vport.c
vswitchd/vswitch.xml

index 2d0d9845af037c96db89a2ea977d167353be72e1..864945337a91cf6ef866d42bbc1b0b76a689ef7b 100644 (file)
@@ -362,7 +362,16 @@ netdev_vport_get_status(const struct netdev *netdev, struct shash *sh)
     const char *iface = netdev_vport_get_tnl_iface(netdev);
 
     if (iface) {
+        struct netdev *egress_netdev;
+
         shash_add(sh, "tunnel_egress_iface", xstrdup(iface));
+
+        if (!netdev_open_default(iface, &egress_netdev)) {
+            shash_add(sh, "tunnel_egress_iface_carrier",
+                      xstrdup(netdev_get_carrier(egress_netdev)
+                              ? "up" : "down"));
+            netdev_close(egress_netdev);
+        }
     }
 
     return 0;
index d92489cedd64b192f747457a1ad8a980ae5d2a40..dfa3f20a0d290b455c5e30b4d269474c0e143e43 100644 (file)
                 traffic destined for the configured <code>remote_ip</code>.
                 This could be an internal interface such as a bridge port.</dd>
         </dl>
+        <dl>
+            <dt><code>tunnel_egress_iface_carrier</code></dt>
+            <dd>Whether a carrier is detected on <ref
+            column="tunnel_egress_iface"/>.  Valid values are <code>down</code>
+            and <code>up</code>.</dd>
+        </dl>
       </column>
     </group>