[ovs-dev] [PATCH] netdev-vport: Report carrier state of tunnel egress interfaces.

Andrew Evans aevans at nicira.com
Wed Jan 19 23:55:17 UTC 2011


Sorry, that xstrdup(...) line is too long. Incremental patch:

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 92655d8..359fc0f 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -366,7 +366,8 @@ netdev_vport_get_status(const struct netdev *netdev,
struct shash *sh)
         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"));
+                      xstrdup(netdev_get_carrier(egress_netdev)
+                              ? "up" : "down"));
         }
     }


On 1/19/11 3:51 PM, Andrew Evans wrote:
> Record carrier state of tunnel egress interface in
> "tunnel_egress_iface_carrier" key in "status" map of Interface table.
> ---
>  lib/netdev-vport.c   |    5 +++++
>  vswitchd/vswitch.xml |    6 ++++++
>  2 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 2d0d984..92655d8 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -360,9 +360,14 @@ static int
>  netdev_vport_get_status(const struct netdev *netdev, struct shash *sh)
>  {
>      const char *iface = netdev_vport_get_tnl_iface(netdev);
> +    struct netdev *egress_netdev;
>  
>      if (iface) {
>          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"));
> +        }
>      }
>  
>      return 0;
> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
> index d92489c..dfa3f20 100644
> --- a/vswitchd/vswitch.xml
> +++ b/vswitchd/vswitch.xml
> @@ -1062,6 +1062,12 @@
>                  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>
>  





More information about the dev mailing list