From patchwork Wed Apr 3 07:03:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuhao zhou X-Patchwork-Id: 1919052 X-Patchwork-Delegate: horms@verge.net.au 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=OO5q0lYk; 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 4V8bLz4zx2z23tl for ; Wed, 3 Apr 2024 18:03:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 95964406D8; Wed, 3 Apr 2024 07:03:35 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tPmIyX1nrRBM; Wed, 3 Apr 2024 07:03:34 +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 08B6B4053B 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=OO5q0lYk Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 08B6B4053B; Wed, 3 Apr 2024 07:03:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C267FC0072; Wed, 3 Apr 2024 07:03:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2F804C0037 for ; Wed, 3 Apr 2024 07:03:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0672881F9B for ; Wed, 3 Apr 2024 07:03:32 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id C15uao3SVzA1 for ; Wed, 3 Apr 2024 07:03:30 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::42c; helo=mail-pf1-x42c.google.com; envelope-from=zhouyuhao.philozhou@bytedance.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 4E27D81F8A Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4E27D81F8A Authentication-Results: smtp1.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=OO5q0lYk Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4E27D81F8A for ; Wed, 3 Apr 2024 07:03:29 +0000 (UTC) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6ead4093f85so5679314b3a.3 for ; Wed, 03 Apr 2024 00:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1712127809; x=1712732609; 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=OO5q0lYkK3YY1pCKu2vHmKFX9NVJ5DT+q2GGXxiOpVyvnk8Kk5poWylfCJ7FL8N/i3 l3D+OwvJUTuaHQDsla7UIqIFZ0MbX3jGWKG+pgADCrvJJscS3LFPjdAOr39Bqk44T0Jn NEAuFVCP/sZtA4L5qqZff1hPstmVrCclxPPSjP2Woty96u7Js77fQTXo3odaLfxkOGkw YahTYe/51oiftmXH5OEU5CnWVEUJ/yDpmmquLFxKmky54XahYewP1I6caDbr+BOvIofP +oFMNvLmZHnFqrvO/UnPtXLVATpKHHOa+7aJEMABK3jZd9xQXeCUJQ935qlcqJYPBQjZ fOpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712127809; x=1712732609; 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=ZRh/moEJrdbRXeAxKPhTGUwSWPbLuCwhsbJexm9MF6H8f97NC7TbxqPuWCQYhVCGkn zTujH88OAdMiVNgDuYfORRdeMY19ylM3NNqxwgm2j+dpA9BGdA9ShUCwOf1UY07k17bH JHHdqGRet66eAlo7FS4ZjI6xKETpogd6Zr/9BFZEbeOyZoZoKOx4RIkL1pjlKu3VbCue K92KMS2JtKhYKSgsopYZSLdhikmnpcZcAjY1r3VcEtvQvtwrUJ3E02502c+ne8fRy+Tq 6efnlz4zHa9QigXLs533ohaehyFhFifDteu4/Ckm1l0Sq4xbWXyv+NwxgGeviI8MrBNT ObUA== X-Gm-Message-State: AOJu0Yz2jYXnaKYf8aEbpLj/GOrrTflRUn/QsGnyJMMcW+pwRanNMTxo YXF14kttk03fPf8tTeReIi8dBC7lhIE86ycO/YvpeBT+pq38+R1JXDmnCEQsnPHl9QUI/bRsU4Q = X-Google-Smtp-Source: AGHT+IECSl+QLzSoZefaRcpcmEezzGRWS+9tGJ2pph+wJ2QdsWa7YRgz8SwQfy2rrAQD+jwChVRH8A== X-Received: by 2002:a05:6a00:23ca:b0:6e7:117:c5d5 with SMTP id g10-20020a056a0023ca00b006e70117c5d5mr15176638pfc.23.1712127808908; Wed, 03 Apr 2024 00:03:28 -0700 (PDT) Received: from X5TXGW7TL2.bytedance.net ([61.213.176.11]) by smtp.gmail.com with ESMTPSA id g29-20020a63565d000000b005f05b06229dsm10864684pgm.41.2024.04.03.00.03.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 03 Apr 2024 00:03:28 -0700 (PDT) To: dev@openvswitch.org Date: Wed, 3 Apr 2024 15:03:19 +0800 Message-Id: <20240403070319.43836-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