[OpenWrt-Devel] brctl showmacs oneliner
Gui Iribarren
gui at altermundi.net
Fri Sep 26 20:33:29 EDT 2014
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
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list