diff mbox series

[ovs-dev] 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.

Message ID 20240307131842.45318-1-zhouyuhao.philozhou@bytedance.com
State Superseded
Headers show
Series [ovs-dev] 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. | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Yuhao zhou March 7, 2024, 1:18 p.m. UTC
From: "zhouyuhao.philozhou" <zhouyuhao.philozhou@bytedance.com>

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 <zhouyuhao.philozhou@bytedance.com>
---
 ofproto/ofproto.c |  4 +++-
 tests/ofproto.at  | 12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

0-day Robot March 7, 2024, 5:39 p.m. UTC | #1
Bleep bloop.  Greetings Yuhao zhou, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: The subject, '<area>: <summary>', is over 70 characters, i.e., 132.
Subject: 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.
Lines checked: 60, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

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 \