The kernel datapath cannot hold ports whose names are IFNAMSIZ bytes
or longer, so dpif_netlink_port_query_by_name() can never find them.
During restart the ofproto construct path calls dpif_port_exists() for
every configured interface. For ports with long names (for example
patch ports) this reached the kernel, which returned an error that was
logged as a spurious "failed to query port <long_port_name>: Invalid
argument" warning.
Return ENODEV early when the name is too long, avoiding the round-trip
and the misleading log message.
Fixes: c19e653509de ("datapath: Change userspace vport interface to use Netlink
attributes.")
Signed-off-by: Reuven Plevinsky <[email protected]>
---
lib/dpif-netlink.c | 4 ++++
tests/system-interface.at | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 2bf7e7cf27c1..5aa99dbe0efa 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -1130,6 +1130,10 @@ dpif_netlink_port_query_by_name(const struct dpif
*dpif_, const char *devname,
{
struct dpif_netlink *dpif = dpif_netlink_cast(dpif_);
+ if (strlen(devname) >= IFNAMSIZ) {
+ return ENODEV;
+ }
+
return dpif_netlink_port_query__(dpif, 0, devname, dpif_port);
}
diff --git a/tests/system-interface.at b/tests/system-interface.at
index 20a882d1cfe6..640bfd638fb7 100644
--- a/tests/system-interface.at
+++ b/tests/system-interface.at
@@ -231,3 +231,27 @@ AT_CHECK([grep 'name too long' stderr], [0], [ignore])
OVS_TRAFFIC_VSWITCHD_STOP(["/could not open network device.*name too long/d"])
AT_CLEANUP
+
+AT_SETUP([interface - patch port name exceeds IFNAMSIZ on vswitchd restart])
+
+OVS_TRAFFIC_VSWITCHD_START()
+
+dnl Kernel datapath only.
+AT_SKIP_IF([! ovs-appctl dpctl/show | grep -q ovs-system])
+
+AT_CHECK([ovs-vsctl -- \
+ add-br br1 -- set bridge br1 fail-mode=secure \
+ -- add-port br0 long_patch_peer_one \
+ -- set interface long_patch_peer_one type=patch \
+ options:peer=long_patch_peer_two \
+ -- add-port br1 long_patch_peer_two \
+ -- set interface long_patch_peer_two type=patch \
+ options:peer=long_patch_peer_one])
+
+dnl Restart ovs-vswitchd. The test will fail if any warnings are detected in
logs.
+OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
+AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --log-file -vvconn
-vofproto_dpif -vunixctl],
+ [0], [], [stderr])
+
+OVS_TRAFFIC_VSWITCHD_STOP
+AT_CLEANUP
--
2.43.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev