From owner-freebsd-bugs@FreeBSD.ORG Thu Dec 6 11:20:00 2012 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8ACC1DC for ; Thu, 6 Dec 2012 11:20:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 9C2AF8FC16 for ; Thu, 6 Dec 2012 11:20:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qB6BK0bD039382 for ; Thu, 6 Dec 2012 11:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qB6BK0bq039380; Thu, 6 Dec 2012 11:20:00 GMT (envelope-from gnats) Resent-Date: Thu, 6 Dec 2012 11:20:00 GMT Resent-Message-Id: <201212061120.qB6BK0bq039380@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kimmo Paasiala Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 56860F85 for ; Thu, 6 Dec 2012 11:11:13 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 3BE858FC17 for ; Thu, 6 Dec 2012 11:11:13 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qB6BBDE6052462 for ; Thu, 6 Dec 2012 11:11:13 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id qB6BBDeh052459; Thu, 6 Dec 2012 11:11:13 GMT (envelope-from nobody) Message-Id: <201212061111.qB6BBDeh052459@red.freebsd.org> Date: Thu, 6 Dec 2012 11:11:13 GMT From: Kimmo Paasiala To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: conf/174225: A patch to add support for ipv6_addrs_IF style aliases to rc.conf(5) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2012 11:20:00 -0000 >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@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: