Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3320431pxf; Mon, 15 Mar 2021 07:05:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5r12VObRUoxb5iSxETSMfBD8TAP0RUoQNwSgmwjxMFD1uFVZlySDErtxAEPxjyqU3CQwM X-Received: by 2002:a05:6402:b21:: with SMTP id bo1mr29760486edb.368.1615817128482; Mon, 15 Mar 2021 07:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817128; cv=none; d=google.com; s=arc-20160816; b=WY3X7/FaDJfbf4ezeSmaxChPazjU1wm++0dcqRyegvU2oTfDRaN5IRhKn0N2hmBb40 0+xKm6wrxg6CdKUScdbL63ud5+crZnAHYljnggsGU4m+bwbfJbH8djgIwN2oodPk4f8z AgCfLGn7SsUxxb0g3jL6GlzqETJshejKEiqJjmsuMTegPIVz1MJ5UX0/D34+45M5OkOi q5eS9gup2HS/qKEijPvv8WzOeleH5cSNnqQqgd9qjp/iAK1EmcHVmcmUn68WTES5eoh2 0w84ZfA0uaA2C7IuzRKbSb2JEw83/sLYDzGEUQXmCRlzhm5kZjnaBT82q78y8+m87qS/ /jQw== 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=tCJkYtC43+NbyvSCUFYKuNoiFayflG2MZd048Q6Qb5qsKPc+yooqAjKQjJ1MgonKay CCSNM2lTjRVtv5j66jkclA+S3tp9/I9UM5BaYPprLraaFskNu+XWzXPe8M2Nih8Z65nH D4zKOD6NxVP6VDToEN1/ZDVYN4zUuaC4aq7wRv80e+0wCZAW78N7HmQ4UtE5KVGvCdQg swcJZ0JLCXv+hxgZm0tfXnKu1uC1EBi2FvdRYcM7Ecx7WolfcHqDjbIIzgR/w1kNmrhz nzN6mYjW6U0QHo2kEe4sV13ad5p047e/K/QFHPqFywZv9reCYxiDGrbegI5Y82Uhzw+M z7dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ib0c51Q; 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 a19si11035485ejt.403.2021.03.15.07.05.04; Mon, 15 Mar 2021 07:05:28 -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=1ib0c51Q; 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 S234519AbhCOODt (ORCPT + 99 others); Mon, 15 Mar 2021 10:03:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:34280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbhCON5Q (ORCPT ); Mon, 15 Mar 2021 09:57:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3848E64EEC; Mon, 15 Mar 2021 13:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816635; bh=jSKspWM7EfzKqcDjD2f4ifI8H3zPgj3EYllVYCjybuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ib0c51QCRNW6em5vb5+FaP8c0k19tKAJqhlyzr+fTGi+fg/v184QKWgqX517UDqd kpxsvGHoids220aSUyL63SKFzlQxBYFmZxieqoc0qe1BZfzdbJtURwOJYW35dzLuLV KxYnzlhUDbeA8MsDYCStctokbczOoJAOYXCtu8kU= 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.4 017/168] selftests/bpf: No need to drop the packet when there is no geneve opt Date: Mon, 15 Mar 2021 14:54:09 +0100 Message-Id: <20210315135550.908514716@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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);