From owner-freebsd-stable@FreeBSD.ORG Sat Feb 10 05:13:10 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 C74B716A400; Sat, 10 Feb 2007 05:13:10 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from gaia.nimnet.asn.au (nimbin.lnk.telstra.net [139.130.45.143]) by mx1.freebsd.org (Postfix) with ESMTP id 38C4D13C4B5; Sat, 10 Feb 2007 05:13:07 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (smithi@localhost) by gaia.nimnet.asn.au (8.8.8/8.8.8R1.4) with SMTP id PAA03369; Sat, 10 Feb 2007 15:54:20 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sat, 10 Feb 2007 15:54:19 +1100 (EST) From: Ian Smith To: Jeremy Chadwick In-Reply-To: <20070210024712.GA68286@icarus.home.lan> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Kevin Way , 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 05:13:10 -0000 On Fri, 9 Feb 2007, Jeremy Chadwick wrote: > 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). This is way out of my league, but: -alias Remove the network address specified. This would be used if you incorrectly specified an alias, or it was no longer needed. If you have incorrectly set an NS address having the side effect of specifying the host portion, removing all NS addresses will allow you to respecify the host portion. Does not 'remove the network address specified' imply that this should fail if a) there is no network address specified or b) the address that is specified is not an existing alias address for the interface? Secondly, pardon my ignorance, but what does 'NS' refer to here? That string / term occurs nowhere else in ifconfig(8). Perhaps I'm missing a valid (and used) usage of -alias with no address? [..] Cheers, Ian