From owner-freebsd-stable@FreeBSD.ORG Sat Dec 22 03:09:38 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8332853; Sat, 22 Dec 2012 03:09:38 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-wg0-x22a.google.com (wg-in-x022a.1e100.net [IPv6:2a00:1450:400c:c00::22a]) by mx1.freebsd.org (Postfix) with ESMTP id 1A82C8FC12; Sat, 22 Dec 2012 03:09:37 +0000 (UTC) Received: by mail-wg0-f42.google.com with SMTP id dr1so1800713wgb.3 for ; Fri, 21 Dec 2012 19:09:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=VUCcoyDmAc5VKJhJ/A4Xyz/kRTo1tVY12xQ6a361qk4=; b=SQwjZTm3PYnOKZp3O2YF1mzJZLS1NQX/xJozJo0mL40X4tmbXOFphGK2OrmT4phhOZ sh/LPIRoi+oxSifVMRqjT/f4bS/K88gVwd75rwPiuH6iB3zPW/lSYGaGRTMwWR31sTP2 Qw3ZwVAXgTTasJ3t6pu+rFOnqPGCh9z9CoWmmmbaIeXuGjTcah1MGnwuYSWh1AQDmzN/ FG3aNVlcC/1jDvreRxrMIAoXSSkdGzhcX37KkG5nrvfZwPC2LWBChrQ0nmzXmv0+kvLA 1zBFIHNndv5lbEPqmTBf2CxtowwB48LMoLhoqUrfz//rODhNRY9RAO0fRD3Xkbazvjl6 8ojg== MIME-Version: 1.0 Received: by 10.180.100.197 with SMTP id fa5mr18502783wib.32.1356145777012; Fri, 21 Dec 2012 19:09:37 -0800 (PST) Received: by 10.216.172.197 with HTTP; Fri, 21 Dec 2012 19:09:36 -0800 (PST) In-Reply-To: References: <50D1C553.9060100@wasikowski.net> <20121220132750.GB99616@stack.nl> <50D4F2E4.7020600@wasikowski.net> Date: Sat, 22 Dec 2012 05:09:36 +0200 Message-ID: Subject: Re: ipv6_addrs_IF aliases in rc.conf(5) From: Kimmo Paasiala To: =?UTF-8?Q?=C5=81ukasz_W=C4=85sikowski?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 03:09:38 -0000 On Sat, Dec 22, 2012 at 3:19 AM, Kimmo Paasiala wrote: > On Sat, Dec 22, 2012 at 1:38 AM, =C5=81ukasz W=C4=85sikowski > wrote: >> W dniu 2012-12-21 13:23, Kimmo Paasiala pisze: >>> On Fri, Dec 21, 2012 at 5:43 AM, Kimmo Paasiala wr= ote: >>>> On Thu, Dec 20, 2012 at 3:27 PM, Jilles Tjoelker wro= te: >>>>> On Thu, Dec 20, 2012 at 01:04:34PM +0200, Kimmo Paasiala wrote: >>>>>> A question related to this for those who have been doing work on the >>>>>> rc(8) scripts. Can I assume that /usr/bin is available when >>>>>> network.subr functions are used? Doing calculations on hexadecimal >>>>>> numbers is going to be very awkward if I can't use for example bc(1)= . >>>>> >>>>> You cannot assume that /usr/bin is available when setting up the >>>>> network. It may be that /usr is mounted via NFS. >>>>> >>>>> You can use hexadecimal numbers (prefixed with 0x) in $((...)) >>>>> expressions. In FreeBSD 9.0 or newer, sh has a printf builtin you can >>>>> use; in older versions you can use hexdigit and hexprint from >>>>> network.subr. >>>>> >>>>> -- >>>>> Jilles Tjoelker >>>> >>>> Thanks, I've rewitten my patch to support ranges. It is attached in >>>> this message. >>>> >>>> Again it's against a very recent 9-STABLE, I still haven't found time >>>> to see if it applies to CURRENT. >>>> >>>> It does allow you to do crazy stuff like >>>> >>>> ipv6_addrs_re0=3D"2001:db8:1111:2222::1-ffff/64" >>>> >>>> However I didn't find anything to limit the number of aliases in the >>>> ipv4 version of the function either. >>>> >>>> Please test it :) >>>> >>>> >>>> Then a question about the PR >>>> (http://www.freebsd.org/cgi/query-pr.cgi?pr=3D174225) I wrote, how can= I >>>> attach this new patch to it? The submit follow up -button fires up my >>>> email client and I'm not so sure how to submit a new patch for the PR >>>> in an email in such a way that it appears properly formatted in the >>>> PR. >>>> >>>> Regards, >>>> >>>> Kimmo Paasiala >>> >>> PR updated with the new patch. >> >> Your patch applied cleanly, but it's not working or I am doing something >> wrong. >> >> root@freebsd:~ # uname -a >> FreeBSD freebsd 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r244567: Fri >> Dec 21 23:57:28 CET 2012 root@freebsd:/usr/obj/usr/src/sys/GENERIC >> amd64 >> >> root@freebsd:~ # grep -Ev '^[[:space:]]*#|^$' /etc/rc.conf >> hostname=3D"freebsd" >> ifconfig_em0=3D"up" >> ipv4_addrs_em0=3D"192.168.168.20-24/24" >> defaultrouter=3D"192.168.168.1" >> ipv6_activate_all_interfaces=3D"YES" >> ipv6_addrs_em0=3D"2001:6a0:1cb::1-6/64" >> ipv6_defaultrouter=3D"2001:6a0:1cb::ffff" >> sshd_enable=3D"YES" >> dumpdev=3D"NO" >> named_enable=3D"YES" >> >> root@freebsd:~ # ifconfig >> em0: flags=3D8843 metric 0 mtu 1= 500 >> options=3D9b >> ether 08:00:27:02:83:71 >> inet6 fe80::a00:27ff:fe02:8371%em0 prefixlen 64 scopeid 0x1 >> inet 192.168.168.20 netmask 0xffffff00 broadcast 192.168.168.255 >> inet 192.168.168.21 netmask 0xffffffff broadcast 192.168.168.21 >> inet 192.168.168.22 netmask 0xffffffff broadcast 192.168.168.22 >> inet 192.168.168.23 netmask 0xffffffff broadcast 192.168.168.23 >> inet 192.168.168.24 netmask 0xffffffff broadcast 192.168.168.24 >> nd6 options=3D21 >> media: Ethernet autoselect (1000baseT ) >> status: active >> lo0: flags=3D8049 metric 0 mtu 16384 >> options=3D600003 >> inet6 ::1 prefixlen 128 >> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 >> inet 127.0.0.1 netmask 0xff000000 >> nd6 options=3D21 >> >> -- >> best regards, >> Lukasz Wasikowski > > You need to first add a single ipv6 address using the > ifconfig_em0_ipv6 -syntax. > > ifconfig_em0_ipv6=3D"2001:6a0:1cb::1/64" > > And then this should add the rest of the addresses > > ipv6_addrs_em0=3D"2001:6a0:1cb::2-6/64" > > It looks like the reason for the difference to ipv4_addrs_IF is that > the "alias" parameter for ifconfig(8) operates differently for IPv6 > addresses, the first address of an interface can't be added with > "alias", for IPv4 it does not care. I'll have to dig deeper but that's > what the problem seems to be. > > -Kimmo The 'alias' parameter of ifconfig(8) is not the problem on the first ipv6 address, I have verified that. However, there's probably something in network.subr or /etc/rc.d/netif that I have overlooked and causes my code to be skipped if there's no ifconfig_IF_ipv6 variable defined in rc.conf(5). -Kimmo