Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Oct 2005 16:10:40 +0200
From:      Philipp Wuensche <cryx-freebsd@h3q.com>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: alias configuration in rc.conf
Message-ID:  <43550260.9050206@h3q.com>
In-Reply-To: <20051018015233.GA20157@odin.ac.hmc.edu>
References:  <435412F7.2030906@h3q.com> <20051017215309.GH15097@odin.ac.hmc.edu> <435443DE.6090300@h3q.com> <20051018015233.GA20157@odin.ac.hmc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Brooks Davis wrote:

> Similar code could presumably be written for ipv6.

The range feature will be a bit more complicated but yes.

>>>Corresponding ifalias_down() support should also be added.
>>
>>Done.
> 
> Since there's a one word difference between the two cases, I think
> an ipv4_addrs_common function taking an add or delete argument and the
> interface would be appropriate to avoid duplication of this code.
> Also, if you could find a way to rewrite the loop so ifconfig is only
> called in one place, that would be a bit cleaner.

You're right, I removed the code duplication by implementing a
ipv4_addr_common function, getting the interface and an action as
argument and giving back a list of cidr-ipaddr. directly usable with
ifconfig.

ipv4_addr_common is called by ipv4_up() and ipv4_down() which also use
ifconfig_if() and ifalias_if(), appending the alias or -alias arguement
used by ifconfig and finally executing ifconfig.

ipv4_up() and ipv4_down() could be called by etc/rc.d/netif, removing
ifconfig_if() and ifalias_if().

To test the code easier, I put my implementation in a shell script:

http://outpost.h3q.com/patches/ipv4-ifconfig.sh

greetings,
cryx





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