tunnel: Only print non-default UDP dst_port for LISP/VXLAN tunnels
authorKyle Mestery <kmestery@cisco.com>
Thu, 28 Feb 2013 14:30:16 +0000 (09:30 -0500)
committerJesse Gross <jesse@nicira.com>
Thu, 28 Feb 2013 17:19:52 +0000 (09:19 -0800)
In get_tunnel_config(), distinguish between VXLAN and LISP when deciding
whether or not to print UDP destination port. Only add the UDP
destination port for either protocol if it is not the default UDP port.
Update the LISP unit test to match the new behavior as well.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
[jesse: merge common test for VXLAN and LISP]
Signed-off-by: Jesse Gross <jesse@nicira.com>
lib/netdev-vport.c
tests/tunnel.at

index d696404..adcc352 100644 (file)
@@ -521,7 +521,10 @@ get_tunnel_config(struct netdev_dev *dev, struct smap *args)
 
     if (tnl_cfg->dst_port) {
         uint16_t dst_port = ntohs(tnl_cfg->dst_port);
-        if (dst_port != VXLAN_DST_PORT) {
+        const char *type = netdev_dev_get_type(dev);
+
+        if ((!strcmp("vxlan", type) && dst_port != VXLAN_DST_PORT) ||
+            (!strcmp("lisp", type) && dst_port != LISP_DST_PORT)) {
             smap_add_format(args, "dst_port", "%d", dst_port);
         }
     }
index c5b0064..5146708 100644 (file)
@@ -335,7 +335,7 @@ br0 (dummy@ovs-dummy):
        lookups: hit:0 missed:0 lost:0
        flows: 0
        br0 65534/100: (dummy)
-       p1 1/1: (lisp: dst_port=4341, remote_ip=1.1.1.1)
+       p1 1/1: (lisp: remote_ip=1.1.1.1)
 ])
 
 OVS_VSWITCHD_STOP