From patchwork Mon Jan 31 10:34:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1586596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E9JlkJpR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JnPbC5xhnz9s8q for ; Mon, 31 Jan 2022 21:35:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2A38860EA8; Mon, 31 Jan 2022 10:35:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BHCcoyzbmR-W; Mon, 31 Jan 2022 10:35:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6FFD960E15; Mon, 31 Jan 2022 10:35:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 45DA4C0011; Mon, 31 Jan 2022 10:35:16 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9D13BC000B for ; Mon, 31 Jan 2022 10:35:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 77FF460E3C for ; Mon, 31 Jan 2022 10:35:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KdZXBeKgqTj7 for ; Mon, 31 Jan 2022 10:35:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id D8B8C60EA9 for ; Mon, 31 Jan 2022 10:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643625309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oN0iscRP7IHfXLr2KE2LAHBKrmv7VvzoBG9asqjJeD4=; b=E9JlkJpRnKCm6wpc+jKbJIIRa7lO/VMLDw4rDN0zSyZMFy0ev3XFqeDXoc+mV36BjahzZ4 +OUiMBEgHzukhOwILPgvVvnMuIxHJGHJjU71ZfSZnVpK8NZDy5/Xao2UDMoUJbghEI+zRl LNATwLrHIOKpJ3dANQZMlmwhKL+A0lA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-155-5SBfBD29PCuxOYCAun-l3g-1; Mon, 31 Jan 2022 05:35:06 -0500 X-MC-Unique: 5SBfBD29PCuxOYCAun-l3g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62FCB1B2C980; Mon, 31 Jan 2022 10:35:05 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.194.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC53D756ED; Mon, 31 Jan 2022 10:35:04 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Mon, 31 Jan 2022 11:34:55 +0100 Message-Id: <164362528978.2824752.6964902999127156.stgit@ebuild> In-Reply-To: <164362511347.2824752.11751862323892747321.stgit@ebuild> References: <164362511347.2824752.11751862323892747321.stgit@ebuild> User-Agent: StGit/1.1 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=echaudro@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2 04/10] netdev-offload-tc: Check for valid netdev ifindex in flow_put X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Verify that the returned ifindex by netdev_get_ifindex() is valid. This might not be the case in the ERSPAN port scenario, which can not be offloaded. Signed-off-by: Eelco Chaudron Acked-by: Roi Dayan --- lib/netdev-offload-tc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 9845e8d3f..8135441c6 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1842,6 +1842,15 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, return ENODEV; } action->out.ifindex_out = netdev_get_ifindex(outdev); + + if (action->out.ifindex_out < 0) { + VLOG_DBG_RL(&rl, + "Can't find ifindex for output port %s, error %d", + netdev_get_name(outdev), action->out.ifindex_out); + + return -action->out.ifindex_out; + } + action->out.ingress = is_internal_port(netdev_get_type(outdev)); action->type = TC_ACT_OUTPUT; flower.action_count++;