summaryrefslogtreecommitdiffstats
path: root/etc/network.subr
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2011-10-23 07:37:36 +0000
committerhrs <hrs@FreeBSD.org>2011-10-23 07:37:36 +0000
commit4d11bc0a4ad8d462236d5de17fd2f40810cf29fd (patch)
treede3d8b4fa0445e5fc77212e5374d80168b593673 /etc/network.subr
parent01ff83332e4117ec4cf10658278227c8a166c9d9 (diff)
downloadFreeBSD-src-4d11bc0a4ad8d462236d5de17fd2f40810cf29fd.zip
FreeBSD-src-4d11bc0a4ad8d462236d5de17fd2f40810cf29fd.tar.gz
Add support for removing addresses added by ipv6_prefix_hostid_addr_up()
upon rc.d/netif stop.
Diffstat (limited to 'etc/network.subr')
-rw-r--r--etc/network.subr17
1 files changed, 10 insertions, 7 deletions
diff --git a/etc/network.subr b/etc/network.subr
index 76e6795..c1faf59 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
OpenPOWER on IntegriCloud