alias configuration in rc.conf

Philipp Wuensche cryx-freebsd at h3q.com
Tue Oct 18 07:10:39 PDT 2005


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




More information about the freebsd-rc mailing list