All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: netdev@vger.kernel.org
Cc: bridge@linux-foundation.org
Subject: [Bridge] [PATCH] bridge: forwarding table information for >256 devices
Date: Thu, 1 May 2008 13:42:09 -0700	[thread overview]
Message-ID: <20080501134209.3012de69@extreme> (raw)

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>


--- a/include/linux/if_bridge.h	2008-04-28 15:27:05.000000000 -0700
+++ b/include/linux/if_bridge.h	2008-04-28 15:31:38.000000000 -0700
@@ -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__
--- a/net/bridge/br_fdb.c	2008-04-28 15:27:05.000000000 -0700
+++ b/net/bridge/br_fdb.c	2008-04-28 15:31:38.000000000 -0700
@@ -285,7 +285,11 @@ int br_fdb_fillbuf(struct net_bridge *br
 
 			/* 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);

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Hemminger <shemminger@vyatta.com>
To: netdev@vger.kernel.org
Cc: bridge@linux-foundation.org
Subject: [PATCH] bridge: forwarding table information for >256 devices
Date: Thu, 1 May 2008 13:42:09 -0700	[thread overview]
Message-ID: <20080501134209.3012de69@extreme> (raw)

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>


--- a/include/linux/if_bridge.h	2008-04-28 15:27:05.000000000 -0700
+++ b/include/linux/if_bridge.h	2008-04-28 15:31:38.000000000 -0700
@@ -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__
--- a/net/bridge/br_fdb.c	2008-04-28 15:27:05.000000000 -0700
+++ b/net/bridge/br_fdb.c	2008-04-28 15:31:38.000000000 -0700
@@ -285,7 +285,11 @@ int br_fdb_fillbuf(struct net_bridge *br
 
 			/* 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);

             reply	other threads:[~2008-05-01 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-01 20:42 Stephen Hemminger [this message]
2008-05-01 20:42 ` [PATCH] bridge: forwarding table information for >256 devices Stephen Hemminger
2008-05-02 23:53 ` [Bridge] " David Miller
2008-05-02 23:53   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080501134209.3012de69@extreme \
    --to=shemminger@vyatta.com \
    --cc=bridge@linux-foundation.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.