From patchwork Thu Mar 7 13:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuhao zhou X-Patchwork-Id: 1909402 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=GA0EwJva; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4TrGDr0Ktpz1yWy for ; Fri, 8 Mar 2024 04:16:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 17A4F41BB0; Thu, 7 Mar 2024 17:16:42 +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 cGq0cDlwMSka; Thu, 7 Mar 2024 17:16:40 +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 smtp4.osuosl.org AEFF540717 Authentication-Results: smtp4.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=GA0EwJva Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id AEFF540717; Thu, 7 Mar 2024 17:16:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7D85AC008E; Thu, 7 Mar 2024 17:16:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id B0C40C0037 for ; Thu, 7 Mar 2024 13:19:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9FF9240BB2 for ; Thu, 7 Mar 2024 13:19:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7fqoWw5FGhzp for ; Thu, 7 Mar 2024 13:19:19 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::229; helo=mail-oi1-x229.google.com; envelope-from=zhouyuhao.philozhou@bytedance.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 70F7A40964 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 70F7A40964 Authentication-Results: smtp2.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=GA0EwJva Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by smtp2.osuosl.org (Postfix) with ESMTPS id 70F7A40964 for ; Thu, 7 Mar 2024 13:19:18 +0000 (UTC) Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3c1ea425a0fso348534b6e.3 for ; Thu, 07 Mar 2024 05:19:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1709817557; x=1710422357; 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=Ay4j+o3S1A8Pb5GJycM8eMIaKeO/pOSulMyXwMmaCBI=; b=GA0EwJva0+gRWzxdubAruviD8XlK8rWC9+cxRn9j/r9JWNaxlJlxGZvwJehsWHEfvw 9pedm6+sRw/DawbW892aVLyygE4HfTfR3Ut63COEnnHbsmpBk/nO/1r2zfH53H2JyR2m dEX1chxIV1V9FpNULtIN0iwMWflIztzg9/AhyZFS/Fcm+b9LA7N0bilZZfX+82FLT+lv ZEiUxFz0KzYgo07J1khQo12VDMC6nRrI0VpzYqL0rx+TE/+L4wItR+GO3JlgBqNTzG7Z 3+B4WGUVApOYt+wgoUUz63CqZu4+YanBkkYTMH28LnXrKvRbUaUZSYKSkHABUCIQIRWl AwHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709817557; x=1710422357; 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=Ay4j+o3S1A8Pb5GJycM8eMIaKeO/pOSulMyXwMmaCBI=; b=ZEggUdozwd7QLNDIKkVKyYDdQzVEVhGV1sYeEqjiJyHxiVbV7Kr28eO/e5WKDdVWgF MpNc8slQ06t5u/Ud4IFrCOXJR5WST/MWxXCRJIVKczqlUD0KUIO2T/qvUMIDBeXIwVe2 McAevgNCjx/YHSVbtEnGJck/uigt+IGZS7m96Q15a4HB/563o14LRgxzVU5/XEugMa88 5E/qeBDLAA1KBnZA83SjCjNJlaBzJ2WIOgvCaJrwJ1XJk/ycGcLkbVTYXh+V8fouLjbt Z2SoC0sSValPLxeOM4o5SNG6ZEfbVwOBUCb8Yz23eLhPMTlw2Y193i+tHdE3rXnouSV1 i4oQ== X-Gm-Message-State: AOJu0YxX9wCWirlapIAdoE+IYuCkh0vBsvdCMZwghQL/euOiZ98eUAae h4QoU5MAs+P3aUXL46/4m8l6EpjefQe+aDbfkUp0hBQBPlsvIili8PSL7mu8YgGBMLUF6EFi8C3 PKg== X-Google-Smtp-Source: AGHT+IGSKBnQfBiVTzLrYetO8KUzXIojhGyE671xGoLi2/SsgCaHD7l5Sz97gNDqtmnyw0z5NsYk9Q== X-Received: by 2002:a05:6808:7c2:b0:3c2:1f6b:ae6e with SMTP id f2-20020a05680807c200b003c21f6bae6emr3459447oij.12.1709817557301; Thu, 07 Mar 2024 05:19:17 -0800 (PST) Received: from X5TXGW7TL2.bytedance.net ([61.213.176.5]) by smtp.gmail.com with ESMTPSA id l185-20020a6388c2000000b005dab535fac2sm12378190pgd.90.2024.03.07.05.19.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Mar 2024 05:19:17 -0800 (PST) To: dev@openvswitch.org Date: Thu, 7 Mar 2024 21:18:42 +0800 Message-Id: <20240307131842.45318-1-zhouyuhao.philozhou@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 07 Mar 2024 17:16:39 +0000 Cc: "zhouyuhao.philozhou" Subject: [ovs-dev] [PATCH] ofproto: Fix mod flow table name not to take effect. When mod a flow table's name with table's prefix name, there will be no change. 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" 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 \