From owner-freebsd-arch@FreeBSD.ORG Sun Nov 30 04:12:50 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DCB016A4D0 for ; Sun, 30 Nov 2003 04:12:50 -0800 (PST) Received: from mailtoaster1.pipeline.ch (mailtoaster1.pipeline.ch [62.48.0.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id D609043F75 for ; Sun, 30 Nov 2003 04:12:45 -0800 (PST) (envelope-from andre@freebsd.org) Received: (qmail 31712 invoked from network); 30 Nov 2003 11:10:50 -0000 Received: from unknown (HELO freebsd.org) ([62.48.0.54]) (envelope-sender ) by mailtoaster1.pipeline.ch (qmail-ldap-1.03) with SMTP for ; 30 Nov 2003 11:10:50 -0000 Message-ID: <3FC9DEBA.BD5AC227@freebsd.org> Date: Sun, 30 Nov 2003 13:12:42 +0100 From: Andre Oppermann X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Bruce M Simpson References: <20031130092301.GA98871@saboteur.dek.spc.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org cc: sam@freebsd.org cc: freebsd-arch@freebsd.org Subject: Re: ifconfig(8) refactoring -- YACC grammar now online X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2003 12:12:50 -0000 Bruce M Simpson wrote: > > Hi all, > > As per Sam's suggestion, I've been working on refactoring ifconfig(8), > which has grown increasingly large and unwieldy. Part of the effort has > been to get a handle on all of the options we currently support; so I've > written a YACC grammar for it. > > This is my first serious bit of work with YACC so I'd appreciate any > feedback you can give. > > I've uploaded the grammar, makefile, and all the EPS files, here:- > http://people.freebsd.org/~bms/dump/nifconfig/ (for browsing) > http://people.freebsd.org/~bms/dump/nifconfig.tgz (tarball) > > I've also generated a PDF file you can view which shows you syntax diagrams > for each part of the parse tree. This is here:- > http://people.freebsd.org/~bms/dump/nifconfig/all.pdf > > I can't quite seem to persuade Ebnf2ps to generate a recursive unfolding > of all productions from argv downwards, though, that would be most helpful. > > This involved rolling two ports, epsmerge and Ebnf2ps, to visualize the > syntax graphically. I will commit these ports once the freeze as over as > they're likely to be useful to a lot of people. > > Please let me know your thoughts on this. I think this refactoring of ifconfig is very good. I haven't read the yacc grammar as I have never worked with yacc before, so I can't comment on your implementation. What I've thinking about a lot is to make the networking system and ifconfig sort of class-based like newbus and geom. For example having a general ieee802-class for all interfaces which belong into that group (10/100/1000BaseTX, WirelessLAN, etc.) would be great. Then there are more specific sub-classes for media-types like 802.11 if they have properties which go further than the general ieee802 functions. For example the ieee802-class would implement general functionality which is available with all ieee802 media-types like VLAN, priority tagging, link authentication and so on. The 802.11-class would implement things like channel selection, operating mode, encryption keys and so on. Some functions in the general classes have direct representations in the interface namespace. For example I'd like to be able to specify a interface in a VLAN like this: ifconfig fxp0.2 inet ... which would clone fxp0 and put the cloned interface into VLAN number two. This works generally for all ieee802-class interfaces. Commands for 802.11 would only be available for WLAN interfaces. A channelized T1/E1 card like the LAN Media cards could be configured like this: ifconfig lmc0/1-32 which would take E1 channels one to thirty-two into this interface. When you have fractional bandwidth it would look like lmc0/1-4 for 256kbit. Or make a second interface with channels 5-8 with ifconfig lmc0/5-8. An overlap of channels is prohibited of course. It get's ever better with a T3/E3 interface ifconfig env0/5/1-4 which would select channels one to four out of the fifth E1 in the E3 pipe. Repeat that with OCx or STMx interfaces. However the interpretation of the command line is done by the class the interface is in. -- Andre