ifconfig refactoring for FreeBSD
Dan writes "Based on Sam Leffer's suggestion, Bruce Simpson has been working on refactoring ifconfig(8). ifconfig is a FreeBSD unix utility used to assign an address to a network interface and/or configure network interface parameters. Bruce says that ifconfig has grown increasingly large and become unwieldy. Part of the effort has been to get a handle on all of the options that are currently supported so he has written a YACC grammar for it. He has uploaded some grammer, created a design document and also generated a PDF file you can view which shows you syntax diagrams for each part of the parse tree."
While they are at it, they should add something to parse /etc/rc.conf and reconfigure all interfaces while the system is running. This is one area where Linux has an advantage.
For those of you who do not know what YACC is all about
Its good to see something like this happening as ifconfig is not only used on FreeBSD but also on most (all?) Linux distros.
Ifconfig is just one of the many contributions the BSD projects have given to the Linux and UNIX community.
PS: To all those "bsd is dying" trolls, things like this show its not. Without the work of the BSD projects you wouldn't have some of the many tools you use each day.
(\(\
(^.^)
(")")
*This is the cute bunny virus, please copy this into your sig so it can spread
Starting with FreeBSD 4.x, ifconfig with no arguments simply lists all interfaces the kernel has found, and their configuration details.
(the actual output has tabs to make the formatting a little prettier)Refactoring is meant to be about improving the design of existing code, in small controlled ways. This doesn't look like refactoring, just a rewrite of a section of it.
Either way I find it hard to appreciate why this is news.
There is no "GNU ifconfig". Linux has it's own version which is probably based on an old BSD version, or, maybe written from scratch.
% ifconfig -V
net-tools 1.60
ifconfig 1.42 (2001-04-13)
You can tell it's not GNU because it doesn't spout on about the GPL everytime you run it.
Just checking. ;>
A yacc grammar? That makes it official, ifconfig is now a contender for the ls Memorial Too Damn Many Options award. Other known entrants include ld, most X applications, and the ever-popular gcc.
- system("/usr/sbin/arp
...")
and you will see pretty quickly that it's much more complicated than any ioctl()Conceptually, ARP table entries as routing table entries is great but the API is in need of some serious re-working or a library to hide the complexity.
Even better, I use two realtek for internal interfaces and one 3com for the cable connection.
The 3coms don't like it when there's more than one in my firewall, the realteks work just fine. Only setting the macaddress didn't go well, so that's why the 3com on the outside.
home
ifconfig is just the older, more compatible way to config the interfaces for those who grew up using older Linuxes and other Unices. You can do everything ifconfig + iptables using ip + tc and more.
So before anyone claims that Linux's ifconfig sucks and is too complicated, they've already made a better replacement for it, just needs more documentation and exposure.
Let's not give the GNU guys any ideas. ;)
-
And the Angel said unto me, "These are the cries of the carrots! The cries of the carrots!"