Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Feb 2007 12:41:02 -0600
From:      Brooks Davis <brooks@FreeBSD.ORG>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Desired behaviour of "ifconfig -alias"
Message-ID:  <20070212184102.GD52751@lor.one-eyed-alien.net>
In-Reply-To: <200702121823.l1CINXHt066223@lurza.secnetix.de>
References:  <20070212175940.GA52751@lor.one-eyed-alien.net> <200702121823.l1CINXHt066223@lurza.secnetix.de>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Mon, Feb 12, 2007 at 07:23:33PM +0100, Oliver Fromme wrote:
> Brooks Davis wrote:
>  > Oliver Fromme wrote:
>  > > Brooks Davis wrote:
>  > > > ipv4_addrs_<interface> is a much better replacement IMO.  It's easy to
>  > > > use and doesn't required the hackish pseudo array traversal used by
>  > > > ifconfig_iface_aliasX.
>  > > 
>  > > That might work for simple cases, but how do you specify
>  > > other parameters beside the IPs if you need to?
>  > 
>  > What do you need to set?  It's sets IP and netmask.  It doesn't handle
>  > broadcast, but I'd be pretty suprised if that's needed often.
> 
> True, not often, but sometimes.  I had cases like that in
> certain environments with bridged networks and arp proxies.
> 
> I'm fine with your proposed syntax, as long as all the
> existing ifconfig possibilities continue to be possible,
> i.e. no regression.

FWIW, it's HEAD and 6.1.  We've actually got the aliases syntax labled
as deprecated in the manpage.  We might want to add a feature to set the
broadcast address.

>  > is needed?  Axing ifconfig_iface_aliasX is not needed, but reducing the
>  > visiability of the interface in the documentation is probably in order
>  > particularly since it's quite fragile since you have to renumber whenever
>  > you remove an entry.
> 
> Yup, I agree, that's a PITA.  That could be solved in the
> shell code, though, by not enumerating until a number
> doesn't exist, but instead looking at the set of all
> shell variables that have been set, similar to this:
> 
> set | grep "^ifconfig_${IFACE}_alias" | cut -f1 -d= | ...

Unfortuanly grep in in /usr/bin so can't be used.  You could do it
with sh variable mangling and case though.  Something like:

{ while read _var; do
	_var=${_var%%=*}
	case $_var in
	ifconfig_${IFACE}_alias*)
		<...>
		;;
	esac
done } < `set`

-- Brooks

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)

iD8DBQFF0LS9XY6L6fI4GtQRAmTMAJ4i6Kn/2sSX5UaFvL/l8mElJqiuJgCgo7hT
6pL0dAqXf9N+WoIupWMkyG0=
=x8h1
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070212184102.GD52751>