provide get_config for netdev-tunnel's
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Thu, 21 Jun 2012 09:59:50 +0000 (11:59 +0200)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Thu, 21 Jun 2012 09:59:50 +0000 (11:59 +0200)
lib/netdev-tunnel.c

index dd87af6..1beaf90 100644 (file)
@@ -169,6 +169,14 @@ netdev_tunnel_close(struct netdev *netdev_)
 static int
 netdev_tunnel_get_config(struct netdev_dev *dev_, struct shash *args)
 {
+    struct netdev_dev_tunnel *netdev_dev = netdev_dev_tunnel_cast(dev_);
+
+    if (netdev_dev->valid_remote_ip)
+       shash_add(args, "remote_ip",
+           xasprintf(IP_FMT, IP_ARGS(&netdev_dev->remote_addr.sin_addr)));
+    if (netdev_dev->valid_remote_port)
+        shash_add(args, "remote_port",
+           xasprintf("%"PRIu16, ntohs(netdev_dev->remote_addr.sin_port)));
     return 0;
 }