Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3706392ybv; Mon, 10 Feb 2020 05:04:09 -0800 (PST) X-Google-Smtp-Source: APXvYqyKL4knxkarN/E5L8U8l+pww5lYfbYG0JbXSLUTIA879Hmj8w54yJlxkdV8zxd+Dwj2jn1E X-Received: by 2002:a05:6830:20c4:: with SMTP id z4mr1026826otq.260.1581339849678; Mon, 10 Feb 2020 05:04:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339849; cv=none; d=google.com; s=arc-20160816; b=fBq2ix46OiQDyXsOLdIdmvElfzr24mnSE8DNgmXDwxDxnwKDbPYv8RHoAJpUWmNTon sWCI0ehAStLx5kEuCf8YkwwtENTY75q0tc29RgslYNvlsKZi56hoCRimRCidcX0bkqMg e7yIIn0kH/eY41zT7czFQdh75643/QB2W2V2hg9zrYJH1ajDwQlZK6qlYM76z+4tEJf1 3FJ+W0d3/9/iucc/p9+XqTxv4SpMqGk+DJZyHM+cd2Dk3qK3ARH3iVvFmnJ6upJeG2S2 n4vXWXlowtZVqYpWHZgVQNHH6Jd+LbwHptCvGxn5Moq7rYcgtBqrBB4jCiCFBtxFr8EK Uv3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U5U03pkhFZ6Cp8i1K4giPQwy5GE134d/yc3tFcRkLRo=; b=beP1rkQUBy+7SApzg/bt/9yZjxs3TFNBAlu2g7UKX0HD0wB9ptr7xiykOFcXJFRrPm 3xyYfArZcfRHq92d7VTgscs4AaUZXoVf22pIjSeFrtAR8xIlYbnzhZkk2KTxtxG1nfyQ 7VM5JmZKqEne/Tw5cgfzI1CRGi8PFdm0WhY5kvnW9ATPiy3hgs/l/QnvGwHAsC8JkhIx dpXKaLMn+Vnyc4hLA/fUvsnRFUB3+EDTzJkRSAqW9g3hTQfGf/AiKnTRAFj2tpTkrzE9 y+WxfOgnquszNe6RVuS2yE47Yu1GTtPxzo40B07yl3MA0VEdru/bpONoc4GY0ZbJ/LYZ 10mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L72Sm8FN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x198si151943oif.108.2020.02.10.05.03.57; Mon, 10 Feb 2020 05:04:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L72Sm8FN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729880AbgBJNBY (ORCPT + 99 others); Mon, 10 Feb 2020 08:01:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:41670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729819AbgBJMkw (ORCPT ); Mon, 10 Feb 2020 07:40:52 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE2A424649; Mon, 10 Feb 2020 12:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338451; bh=wfhldRfpw6pM2pN4pyuGtEyqB7dfoNUAfga4gO1dHTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L72Sm8FNUgyJKCA0heVQRgctvnm9fZTz1Yx4LJT+vJtsM9wQzExjlMZc8Vgz6YwdD ZsyaBTdm1/85875J6nBaNnz7H7T5ipDw1zu/4IhZ6+HFVlM0lDIs4VFsDCPLdgPOXx nt1yLmCZdyyseWwcvMw1UC2bG+w31SRGiBy5s+V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshiki Komachi , Daniel Borkmann , Petar Penkov , John Fastabend Subject: [PATCH 5.5 162/367] flow_dissector: Fix to use new variables for port ranges in bpf hook Date: Mon, 10 Feb 2020 04:31:15 -0800 Message-Id: <20200210122439.777788779@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yoshiki Komachi commit 59fb9b62fb6c929a756563152a89f39b07cf8893 upstream. This patch applies new flag (FLOW_DISSECTOR_KEY_PORTS_RANGE) and field (tp_range) to BPF flow dissector to generate appropriate flow keys when classified by specified port ranges. Fixes: 8ffb055beae5 ("cls_flower: Fix the behavior using port ranges with hw-offload") Signed-off-by: Yoshiki Komachi Signed-off-by: Daniel Borkmann Acked-by: Petar Penkov Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20200117070533.402240-2-komachi.yoshiki@gmail.com Signed-off-by: Greg Kroah-Hartman --- net/core/flow_dissector.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -834,10 +834,10 @@ static void __skb_flow_bpf_to_target(con struct flow_dissector *flow_dissector, void *target_container) { + struct flow_dissector_key_ports *key_ports = NULL; struct flow_dissector_key_control *key_control; struct flow_dissector_key_basic *key_basic; struct flow_dissector_key_addrs *key_addrs; - struct flow_dissector_key_ports *key_ports; struct flow_dissector_key_tags *key_tags; key_control = skb_flow_dissector_target(flow_dissector, @@ -876,10 +876,17 @@ static void __skb_flow_bpf_to_target(con key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; } - if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) { + if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) key_ports = skb_flow_dissector_target(flow_dissector, FLOW_DISSECTOR_KEY_PORTS, target_container); + else if (dissector_uses_key(flow_dissector, + FLOW_DISSECTOR_KEY_PORTS_RANGE)) + key_ports = skb_flow_dissector_target(flow_dissector, + FLOW_DISSECTOR_KEY_PORTS_RANGE, + target_container); + + if (key_ports) { key_ports->src = flow_keys->sport; key_ports->dst = flow_keys->dport; }