]> git.proxmox.com Git - ovs.git/commitdiff
Revert "datapath: Derive IP protocol number for IPv6 later frags"
authorGreg Rose <gvrose8192@gmail.com>
Tue, 18 Dec 2018 17:43:19 +0000 (09:43 -0800)
committerBen Pfaff <blp@ovn.org>
Tue, 18 Dec 2018 20:16:57 +0000 (12:16 -0800)
This reverts commit 2f748bf8016c ("datapath: Derive IP protocol...")

This commit is causing some ipv6 fragmentation errors in some older
kernels.  Revert for now and then we can determine how to implement
this patch with appropriate compatability layer changes to prevent
errors on older kernels.

CC: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
datapath/flow.c

index f685cf393bf393ca04d7e062497b48398325f4c4..fadc074721a2e317fdf7ab43ebc9ea7aa1c285e8 100644 (file)
@@ -254,18 +254,21 @@ static bool icmphdr_ok(struct sk_buff *skb)
 
 static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
 {
-       unsigned short frag_off;
-       unsigned int payload_ofs = 0;
        unsigned int nh_ofs = skb_network_offset(skb);
        unsigned int nh_len;
+       int payload_ofs;
        struct ipv6hdr *nh;
-       int err, nexthdr, flags = 0;
+       uint8_t nexthdr;
+       __be16 frag_off;
+       int err;
 
        err = check_header(skb, nh_ofs + sizeof(*nh));
        if (unlikely(err))
                return err;
 
        nh = ipv6_hdr(skb);
+       nexthdr = nh->nexthdr;
+       payload_ofs = (u8 *)(nh + 1) - skb->data;
 
        key->ip.proto = NEXTHDR_NONE;
        key->ip.tos = ipv6_get_dsfield(nh);
@@ -274,9 +277,10 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
        key->ipv6.addr.src = nh->saddr;
        key->ipv6.addr.dst = nh->daddr;
 
-       nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags);
-       if (flags & IP6_FH_F_FRAG) {
-               if (frag_off)
+       payload_ofs = ipv6_skip_exthdr(skb, payload_ofs, &nexthdr, &frag_off);
+
+       if (frag_off) {
+               if (frag_off & htons(~0x7))
                        key->ip.frag = OVS_FRAG_TYPE_LATER;
                else
                        key->ip.frag = OVS_FRAG_TYPE_FIRST;
@@ -284,11 +288,11 @@ static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key)
                key->ip.frag = OVS_FRAG_TYPE_NONE;
        }
 
-       /* Delayed handling of error in ipv6_find_hdr() as it
-        * always sets flags and frag_off to a valid value which may be
+       /* Delayed handling of error in ipv6_skip_exthdr() as it
+        * always sets frag_off to a valid value which may be
         * used to set key->ip.frag above.
         */
-       if (unlikely(nexthdr < 0))
+       if (unlikely(payload_ofs < 0))
                return -EPROTO;
 
        nh_len = payload_ofs - nh_ofs;