[PATCH] brctl: Added support for showmacs command
Martin Lewis
martin.lewis.x84 at gmail.com
Mon Sep 16 16:08:41 UTC 2019
Hi,
The attached implementation is roughly the same found in brctl from
bridge-utils.
It does the same actions, and specifically reads it’s entries from
/sys/class/net/<BRIDGE_NAME>/brforward.
The relevant kernel function is brforward_read, and can be found under
net/bridge/br_sysfs_br.c in the kernel source tree.
All it does is provide the user an array of entries of the type struct
__fdb_entry, which clearly contains a member __u8 mac_addr[ETH_ALEN],
where ETH_ALEN is defined to be 6.
There are no references to Infiniband or in fact non-ethernet devices
in the kernel’s bridge implementation,
will you be able to please provide an example / code reference in
which the above code breaks (as I couldn’t find any)?
Thank you,
Martin
On Mon, 16 Sep 2019 at 07:54, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:
>
> On 15 September 2019 18:04:49 CEST, Martin Lewis <martin.lewis.x84 at gmail.com> wrote:
> >Signed-off-by: Martin Lewis <martin.lewis.x84 at gmail.com>
> >---
> >networking/brctl.c | 119
> >++++++++++++++++++++++++++++++++++++++++++++---------
> > 1 file changed, 100 insertions(+), 19 deletions(-)
> >
> >diff --git a/networking/brctl.c b/networking/brctl.c
> >index 586ca9b..35771a5 100644
> >--- a/networking/brctl.c
> >+++ b/networking/brctl.c
> >@@ -61,10 +61,10 @@
> > //usage: "\n setbridgeprio BRIDGE PRIO Set bridge priority"
> > //usage: "\n setportprio BRIDGE IFACE PRIO Set port priority"
> > //usage: "\n setpathcost BRIDGE IFACE COST Set path cost"
> >+//usage: "\n showmacs BRIDGE List mac addrs"
> > //usage: )
> > // Not yet implemented:
> > // hairpin BRIDGE IFACE on|off Hairpin on/off
> >-// showmacs BRIDGE List mac addrs
> > // showstp BRIDGE Show stp info
> >
> > #include "libbb.h"
> >@@ -196,6 +196,94 @@ static void write_uint(const char *name, const
> >char *leaf, unsigned val)
> > bb_simple_perror_msg_and_die(name);
> > close(fd);
> > }
> >+
> >+struct __fdb_entry {
> >+ uint8_t mac_addr[6];
>
> Infiniband has 20 bytes MAC addresses so this is not accurate.
>
> Thanks,
More information about the busybox
mailing list