From patchwork Fri Mar 8 07:05: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: 1909536 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=eiFJKXO1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4Trcdm5B7Vz1yWx for ; Fri, 8 Mar 2024 18:06:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A570182123; Fri, 8 Mar 2024 07:06:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gQ2-9wNLMRnp; Fri, 8 Mar 2024 07:05:59 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 83B2781EFC Authentication-Results: smtp1.osuosl.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=eiFJKXO1 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 83B2781EFC; Fri, 8 Mar 2024 07:05:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 644F3C0072; Fri, 8 Mar 2024 07:05: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 D8C85C0037 for ; Fri, 8 Mar 2024 07:05:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id AC28E40A01 for ; Fri, 8 Mar 2024 07:05:57 +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 gDMghD5PIx4E for ; Fri, 8 Mar 2024 07:05:56 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::42d; helo=mail-pf1-x42d.google.com; envelope-from=zhouyuhao.philozhou@bytedance.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 28E8440728 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 28E8440728 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=bytedance.com header.i=@bytedance.com header.a=rsa-sha256 header.s=google header.b=eiFJKXO1 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by smtp4.osuosl.org (Postfix) with ESMTPS id 28E8440728 for ; Fri, 8 Mar 2024 07:05:55 +0000 (UTC) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e5dddd3b95so1315994b3a.1 for ; Thu, 07 Mar 2024 23:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1709881555; x=1710486355; 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=fa0sFUE9GV9l60LMkRpGH0en0S4CFWBBj7bFlQq1gdY=; b=eiFJKXO1PaiP2Lw1Dvp7K2DSRinQgvUknzQiFTe/+AfrNl31adtbhGz+8z7PeXlqcG fvwHueOiabBPxzjx4nHY9FJGaj8DN3TVTwS7joHEy7z8AMLpeyitA+GVoWs1C/xiHfWZ NvlWkYGiJN0zUWZPs6cxSwTCjzLU/S7bzyoT5nLDQN1YmsYXaYc35vCaqZ/RlwjNWqUV emjjATC1kEQ1c+vzb0zwvZsftm+lEYvsMIynPk0gaTMIWVn7eA3eIIF17Y7m+F8vnJVl xgWTBJDV1zYnua/IO0u9gKikWETspV+sDNy7y17NWW5srzuCdLvGSZgtWNXYMtGRYdnI jeBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709881555; x=1710486355; 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=fa0sFUE9GV9l60LMkRpGH0en0S4CFWBBj7bFlQq1gdY=; b=AC8lvtm4ia+eeuqpx1EXZg3qtu8flc3Nf+0mMBB4VQdzDJF2+kPG241YE1MKFpe0kO +anLKYPsoYrJc4B3WzvQ6n27Y+A6X1xuGGmNX6IOCQ/RCH+cvjAEyPLxojR5/V/TryN/ ++bFGnIZZR/ZXmRLxEybnC0+jSGL1OPapi3SN8EaVrY2C6BBfaNibYTE9SSQudJyLlpC jWR6id8jS9nK5pP/14IPgur38cJVCfYGyS5f238/0y7QJqynwdNhTBZImHjSKTIDLXOu ZtJkG211tsMuWwlhFfZcUGDRHQnUZMNXodBjtDU9QaHWvrYrSC3GsfvA5JwPzIH2/jl7 IsMg== X-Gm-Message-State: AOJu0YwKlKLNc7wxQH9A45ttd4iyiqt6hkht/XvxJnyu2CjAYoSWetnH rBzLMTO1RgJkxJAPqpnL0K1aurn9qB3KijUivVtTFwWs6M5bXhLE1b1UluCiUak7DkOO/128tyb eFA== X-Google-Smtp-Source: AGHT+IHG4wCfXXsnbzRJUt05lMrDYG+fU4EPn/OhOHOGbhIFXF4bRErsEF/BH+MUQe6HA6ncopIhRQ== X-Received: by 2002:a05:6a00:98f:b0:6e5:599a:5252 with SMTP id u15-20020a056a00098f00b006e5599a5252mr6037418pfg.15.1709881554810; Thu, 07 Mar 2024 23:05:54 -0800 (PST) Received: from X5TXGW7TL2.bytedance.net ([61.213.176.7]) by smtp.gmail.com with ESMTPSA id x16-20020aa784d0000000b006e55d5215dbsm13520505pfn.87.2024.03.07.23.05.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Mar 2024 23:05:54 -0800 (PST) To: dev@openvswitch.org Date: Fri, 8 Mar 2024 15:05:47 +0800 Message-Id: <20240308070547.35133-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..b68881a27 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -2418,6 +2418,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: +]) + # Set some table names via OVSDB. AT_CHECK( [ovs-vsctl \