[ovs-dev] [PATCH] dpif-netlink: "bonding_masters" is a reserved name

Timothy Redaelli tredaelli at redhat.com
Wed Jun 23 12:12:01 UTC 2021


Currently, on Linux, if you try to create a system datapath called
"bonding_masters", when you have bonding module loaded, you have a
kernel trace
("sysfs: cannot create duplicate filename '/class/net/bonding_masters'").

This trace appears since "bonding" kernel modules creates a file called
"/sys/class/net/bonding_masters", that prevents any network interface to
be called "bonding_masters".

This commits forbid an user to create a system datapath (that is a network
interface) called "bonding_masters" to avoid the kernel trace and to
avoid that bonding module can't work if it's loaded after
"bonding_masters" interface is created.

Reported-at: https://bugzilla.redhat.com/1974303
Signed-off-by: Timothy Redaelli <tredaelli at redhat.com>
---
 lib/dpif-netlink.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 73d5608a8..ada1d8479 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -330,6 +330,14 @@ dpif_netlink_open(const struct dpif_class *class OVS_UNUSED, const char *name,
     uint32_t upcall_pid;
     int error;
 
+    /* "bonding_masters" is a reserved interface name under Linux,
+     * since bonding module creates /sys/class/net/bonding_masters
+     * and so no interface can be called "bonding_masters".
+     */
+    if (!strcmp(name, "bonding_masters")) {
+        return EINVAL;
+    }
+
     error = dpif_netlink_init();
     if (error) {
         return error;
-- 
2.31.1



More information about the dev mailing list