From owner-freebsd-stable@FreeBSD.ORG Sat Feb 10 02:48:06 2007 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD6E716A400 for ; Sat, 10 Feb 2007 02:48:06 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from alnrmhc11.comcast.net (alnrmhc11.comcast.net [206.18.177.51]) by mx1.freebsd.org (Postfix) with ESMTP id 96F2D13C491 for ; Sat, 10 Feb 2007 02:48:05 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from icarus.home.lan (c-71-198-0-135.hsd1.ca.comcast.net[71.198.0.135]) by comcast.net (alnrmhc11) with ESMTP id <20070210024712b1100kni3pe>; Sat, 10 Feb 2007 02:47:12 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 4851F1FA01D; Fri, 9 Feb 2007 18:47:12 -0800 (PST) Date: Fri, 9 Feb 2007 18:47:12 -0800 From: Jeremy Chadwick To: Kevin Way Message-ID: <20070210024712.GA68286@icarus.home.lan> Mail-Followup-To: Kevin Way , Brooks Davis , freebsd-stable@freebsd.org References: <45CCE270.7080704@insidesystems.net> <20070209214908.GA64090@icarus.home.lan> <20070209222925.GB11826@lor.one-eyed-alien.net> <45CD2A42.5050001@insidesystems.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45CD2A42.5050001@insidesystems.net> X-PGP-Key: http://jdc.parodius.com/pubkey.asc User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Brooks Davis , freebsd-stable@freebsd.org Subject: Re: Desired behaviour of "ifconfig -alias" X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Feb 2007 02:48:06 -0000 On Fri, Feb 09, 2007 at 09:13:22PM -0500, Kevin Way wrote: > I'm as much of a change-hating curmudgeon as the next guy, but if > anybody is relying on > "ifconfig iface -alias" 's undefined behavior, then they deserve the > pain that will come with a fix. > > As it stands the behavior appears to vary between drivers (archive > search shows that on fxp it > blows away all IPs, while on bce it blows away the primary IP, leaving > all aliases intact.) Upon looking at the code, I can see exactly where this (read: -alias without any arguments) can be addressed, and it's not in the NIC drivers. Tracing through src/sbin/ifconfig/ifconfig.c in RELENG_6: main() iterates through argv, calling cmd_lookup() on each argument passed. cmd_lookup() does a strcmp() comparison against the argument passed and what's in each struct entry pointed to by pointer "cmds". "cmds" is populated via the constructor ifconfig_ctor(), taking its data from a struct table called basic_cmds. Entries in basic_cmds use macros named DEF_CMD(), DEF_CMD_ARG(), and DEF_CMD_ARG2(), which define the number of arguments required. Thus, it seems to me that either the struct of basic_cmds needs to be changed to address things differently (argv parsers are fun!), or one could simply move "-alias" to require "inet" or "inet6" (or whatever other things you might want to match on). It seems to me that this oversight was addressed when adding 802.1 support to ifconfig -- thus creating ifieee80211.c, which has pre-requisite counts and things for some of the arguments. Thus, what I'm saying is this: the change should be doable, and the argument for "keeping this brokenness" fails miserably (sorry Brooks, I don't want you to feel like I'm raining on your parade, but your argument doesn't jive with me.) > Am I missing a reason that this could ever be desirable? If it was > consistent, I could see an > argument for documentation. But as it stands, the only thing to > document would be that the > behavior varies between drivers, and a fix has been declined on the > basis of momentum. I can't see why this would be desirable either. I don't want ifconfig to go the route of Linux's ipfwadm --> ipchains --> iptables (anyone familiar with that migration should understand my comparison), but we're talking about an oversight of the syntax parser here. Additionally, if each driver (fxp vs. bge vs. nve) all behave differently on -alias, that's also odd. I bet that one can be explained, though. > At a minimum can this get normalized in -HEAD? I would like to see this addressed in -HEAD and backported to RELENG_6, because this isn't an ifconfig syntax change, it's addressing a decent oversight in what expected arguments are for certain commands. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |