From patchwork Wed Dec 5 18:55:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1008393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="truA01EB"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4397M43Kxzz9s8J for ; Thu, 6 Dec 2018 05:59:28 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id B38A0B8F; Wed, 5 Dec 2018 18:56:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 50DAEB79 for ; Wed, 5 Dec 2018 18:56:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id F0F0A830 for ; Wed, 5 Dec 2018 18:56:03 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id 17so9444976pgg.1 for ; Wed, 05 Dec 2018 10:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lkvyKmB0RG/1xagOCeVie1r3EYUbJHV62bPSj2X9/qA=; b=truA01EBnaAEfrWl/iOFv6elUuqGEIyn3Jd70iNqGHgXQ5CL0cbPKkvFArYh/wGls/ EB6O/csLowu2l69Ie9pgv5lxaJ260lr5QdVyM9fzubGoV45mGswqp6SMAMtuyBJyDVMj VBzqosiUAIAxVZHPxATuIUVA2Ofty58uCGmk4L3bw3qz20dnHXsY1S7+ywrdzbxao7ST 2fCMq0bq0gO4GXDzCstsbW25Qx3xLY92O1uJAMLggj1lTk91b8fx4aFwrSxPMipWb/SC jam5T9dbrCVfzGXOEnlLuHY2Hx86daxmKg5EynpwAnk/vqvvUePIno/BQF40/rrH6Nlh WR+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lkvyKmB0RG/1xagOCeVie1r3EYUbJHV62bPSj2X9/qA=; b=ba+oUi70GziMA06LVAJuCiS2F5Hvb16w78ZcKd4bc2iQ4+th2/6wsHjcqI8hDOzVxx vcS6h7tfu0PRk6ZkVawlvFwEzp/r/sGbm3IsFdpctum9afoUl2gCunNIDudv+Leu1KHl 0tM4dBxCHqr5nTzqyP2LP1beY1gYahb1igUomp0RVjvCZLsfimJ8pQ/uANa/CKEHxzrZ bQBwOsznMc5CcJloRhexGuRhpCMxb2Rt/TyRX724Brv11waIu8ftuFLxpU2Q+6lmOpq2 X+QGy8fIaH4yKU+PzdYv7Vfm/EeEX13CIR/VKBiYt8WKf/a+d4+k8nOd2wNau+9BvWq7 jZlA== X-Gm-Message-State: AA+aEWZegfP2QwqsdOarH9ru5v+JmwaYvjFFqH005nBAW/oM7js0nSXs h4Q4EOtKx9TYxyC09GwYFoG9E/hV X-Google-Smtp-Source: AFSGD/WJf5/bWRp8u7v0VXPPI5qWChj5OocuepIJyHFFI7u760H2KDNNgAUyyVEyl6GvhRRaiuY8BA== X-Received: by 2002:a63:160d:: with SMTP id w13mr22038806pgl.43.1544036163265; Wed, 05 Dec 2018 10:56:03 -0800 (PST) Received: from gizo.domain (97-115-96-17.ptld.qwest.net. [97.115.96.17]) by smtp.gmail.com with ESMTPSA id q187sm93627156pfq.128.2018.12.05.10.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:02 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Wed, 5 Dec 2018 10:55:49 -0800 Message-Id: <1544036152-27247-6-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> References: <1544036152-27247-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 5/8] datapath: Derive IP protocol number for IPv6 later frags X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Yi-Hung Wei Upstream commit: commit fa642f08839bf2ff35b2f6c6a6c062aee8121ba8 Author: Yi-Hung Wei Date: Tue Sep 4 15:33:41 2018 -0700 openvswitch: Derive IP protocol number for IPv6 later frags Currently, OVS only parses the IP protocol number for the first IPv6 fragment, but sets the IP protocol number for the later fragments to be NEXTHDF_FRAGMENT. This patch tries to derive the IP protocol number for the IPV6 later frags so that we can match that. Signed-off-by: Yi-Hung Wei Acked-by: Pravin B Shelar Signed-off-by: David S. Miller CC: Yi-Hung Wei Signed-off-by: Greg Rose Acked-by: Yi-Hung Wei --- datapath/flow.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/datapath/flow.c b/datapath/flow.c index fadc074..f685cf3 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -254,21 +254,18 @@ 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; - uint8_t nexthdr; - __be16 frag_off; - int err; + int err, nexthdr, flags = 0; 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); @@ -277,10 +274,9 @@ 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; - payload_ofs = ipv6_skip_exthdr(skb, payload_ofs, &nexthdr, &frag_off); - - if (frag_off) { - if (frag_off & htons(~0x7)) + nexthdr = ipv6_find_hdr(skb, &payload_ofs, -1, &frag_off, &flags); + if (flags & IP6_FH_F_FRAG) { + if (frag_off) key->ip.frag = OVS_FRAG_TYPE_LATER; else key->ip.frag = OVS_FRAG_TYPE_FIRST; @@ -288,11 +284,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_skip_exthdr() as it - * always sets frag_off to a valid value which may be + /* Delayed handling of error in ipv6_find_hdr() as it + * always sets flags and frag_off to a valid value which may be * used to set key->ip.frag above. */ - if (unlikely(payload_ofs < 0)) + if (unlikely(nexthdr < 0)) return -EPROTO; nh_len = payload_ofs - nh_ofs;