alias configuration in rc.conf

Brooks Davis brooks at one-eyed-alien.net
Mon Oct 17 14:53:13 PDT 2005


On Mon, Oct 17, 2005 at 11:09:11PM +0200, Philipp Wuensche wrote:
> Hi,
> 
> I don't know if this is the right place, but I created a patch to
> /etc/network.subr and /etc/rc.d/netif to add a simpler alias
> configuration in rc.conf.
> 
> Using the ifconfig_fxp0_aliasN="" syntax is error prone. If you forget
> to number N serially correct, /etc/rc.d/netif does not configure all
> aliases to the interface. Other weird things happen if N is not uniqe.
> 
> Configuring a large number of aliases to an interface (e.g. in
> jail-hosting systems) fills up the rc.conf very fast, making the
> configuration complex.
> 
> With the patches, alias configuration gets a lot easier. At the moment I
> use the ipv4_ifconfig variable, its not jet used. Mayby something else
> would be better. Using ranges in the last byte of the ipaddr. allows to
> configure more than one ipaddr in one statement.
> 
> The syntax is as follow:
> 
> ipv4_ifconfig_fxp0="192.168.0.1/24 23.23.23.5-23/24"
> 
> This will configure fxp0 with the alias 192.168.0.1/24, 23.23.23.5/24
> and 23.23.23.6-23/32
> 
> You can find the patch at
> http://outpost.h3q.com/patches/network.subr-range.patch
> 
> Comments and testreports are very welcome :-)

Nice idea!  The aliasN stuff is ugly.  Some comments:

I don't like ipv4_ifconfig_fxp0.  I'd suggest ifconfig_fxp0_ipv4_aliases
instead.  The ipv4_ifconfig_getargs function is slightly bogus as
written since a default value makes no sense and that would be the wrong
one anyway.  The implemenation also fails to match the comment though
that's easy to fix.  I'd also not modify etc/rc.d/netif and do this from
ifalias_up().  Corresponding ifalias_down() support should also be added.

Finally modifications will be needed to rc.conf(5).

-- Brooks


More information about the freebsd-rc mailing list