[Bridge] Bridge sysfs port_no overflow

Osama Abu Elsorour osama.sorour at eformations.net
Sun Mar 30 08:09:13 PDT 2008


All

We are running a setup with a large number of bridge ports that  
reaches the 900 ports. After switching to recent kernel and brctl- 
utils that uses the sysfs interface, we started noticing that the port  
numbers are mis-reported when issues the command:
brctl showmacs br1
After tracing the code, we found that the problem lies in the sysfs  
structure called __fdb_entry. The port_no is declared as a u8 while it  
is u16 in the rest of the bridge structure. This causes the port_no to  
overflow when the bridge port number exceeds 255.

Even if it is unusual to have this number of ports on a single bridge  
it should be changed to the sake of consistency.
	
This patch changes the structure to __u16:

@@ -94,7 +94,7 @@ struct __port_info
  struct __fdb_entry
  {
  	__u8 mac_addr[6];
-	__u8 port_no;
+	__u16 port_no;
  	__u8 is_local;
  	__u32 ageing_timer_value;
  	__u32 unused;



More information about the Bridge mailing list