Discussion:
[OpenWrt-Devel] brctl showmacs oneliner
Gui Iribarren
2014-09-27 00:33:29 UTC
Permalink
hello there,
i got bored of manually chasing a mac's location, in a big bridged
batadv network, without "brctl showmacs" command
(cf. http://ask.xmodulo.com/show-mac-learning-table-linux-bridge.html)
(it's not compiled in openwrt's busybox by default for some reason)

so i hacked up a oneliner which perfectly emulates the output

brctl_showmacs () { printf "port no\tmac addr\t\tis local?\tageing
timer\n" ; hexdump -v -e '5/1 "%02x:" /1 "%02x" /1 " %x" /1 " %x" 1/4 "
%i" 1/4 "\n"' /sys/class/net/$1/brforward | awk '{ islocal = $3 ? "yes"
: "no" ; printf "%3i\t%s\t%s\t\t%8.2f\n",$2,$1,islocal,$4/100 }' ; }

i hope this might be useful as is, for someone else reading this list
it can be copypasted in a running node, and used as
# brctl_showmacs br-lan

sample output: http://pastebin.com/

besides that... is there any slight, ugly chance of getting this
"upstream", somewhere?

(maaaaaaaybe in /etc/profile alongside these other oneliners?)
[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }

or, why is "brctl showmacs" not enabled by default?
(i'm aware it can be enabled by menuconfig in a custom build)

cheers,

gui
Gui Iribarren
2014-09-27 12:31:24 UTC
Permalink
Post by Gui Iribarren
# brctl_showmacs br-lan
sample output: http://pastebin.com/
i dont get it, please send a proper link 8-)
wow
very true omg
so distratced such miss
http://pastebin.com/KZD4AR7K
much sory
i tried your func on some batman-adv nodes, but with no output.
you must declare it first, then invoke it like "brctl_showmacs br-lan"?

cheers

Loading...