tunnel: Only un-wildcard the ECN bits for IP traffic.
authorJustin Pettit <jpettit@nicira.com>
Tue, 25 Jun 2013 23:40:50 +0000 (16:40 -0700)
committerJustin Pettit <jpettit@nicira.com>
Wed, 26 Jun 2013 04:29:16 +0000 (21:29 -0700)
With tunnels carrying IP packets, ECN bits are always inherited by
the encapsulating tunnel.  However, it doesn't make sense to
unwildcard the inner packet's TOS fields if the packet is not IP.

Found by inspection.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
ofproto/tunnel.c

index dedfca8..1a39aea 100644 (file)
@@ -253,11 +253,14 @@ tnl_port_send(const struct tnl_port *tnl_port, struct flow *flow,
         wc->masks.nw_tos = 0xff;
         flow->tunnel.ip_tos = flow->nw_tos & IP_DSCP_MASK;
     } else {
-        /* ECN fields are always inherited. */
-        wc->masks.nw_tos |= IP_ECN_MASK;
         flow->tunnel.ip_tos = cfg->tos;
     }
 
+    /* ECN fields are always inherited. */
+    if (is_ip_any(flow)) {
+        wc->masks.nw_tos |= IP_ECN_MASK;
+    }
+
     if ((flow->nw_tos & IP_ECN_MASK) == IP_ECN_CE) {
         flow->tunnel.ip_tos |= IP_ECN_ECT_0;
     } else {