gre: Don't require incoming checksum.
authorJesse Gross <jesse@nicira.com>
Sat, 14 Aug 2010 16:25:58 +0000 (12:25 -0400)
committerJesse Gross <jesse@nicira.com>
Sat, 21 Aug 2010 02:43:06 +0000 (19:43 -0700)
The current meaning of the GRE checksum option is to include
checksums on transmit and require packets to have them on receive.
In addition, incoming packets with checksums are always validated
regardless of this option.  Requiring checksums on receive creates
surprising behavior and interoperability issues.  This disables the
requirement on receive.  The new behavior is that the sender decides
whether to checksum packets and the receiver will validate packets
with checksums (similar to UDP).

Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/vport-gre.c
include/openvswitch/gre.h
lib/netdev-gre.c
vswitchd/vswitch.xml

index 2bddc87..b471b08 100644 (file)
@@ -592,7 +592,7 @@ static void create_gre_header(struct sk_buff *skb,
                options--;
        }
 
-       if (mutable->port_config.flags & GRE_F_OUT_CSUM) {
+       if (mutable->port_config.flags & GRE_F_CSUM) {
                greh->flags |= GRE_CSUM;
 
                *options = 0;
@@ -787,7 +787,7 @@ static void gre_err(struct sk_buff *skb, u32 info)
            !!(mutable->port_config.flags & GRE_F_OUT_KEY_ACTION))
                return;
 
-       if ((mutable->port_config.flags & GRE_F_OUT_CSUM) && !(flags & GRE_CSUM))
+       if ((mutable->port_config.flags & GRE_F_CSUM) && !(flags & GRE_CSUM))
                return;
 
        tunnel_hdr_len += iph->ihl << 2;
@@ -881,11 +881,6 @@ static int gre_rcv(struct sk_buff *skb)
                goto error;
        }
 
-       if ((mutable->port_config.flags & GRE_F_IN_CSUM) && !(flags & GRE_CSUM)) {
-               vport_record_error(vport, VPORT_E_RX_CRC);
-               goto error;
-       }
-
        if (!pskb_pull(skb, hdr_len) || !pskb_may_pull(skb, ETH_HLEN)) {
                vport_record_error(vport, VPORT_E_RX_ERROR);
                goto error;
@@ -1196,7 +1191,7 @@ static int set_config(const struct vport *cur_vport,
 
        mutable->tunnel_hlen = sizeof(struct iphdr) + GRE_HEADER_SECTION;
 
-       if (mutable->port_config.flags & GRE_F_OUT_CSUM)
+       if (mutable->port_config.flags & GRE_F_CSUM)
                mutable->tunnel_hlen += GRE_HEADER_SECTION;
 
        if (mutable->port_config.out_key ||
index 396a67d..a9ac1d9 100644 (file)
@@ -42,8 +42,7 @@
 
 #include <linux/types.h>
 
-#define GRE_F_IN_CSUM          (1 << 0) /* Require incoming packets to have checksums. */
-#define GRE_F_OUT_CSUM         (1 << 1) /* Checksum outgoing packets. */
+#define GRE_F_CSUM             (1 << 1) /* Checksum packets. */
 #define GRE_F_IN_KEY_MATCH     (1 << 2) /* Store the key in tun_id to match in flow table. */
 #define GRE_F_OUT_KEY_ACTION   (1 << 3) /* Get the key from a SET_TUNNEL action. */
 #define GRE_F_TOS_INHERIT      (1 << 4) /* Inherit the ToS from the inner packet. */
index 69411db..04a8332 100644 (file)
@@ -111,8 +111,7 @@ parse_config(const char *name, const struct shash *args,
             }
         } else if (!strcmp(node->name, "csum")) {
             if (!strcmp(node->data, "true")) {
-                config->flags |= GRE_F_IN_CSUM;
-                config->flags |= GRE_F_OUT_CSUM;
+                config->flags |= GRE_F_CSUM;
             }
         } else if (!strcmp(node->name, "pmtud")) {
             if (!strcmp(node->data, "false")) {
index f386404..ce1c714 100644 (file)
             </dl>
             <dl>
               <dt><code>csum</code></dt>
-              <dd>Optional.  Compute GRE checksums for outgoing packets and
-                require checksums for incoming packets.  Note that GRE checksums
+              <dd>Optional.  Compute GRE checksums on outgoing packets.
+                Checksums present on incoming packets will be validated
+                regardless of this setting.  Note that GRE checksums
                 impose a significant performance penalty as they cover the
                 entire packet.  As the contents of the packet is typically
                 covered by L3 and L4 checksums, this additional checksum only