Subject: Re: rc.conf vs interface aliases
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: tech-net
Date: 01/18/2006 23:21:26
--0k2ZE0YWsaeoufzj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Jan 18, 2006 at 04:46:39PM -0500, der Mouse wrote:
> How would that work? The description in rc.conf(5) does not make it
> appear that it supports the sort of thing I'm after.
>=20
> Here's the functionality I'm talking about, in the form of a patch to
> 3.0's /etc/rc.d/network, network,v 1.47.2.1. (I may have details such
> as the eval line wrong; this is an untested adaptation of the patch I
> use with 1.4T.) What should I put in /etc/rc.conf.d/network to get
> such functionality? It's not obvious to me in the least.
>=20
> [...]
you can define your own function which will add aliases in the way you
require and execute it after network_start() finishes.
in your /etc/rc.conf.d/network:
----8><----
start_postcmd=3D"custom_aliases"
custom_aliases()
{
echo -n "Adding custom interface aliases:"
for int in lo0 $configured_interfaces; do
n=3D1
while :; do
eval args=3D\$ifalias_$int\_$n
if [ -n "$args" ]; then
ifconfig $int $args alias
n=3D$(($n+1))
else
break
fi
done
done
}
----><8----
untested, but you get the idea.
regards,
--=20
-- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org> --
--0k2ZE0YWsaeoufzj
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)
iD8DBQFDzr9miwjDDlS8cmMRAsIpAJ9slfCZrzflSQ9lq5f18M1MhJ2BdACdEZH5
NhmGbpm4YScoB68XqYoocLk=
=xdEf
-----END PGP SIGNATURE-----
--0k2ZE0YWsaeoufzj--