From patchwork Fri Mar 8 08:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuhao zhou X-Patchwork-Id: 1909546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=eCAHj/v/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TrfZ74ChHz1yX8 for ; Fri, 8 Mar 2024 19:33:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 726086089E; Fri, 8 Mar 2024 08:33:01 +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 r6eMoZ_IKA9p; Fri, 8 Mar 2024 08:32:59 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B2D6E60888 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=eCAHj/v/ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id B2D6E60888; Fri, 8 Mar 2024 08:32:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 83EE4C0077; Fri, 8 Mar 2024 08:32:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id B90CAC0037 for ; Fri, 8 Mar 2024 08:32:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 72B0941BC0 for ; Fri, 8 Mar 2024 08:32:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4mHaK_8CBUgV for ; Fri, 8 Mar 2024 08:32:55 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4860:4864:20::30; helo=mail-oa1-x30.google.com; envelope-from=zhouyuhao.philozhou@bytedance.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 6918741BAB Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6918741BAB Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=eCAHj/v/ Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6918741BAB for ; Fri, 8 Mar 2024 08:32:55 +0000 (UTC) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-221a2d0c5dcso94971fac.0 for ; Fri, 08 Mar 2024 00:32:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1709886774; x=1710491574; darn=openvswitch.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BqvPnjMMyB9aF5lGGfWXmOyktMMbUlRvErs5hhUKOek=; b=eCAHj/v/hsUfn+rcETnGDDmao9OTgKoM2fMuFHv7jeaSRI6xMy5+OMPoONUBA9RbtI 8/kVQDYHdjlkuxQxPyEhajcIpfizviAcBaf6bJUqZ3c6x87p619ZrxfRH3DArD1y63vu 7PNzmimRvt0E+e5h9NxjRy/6zZsX3LHMsf7hUSC/55jOGscveQPRmQ5tZ131AURKnYYR a0MphR3G1ydujtKfgjmGzCOlRuvB25geaLklV0cjM9FnAHttbTvU3FJG0sP+UbvdAPHo RCJRbnC8/3gJJNM2GiEWphoqCDjK7/2QobBFlgZtZP8W1zJ4uZKcwduLKq5NpCJbPVjl Zaqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709886774; x=1710491574; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BqvPnjMMyB9aF5lGGfWXmOyktMMbUlRvErs5hhUKOek=; b=rVY10MkAcHbuuOKZhtLc+y5Al1EZcaE0rmz0NwGaedX/D4aubmtU1V/nVpO8bOQpmV OjYMNt0ruA/Yhj/jSQN/TbJZNTqOAUvQVckuLOH9yHgwUGOLtS035Pj5M+iJjm8y540f dfdxaaFrhsoDnvUTJMB2yhZYteNx1of0g74McmzILL4fBCKwragNo3nDY/3B1YJQDXxV 5zqzkex8110bIfC0C4FpENl4wtTcjjSr0CcfcZQEeqEOatjj8lVGBth3a4kzb55DFT9+ y/AZluloIvauvWo1XIycPK7l5pHwnZ36kWQz7qZxrRvjeGOJxNyA7LEjtmyCdOwmMixw TtPQ== X-Gm-Message-State: AOJu0YywCsAfHHCZZ0DXH5bnbwTIs34Cx4HGk3sRugslC53anIZwz2zd vCHP9WKdQWIFDwdEWvRIkZbZ5BmTidtQPenzz3mfodFti/cUou9i+gqA4eR4OK/WtXW7hEojJ58 ing== X-Google-Smtp-Source: AGHT+IFaQcyXLzkLQnNjXOPA8zeH6LZOmTKMbdvS7lWRU2G17ADIC9lNhFVtDNRaYasL46Mey0WF5Q== X-Received: by 2002:a05:6870:fe8d:b0:21e:b50c:3e8e with SMTP id qm13-20020a056870fe8d00b0021eb50c3e8emr2479089oab.56.1709886773909; Fri, 08 Mar 2024 00:32:53 -0800 (PST) Received: from X5TXGW7TL2.bytedance.net ([61.213.176.14]) by smtp.gmail.com with ESMTPSA id q22-20020a056a00085600b006e623639a80sm8405823pfk.19.2024.03.08.00.32.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 08 Mar 2024 00:32:53 -0800 (PST) To: dev@openvswitch.org Date: Fri, 8 Mar 2024 16:32:47 +0800 Message-Id: <20240308083247.46083-1-zhouyuhao.philozhou@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 Cc: "zhouyuhao.philozhou" Subject: [ovs-dev] [PATCH] ofproto: Fix mod flow table name not to take effect. 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: , X-Patchwork-Original-From: Yuhao zhou via dev From: Yuhao zhou Reply-To: Yuhao zhou Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: "zhouyuhao.philozhou" When mod a flow table's name with table's prefix name, there will be no change. Because when check whether the new and old name are the same, only compare the length of the new name. Case: table 10: "good" There will be no change if mod the table's name with "g" "go" "goo". Signed-off-by: zhouyuhao.philozhou --- ofproto/ofproto.c | 4 +++- tests/ofproto.at | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 122a06f30..bf7ed91b1 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -9293,7 +9293,9 @@ oftable_set_name(struct oftable *table, const char *name, int level) if (level >= table->name_level) { if (name) { if (name[0]) { - if (!table->name || strncmp(name, table->name, len)) { + if (!table->name + || strncmp(name, table->name, len) + || len != strlen(table->name)) { free(table->name); table->name = xmemdup0(name, len); } diff --git a/tests/ofproto.at b/tests/ofproto.at index 2889f81fb..09c57b292 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -2523,6 +2523,18 @@ AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'], table 253: ]) +# Make sure that the new name is old table's name prefix can also take effect. +AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 3 name:thr]) +AT_CHECK([ovs-ofctl -O OpenFlow15 dump-table-features br0 |grep '^ table'], + [0], [dnl + table 0 ("zero"): + table 1 ("one"): ditto + table 2: ditto + table 3 ("thr"): ditto + tables 4...252: ditto + table 253: +]) + OVS_VSWITCHD_STOP AT_CLEANUP