bridge: forwarding table information for >256 devices
authorStephen Hemminger <shemminger@vyatta.com>
Fri, 2 May 2008 23:53:33 +0000 (16:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 May 2008 23:53:33 +0000 (16:53 -0700)
The forwarding table binary interface (my bad choice), only exposes
the port number of the first 8 bits. The bridge code was limited to
256 ports at the time, but now the kernel supports up 1024 ports, so
the upper bits are lost when doing:

   brctl showmacs

The fix is to squeeze the extra bits into small hole left in data
structure, to maintain binary compatiablity.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/if_bridge.h
net/bridge/br_fdb.c

index 58e43e5664575f25e7249a6e4c4301ee0a036ce4..950e13d09e06c04e2ce5d44873affa8a98075287 100644 (file)
@@ -97,7 +97,9 @@ struct __fdb_entry
        __u8 port_no;
        __u8 is_local;
        __u32 ageing_timer_value;
-       __u32 unused;
+       __u8 port_hi;
+       __u8 pad0;
+       __u16 unused;
 };
 
 #ifdef __KERNEL__
index 9326c377822ed3d6e51e0116c73d22e4aaa84608..72c5976a5ce3056d36a145222616f78d66639019 100644 (file)
@@ -285,7 +285,11 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
 
                        /* convert from internal format to API */
                        memcpy(fe->mac_addr, f->addr.addr, ETH_ALEN);
+
+                       /* due to ABI compat need to split into hi/lo */
                        fe->port_no = f->dst->port_no;
+                       fe->port_hi = f->dst->port_no >> 8;
+
                        fe->is_local = f->is_local;
                        if (!f->is_static)
                                fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->ageing_timer);