From patchwork Fri Mar 8 08:23:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuhao zhou X-Patchwork-Id: 1909544 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=cujcUL1b; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4TrfLz3WbBz1yX8 for ; Fri, 8 Mar 2024 19:23:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8F0E540ACA; Fri, 8 Mar 2024 08:23: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 YINZ3gkpSNam; Fri, 8 Mar 2024 08:23:19 +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 smtp2.osuosl.org 64C25402A8 Authentication-Results: smtp2.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=cujcUL1b Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 64C25402A8; Fri, 8 Mar 2024 08:23:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 27A90C0077; Fri, 8 Mar 2024 08:23:19 +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 1D8ADC0037 for ; Fri, 8 Mar 2024 08:23:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 04C7760753 for ; Fri, 8 Mar 2024 08:23:17 +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 efhvLtvWEX8C for ; Fri, 8 Mar 2024 08:23:14 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::335; helo=mail-ot1-x335.google.com; envelope-from=zhouyuhao.philozhou@bytedance.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 398BA60768 Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 398BA60768 Authentication-Results: smtp3.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=cujcUL1b Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by smtp3.osuosl.org (Postfix) with ESMTPS id 398BA60768 for ; Fri, 8 Mar 2024 08:23:13 +0000 (UTC) Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6e445b4f80bso861686a34.0 for ; Fri, 08 Mar 2024 00:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1709886192; x=1710490992; 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=cujcUL1biUjvRSFrhMlGEMjAsoQ+sERyje7xNPuuwgUS2tjBPdsGYOzMc5e/IbU1aj 7PJtXN5hRRiikW5XAa1WImkSZXvgEkhD/l6RLxUzERoB9XeEBJHcjo7OxiVEK+dqOol1 bZeEZELD+cVqofbwpIvfGulSdBSb8ak67j1W7NW4Bo6VZQ3xY/pIj5u+u5YEW0zdNlpC W5+yOwnLNQ+0HUBx8PtHDUC5VqBbEzCxL6rHFKRs4+MFcK2XLvkJmx/bDr7tlwSz5YXu iGO2FE2v7rFW/ntU7P5oAiCAcv7mqm7bMs/lNy4A3qR3Baozu+C5Li/h2m5p4cS0Zk5a UqFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709886192; x=1710490992; 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=gSmNiMIGmXMM8rfgQLsGoGCQOBWlB4dUHcIcrr4wLkgNQSg6Zll0c37iHyUuHO77Zx Ko3Jn6n2CjCXG5cnDDmZN0TPitS/B61fCTdkcJhorDdOwyvEUoDi0C3tOrOSN9aVsR6N YEhQOVXf20qLVloFsbCHFE/dDeOp++ipklYhDZO82mwNoz7Kb/IcG7eE29RsvEVAsPt7 V0y52g3HVNMrR5l9fjxQto2L+zNO4BF+vV9kmERduyEm95flQHvFUOARpQVPZRtmWh0D NipnMVOiosY4Dk5JBh4n5mqwbGhP74N1fxwh3/hD689vbNh8WqAMgjgEgUXdaj29JkDi Hx8w== X-Gm-Message-State: AOJu0YzwvLPzi93V5a0v+CMBGY0pEjbiz10kPz1j5xeL2HZo4x5iaSs2 pLPu2sxas4h/mfEIQMoE3V491/ncX4il2n1peZwQKdb1MPMw2MqGvgnNxvju6j1SpiWjdfWXRni 8vg== X-Google-Smtp-Source: AGHT+IGLycW07Q8D8wE6uG1cjbNc8Ohv1SAZI1KbWyAp8EXlUrBTXiH0itdYYodA0o1iCP4fb+lU5Q== X-Received: by 2002:a05:6830:1152:b0:6e5:ebf:ed63 with SMTP id x18-20020a056830115200b006e50ebfed63mr2659133otq.29.1709886192615; Fri, 08 Mar 2024 00:23:12 -0800 (PST) Received: from X5TXGW7TL2.bytedance.net ([61.213.176.7]) by smtp.gmail.com with ESMTPSA id d19-20020a630e13000000b005dcc8a3b26esm13476492pgl.16.2024.03.08.00.23.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 08 Mar 2024 00:23:12 -0800 (PST) To: dev@openvswitch.org Date: Fri, 8 Mar 2024 16:23:07 +0800 Message-Id: <20240308082307.44949-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 \