[BusyBox] [PATCH] macadddr command
Rainer Weikusat
rainer.weikusat at sncag.com
Fri Jul 22 13:28:45 UTC 2005
Paul Fox <pgf at brightstareng.com> writes:
> > It's been quite a while since I included ifconfig in my system, but it
> > seems to me that it was quite a pig. I could see wanting this small
> > utility instead, if ifconfig was not being used for other tasks.
>
> point taken. if you don't already have ifconfig or ip (i'm
> impressed, btw, if so), then adding it just to get the mac
> address of the interface probably feels like overkill.
> personally, i'm amazed at the lack of support in /proc for
> interface-specific information. why isn't there a whole tree of
> status information under /proc/net/ containing addresses,
> netmasks, packet counts, byte counts, etc? then the tool of
> choice would be "cat".
Try /proc/net/netstat and /proc/net/dev for this kind of statistical
data.
> my distaste to a "macaddr" applet goes deep, since it violates
> the "use simple tools" approach that makes unix shell programming so
> great. (i think "head" is a wasted command too, btw -- "sed
> <n>q" serves just as well.)
ip -f <familiy> addr show dev <iface> | sed -n '2p' | tr -s ' ' '\t' |cut -f3
eg
ip -f link addr show dev eth1 ...
gives the ethernet (or other link-level address) of eth1,
ip -f inet addr show dev lo ...
prints 127.0.0.1/8 and so on.
> (i've also always thought of busybox as a reimplementation of standard
> utilities. adding new inventions to it begs the question of "where do
> we stop?".)
Judging from the past, as soon as every kind of misbehaviour networked
Windows-machines usually exhibit has been crappily reimplemented ...
More information about the busybox
mailing list