From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-02-7.dondominio.net ([31.214.176.40]) by ur; Sun Apr 3 12:50:15 EDT 2016 Received: from mail-node.dondominio.com by smtp-relay.dondominio.com (Postfix) with ESMTP id DA63642916 for <9front@9front.org>; Sun, 3 Apr 2016 18:50:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=shike2.com; s=dddk; t=1459702202; bh=1EeHiviffPG+YwtsVoFwCPOpnKl7vPjY1yQFfU8+Fag=; h=Message-ID:To:Subject:Date:From:Content-Type; b=vOxrpneh6v7gEo/rTMMny30D+OxXFtSQAyPJEpomduHQ3OCpJDEsvtAnD56MQ4evw OBKwV6UDBk/Rs8TaglA4LBuNXbU/xPbhzrrd/vuL11lp/ayI/EOgs/zZug1Qp5ArCw 5PnDZgGwT1zrilsf61yfNZ0EJ/2PGNE7cHstwCdE= Received: by mail-node.dondominio.com (Postfix, from userid 4000) id D836D420B6; Sun, 3 Apr 2016 18:50:02 +0200 (CEST) Received: from hal9000 (87.177.216.87.static.jazztel.es [87.216.177.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: k0ga@shike2.com) by mail-node.dondominio.com (Postfix) with ESMTPSA id 010B641C33 for <9front@9front.org>; Sun, 3 Apr 2016 18:50:01 +0200 (CEST) Message-ID: To: 9front@9front.org Subject: Take ethernet interface from ndb in ipv6on Date: Sun, 3 Apr 2016 18:49:59 +0200 From: k0ga@shike2.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (mail-node.dondominio.com [0.0.0.0]); Sun, 03 Apr 2016 18:50:02 +0200 (CEST) List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: flexible anonymous STM software Hi, ipv6on has several problems, because lines like: if (! ip/ipconfig -6 $xdir ether $netdir/ether?) will fail when there are more of one interface in /net or when the interface has a slighty different name, like for example etherU0 in the raspberry pi. This patch uses ndb to guess what if the interface for the ipv6 pair, and in case of not having any ether entry in ndb then it takes the first ether* in /net (or in general in the net mount point). 8<-------- diff -r 3e63050481a8 rc/bin/ipv6on --- a/rc/bin/ipv6on Sat Mar 05 07:44:02 2016 +0100 +++ b/rc/bin/ipv6on Sun Apr 03 18:20:44 2016 +0200 @@ -40,20 +40,36 @@ } } -# -# configure v6 for link-local addresses (fe80::) & multicast (ff02::) -# -if (! ip/ipconfig -6 $xdir ether $netdir/ether?) - exit 'ipconfig -6 failed' -ip/ipconfig $xdir ether $netdir/ether? ra6 recvra 1 - mev6=`{ndb/query -f $ndbf sys $sysname ipv6} if (~ $#mev6 0 || ~ $mev6 '') mev6=`{ndb/query -mf $ndbf sys $sysname ip | grep :} # mev4=`{ndb/query -f $ndbf sys $sysname ip | grep -v :} +# +# Get our mac from ndb +eth=`{ndb/query -f $ndbf ipv6 $mev6 ether} +if (~ $#eth 0 || ~ $eth '') + eth=`{ndb/query -f $ndbf sys $sysname ether} + +# +# Get the ether for our mac +if (~ $#eth 1 && ! ~ $eth '') + ifc=`{for (i in $netdir/ether*) + if (~ `{cat $i/addr} $eth) echo $i} + +if (~ $#ifc 0 || ~ $ifc '') + ifc=`{ls -d $netdir/ether* | sed -n 1q} + +# +# configure v6 for link-local addresses (fe80::) & multicast (ff02::) +# +if (! ip/ipconfig -6 $xdir ether $ifc) + exit 'ipconfig -6 failed' +ip/ipconfig $xdir ether $ifc ra6 recvra 1 + + # for testing -mylnk=`{ip/linklocal `{cat $netdir/ether?/addr}} +mylnk=`{ip/linklocal `{cat $ifc/addr}} nonnil mylnk if (~ $#gw 1) { @@ -79,8 +95,8 @@ # # configure my global v6 addresses # -ip/ipconfig $xdir ether $netdir/ether? add $mev6 /64 +ip/ipconfig $xdir ether $ifc add $mev6 /64 ip/ipconfig $xdir loopback /dev/null add $mev6 /128 if (~ $#gw 1) { if (~ $#gwv6 0 || ~ $gwv6 '')