Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3320176pxf; Mon, 15 Mar 2021 07:05:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4gSMaRLWe47N81/L6B5MUpAqxVpXQV2Yp50gipUMUFrGOosiqe3E2b7Aw+Q66KmPSzFPh X-Received: by 2002:a17:906:c301:: with SMTP id s1mr23299431ejz.382.1615817111681; Mon, 15 Mar 2021 07:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817111; cv=none; d=google.com; s=arc-20160816; b=N9+jWnb5/7u6O9CU4AAJLcCYw31zb/m4X6cYR4E2S3hMfVCvB9kmrtIAkvt1Gdar1e 6j9xtu4/EwcBNfGTtxSUVGX3DmRgGZpRKgibhlSQ6idhdY4H6kAxWDQ8DOFc6Besf0Z7 KH7rRckNydyWxAtT76Gmd54lJ969Wc7u4SRu0vA4btC8SjFL9I5Mv68ZPn23tiDNnex/ iUBWkBbkuRykHW1z/z0YY+901uPH8WxRju1q1omTEI78+77fgv+6TZKxkVdAc2IaAD8s 6mXjsd8R45KLFBdUwUWyW2Em0Y9khAc1lTVKfb3DrPlC7kdaUNIEZJjY9M/m6YLXk76M a8gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/9g3N+FvMSDxnQZGUVHVWs7T3ctITHuivW+n/C37YHw=; b=pF4+qETsfferbMF6DSyhQ1wyLPY7TnBZksP42lr1yP3epMFJA4+W1y2/tXIHju0www Lazm1+bOvh4Z5IQ2QO/86UcXWq4gTS9wGCV6PBPtLj/n51aj8ZtihI58UrlUpE1Bxf5v KsAXJqdPD+CBJ4ymE1WRnqtIaKVhgX+9ZM9JozClLTuTsCA3cK3+ul60AQLRk0aZRhej lDgbUClBQSLtBtoEgn0XLp8Ryo3syXJd3O8YFt/OUzaekLBvLJYhy5FVf2JYMiSJYGXc yNAnCOoY33dnQChl7EXlxpg1wqDSATO2ulbsdA1ZMbFTJ0OBu4F0PKrThR2yN7MxBqi3 mVBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="K9fO/iQq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si11041544ejd.376.2021.03.15.07.04.48; Mon, 15 Mar 2021 07:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="K9fO/iQq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229847AbhCOODa (ORCPT + 99 others); Mon, 15 Mar 2021 10:03:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:34306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbhCON5M (ORCPT ); Mon, 15 Mar 2021 09:57:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88A1F64F44; Mon, 15 Mar 2021 13:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816631; bh=jSKspWM7EfzKqcDjD2f4ifI8H3zPgj3EYllVYCjybuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9fO/iQqvEWiUxT7WRF3zjovtpqTJM4kONamUMjCZu2V7s246NLGmS0tLQuUFNv4S SeYCzPftNaFc4uO+C2JSMNTLxUXxHvM5VOWGKKia9iwa06ndDrpVY7tEqSH6gDVWbG +O2/6wd3Bc9LGxFER0jkZttfcChHVSbRG8ZD/9gw= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangbin Liu , Daniel Borkmann , William Tu Subject: [PATCH 5.10 023/290] selftests/bpf: No need to drop the packet when there is no geneve opt Date: Mon, 15 Mar 2021 14:51:56 +0100 Message-Id: <20210315135542.714939400@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Hangbin Liu commit 557c223b643a35effec9654958d8edc62fd2603a upstream. In bpf geneve tunnel test we set geneve option on tx side. On rx side we only call bpf_skb_get_tunnel_opt(). Since commit 9c2e14b48119 ("ip_tunnels: Set tunnel option flag when tunnel metadata is present") geneve_rx() will not add TUNNEL_GENEVE_OPT flag if there is no geneve option, which cause bpf_skb_get_tunnel_opt() return ENOENT and _geneve_get_tunnel() in test_tunnel_kern.c drop the packet. As it should be valid that bpf_skb_get_tunnel_opt() return error when there is not tunnel option, there is no need to drop the packet and break all geneve rx traffic. Just set opt_class to 0 in this test and keep returning TC_ACT_OK. Fixes: 933a741e3b82 ("selftests/bpf: bpf tunnel test.") Signed-off-by: Hangbin Liu Signed-off-by: Daniel Borkmann Acked-by: William Tu Link: https://lore.kernel.org/bpf/20210224081403.1425474-1-liuhangbin@gmail.com Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c @@ -446,10 +446,8 @@ int _geneve_get_tunnel(struct __sk_buff } ret = bpf_skb_get_tunnel_opt(skb, &gopt, sizeof(gopt)); - if (ret < 0) { - ERROR(ret); - return TC_ACT_SHOT; - } + if (ret < 0) + gopt.opt_class = 0; bpf_trace_printk(fmt, sizeof(fmt), key.tunnel_id, key.remote_ipv4, gopt.opt_class);