diff options
author | Hiroki Sato <hrs@FreeBSD.org> | 2011-10-23 07:37:36 +0000 |
---|---|---|
committer | Hiroki Sato <hrs@FreeBSD.org> | 2011-10-23 07:37:36 +0000 |
commit | dec80d129b8a13c29113fa6c80d969cbcb64e8c0 (patch) | |
tree | de3d8b4fa0445e5fc77212e5374d80168b593673 /etc | |
parent | 74ea05005294f065dbf71c388fa72cd0e33fda75 (diff) | |
download | src-dec80d129b8a13c29113fa6c80d969cbcb64e8c0.tar.gz src-dec80d129b8a13c29113fa6c80d969cbcb64e8c0.zip |
Add support for removing addresses added by ipv6_prefix_hostid_addr_up()
upon rc.d/netif stop.
Notes
Notes:
svn path=/head/; revision=226652
Diffstat (limited to 'etc')
-rw-r--r-- | etc/network.subr | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/etc/network.subr b/etc/network.subr index 76e6795d7dcc..c1faf59bfa3c 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -556,7 +556,7 @@ ipv6_up() fi ifalias_up ${_if} inet6 && _ret=0 - ipv6_prefix_hostid_addr_up ${_if} && _ret=0 + ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0 ipv6_accept_rtadv_up ${_if} && _ret=0 # wait for DAD @@ -612,6 +612,7 @@ ipv6_down() fi ipv6_accept_rtadv_down ${_if} && _ret=0 + ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0 ifalias_down ${_if} inet6 && _ret=0 inetList="`ifconfig ${_if} | grep 'inet6 ' | tr "\n" "$_ifs"`" @@ -859,12 +860,14 @@ ifalias_ipv6_down() return $_ret } -# ipv6_prefix_hostid_addr_up if -# add IPv6 prefix + hostid addr to the interface $if -ipv6_prefix_hostid_addr_up() +# ipv6_prefix_hostid_addr_common if action +# Add or remove IPv6 prefix + hostid addr on the interface $if +# +ipv6_prefix_hostid_addr_common() { - local _if prefix laddr hostid j address + local _if _action prefix laddr hostid j address _if=$1 + _action=$2 prefix=`get_if_var ${_if} ipv6_prefix_IF` if [ -n "${prefix}" ]; then @@ -874,13 +877,13 @@ ipv6_prefix_hostid_addr_up() for j in ${prefix}; do address=$j\:${hostid} - ifconfig ${_if} inet6 ${address} prefixlen 64 alias + ifconfig ${_if} inet6 ${address} prefixlen 64 ${_action} # if I am a router, add subnet router # anycast address (RFC 2373). if checkyesno ipv6_gateway_enable; then ifconfig ${_if} inet6 $j:: prefixlen 64 \ - alias anycast + ${_action} anycast fi done fi |