From: Jesse Gross Date: Sat, 14 Aug 2010 16:25:58 +0000 (-0400) Subject: gre: Don't require incoming checksum. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16e9d4f64f4ad7adf3e5f619e65a2045282b3969;p=openvswitch gre: Don't require incoming checksum. 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 --- diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 2bddc871..b471b08a 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -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 || diff --git a/include/openvswitch/gre.h b/include/openvswitch/gre.h index 396a67d9..a9ac1d98 100644 --- a/include/openvswitch/gre.h +++ b/include/openvswitch/gre.h @@ -42,8 +42,7 @@ #include -#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. */ diff --git a/lib/netdev-gre.c b/lib/netdev-gre.c index 69411dbd..04a83327 100644 --- a/lib/netdev-gre.c +++ b/lib/netdev-gre.c @@ -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")) { diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index f3864047..ce1c7140 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -505,8 +505,9 @@
csum
-
Optional. Compute GRE checksums for outgoing packets and - require checksums for incoming packets. Note that GRE checksums +
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