bridge-utils doesn't like name "bridge"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The "brctl show" (and probably other commands) do not work properly in the 
current git version of bridge-utils, and at least the 1.2 release in Debian 
testing.

The reason is that some sloppy code detects bridges under sysfs by simply 
matching dirents matching "%s/bridge" under /sys/class/net. Unfortunately, if 
a bridge is actually _called_ "bridge", this logic fails because the "." 
directory matches.

Since the expected files do not exist under /sys/class/net/./bridge, but 
under /sys/class/net/bridge/bridge, it causes a segfault.

The attached patch fixes the problem by excluding any dirent with '.' at the 
beginning, which risks breaking nothing but does filter out ".", etc. as 
possible matches for bridge interfaces.

Please apply.

-- 
Cheers,
Alistair.

Final year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.
diff -Nudr bridge-utils-1.2/libbridge/libbridge_init.c bridge-utils-1.2.new/libbridge/libbridge_init.c
--- bridge-utils-1.2/libbridge/libbridge_init.c 2006-09-09 06:30:31.000000000 +0100
+++ bridge-utils-1.2.new/libbridge/libbridge_init.c     2007-03-16 01:45:26.080465228 +0000
@@ -49,6 +49,10 @@
 	char path[SYSFS_PATH_MAX];
 	struct stat st;

+	/* the bridge might actually be called "bridge", so don't match '.' */
+	if (entry->d_name[0] == '.')
+		return 0;
+
 	snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge", entry->d_name);
 	return stat(path, &st) == 0 && S_ISDIR(st.st_mode);
 }
_______________________________________________
Bridge mailing list
Bridge@xxxxxxxxxxxxxx
https://lists.osdl.org/mailman/listinfo/bridge

[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux