conf/174225: A patch to add support for ipv6_addrs_IF style aliases to rc.conf(5)
Kimmo Paasiala
kpaasial at gmail.com
Thu Dec 6 11:20:00 UTC 2012
>Number: 174225
>Category: conf
>Synopsis: A patch to add support for ipv6_addrs_IF style aliases to rc.conf(5)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 06 11:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Kimmo Paasiala
>Release: 9-STABLE
>Organization:
>Environment:
FreeBSD whitezone.rdnzl.info 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r243704: Sat Dec 1 00:04:23 EET 2012 root at whitezone.rdnzl.info:/usr/obj/usr/src/sys/RDNZL amd64
>Description:
The attached patch adds support for ipv6_addrs_IF style aliases in rc.conf(5) to match ipv4_addrs_IF aliases that are already supported.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
--- network.subr.orig 2012-12-04 16:36:54.777519679 +0200
+++ network.subr 2012-12-04 16:37:15.578523530 +0200
@@ -562,6 +562,7 @@
fi
ifalias_up ${_if} inet6 && _ret=0
+ ipv6_addrs_common ${_if} alias && _ret=0
ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0
ipv6_accept_rtadv_up ${_if} && _ret=0
@@ -684,6 +685,31 @@
return $_ret
}
+
+ipv6_addrs_common()
+{
+ local _ret _if _action _ip6prefix _ip6prefixes
+ local _ip6addr _prefixlen
+ _ret=1
+ _if=$1
+ _action=$2
+
+# get the prefixes from ipv6_addrs_IF variable
+ _ip6prefixes=`get_if_var $_if ipv6_addrs_IF`
+ for _ip6prefix in ${_ip6prefixes}; do
+ _ip6addr=${_ip6prefix%%/*}
+ _prefixlen=${_ip6prefix##*/}
+ if [ "${_action}" = "-alias" ]; then
+ _prefixlen=""
+ else
+ _prefixlen="prefixlen $_prefixlen"
+ fi
+ eval "ifconfig ${_if} inet6 ${_action} ${_ip6addr} ${_prefixlen}"
+ done
+}
+
+
+
# ifalias_up if af
# Configure aliases for network interface $if.
# It returns 0 if at least one alias was configured or
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list