Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Feb 2007 15:54:19 +1100 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        Jeremy Chadwick <koitsu@freebsd.org>
Cc:        Kevin Way <kevin@insidesystems.net>, Brooks Davis <brooks@freebsd.org>, freebsd-stable@freebsd.org
Subject:   Re: Desired behaviour of "ifconfig -alias"
Message-ID:  <Pine.BSF.3.96.1070210153734.1793A-100000@gaia.nimnet.asn.au>
In-Reply-To: <20070210024712.GA68286@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.1070210153734.1793A-100000>