diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-08-15 21:39:30 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2018-08-15 21:39:30 +0200 |
commit | cd752a39f8b0b36378800740c0e5915beabfb56d (patch) | |
tree | b1c2b1c531321704e49928e0771dac90badef186 | |
parent | ab4c0a012f4b57e9a9a2c084097c919a40029380 (diff) | |
download | plan9front-cd752a39f8b0b36378800740c0e5915beabfb56d.tar.xz |
ipv6 autoconfiguration on ethernet
for ip autoconfiguration, setup ipv6 link local addresses
and do SLAAC in parallel to DHCP.
-rwxr-xr-x | rc/bin/cpurc | 10 | ||||
-rwxr-xr-x | rc/bin/inst/configether | 8 | ||||
-rwxr-xr-x | rc/bin/inst/ndbsetup | 4 | ||||
-rwxr-xr-x | rc/bin/inst/startether | 9 | ||||
-rwxr-xr-x | rc/bin/termrc | 10 | ||||
-rwxr-xr-x | sys/src/9/boot/net.rc | 25 |
6 files changed, 44 insertions, 22 deletions
diff --git a/rc/bin/cpurc b/rc/bin/cpurc index 404f494ff..f1d4dfd99 100755 --- a/rc/bin/cpurc +++ b/rc/bin/cpurc @@ -62,9 +62,13 @@ if(test -r /net/ipselftab){ addr=`{cat $ether/addr} switch($addr){ case $addrs - # try /lib/ndb first, then do dhcp - ip/ipconfig -N ether $ether >[2]/dev/null \ - || ip/ipconfig -h $sysname ether $ether + # try /lib/ndb first, then do dhcp/slaac + ip/ipconfig -6 ether $ether + ip/ipconfig -N ether $ether >[2]/dev/null || @{ + ip/ipconfig ether $ether ra6 recvra 1 & + ip/ipconfig -h $sysname ether $ether & + wait + } } } } diff --git a/rc/bin/inst/configether b/rc/bin/inst/configether index f61d464c4..d3568c18d 100755 --- a/rc/bin/inst/configether +++ b/rc/bin/inst/configether @@ -8,10 +8,10 @@ case go echo 'Please choose a method for configuring your ethernet connection.' echo echo ' manual - specify IP address, network mask, gateway IP address' - echo ' dhcp - use DHCP to automatically configure' + echo ' automatic - use DHCP and SLAAC to automatically configure' echo - prompt -d dhcp 'Configuration method' manual dhcp + prompt -d automatic 'Configuration method' manual automatic ethermethod=$rd gwaddr=xxx ipaddr=xxx @@ -26,11 +26,11 @@ case go export DNSSERVER } } - export ethermethod gwaddr ipaddr ipmask dhcphost + export ethermethod gwaddr ipaddr ipmask exec ./startether go case checkdone - if(! ~ $ethermethod manual dhcp) { + if(! ~ $ethermethod manual automatic) { configether=notdone export configether } diff --git a/rc/bin/inst/ndbsetup b/rc/bin/inst/ndbsetup index 8c72076ef..076793d53 100755 --- a/rc/bin/inst/ndbsetup +++ b/rc/bin/inst/ndbsetup @@ -7,7 +7,7 @@ etheraddr=`{cat $netdev/addr >[2]/dev/null} switch($1){ case checkready checkdone - if(~ $#etheraddr 1 && ~ $netisfrom ether && ~ $ethermethod dhcp manual && \ + if(~ $#etheraddr 1 && ~ $netisfrom ether && ~ $ethermethod automatic manual && \ ! grep -s $etheraddr /n/newfs/lib/ndb/local) ndbsetup=ready if not @@ -33,7 +33,7 @@ case go echo switch($ethermethod){ - case dhcp + case automatic echo $se case manual echo $se 'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr diff --git a/rc/bin/inst/startether b/rc/bin/inst/startether index cb38e6dbd..7544378ed 100755 --- a/rc/bin/inst/startether +++ b/rc/bin/inst/startether @@ -15,11 +15,16 @@ case go exit log starting ethernet $ethermethod config + ip/ipconfig -6 switch($ethermethod) { case manual ip/ipconfig -g $gwaddr ether $netdev $ipaddr $ipmask >>[2]/srv/log - case dhcp - ip/ipconfig >>[2]/srv/log + case automatic + >>[2]/srv/log @{ + ip/ipconfig ra6 recva 1 & + ip/ipconfig & + wait + } } case checkdone diff --git a/rc/bin/termrc b/rc/bin/termrc index f160915e6..656b6a77f 100755 --- a/rc/bin/termrc +++ b/rc/bin/termrc @@ -63,9 +63,13 @@ if(test -r /net/ipselftab){ addr=`{cat $ether/addr} switch($addr){ case $addrs - # try /lib/ndb first, then do dhcp - ip/ipconfig -N ether $ether >[2]/dev/null \ - || ip/ipconfig -h $sysname ether $ether + # try /lib/ndb first, then do dhcp/slaac + ip/ipconfig -6 ether $ether + ip/ipconfig -N ether $ether >[2]/dev/null || @{ + ip/ipconfig ether $ether ra6 recvra 1 & + ip/ipconfig -h $sysname ether $ether & + wait + } } } } diff --git a/sys/src/9/boot/net.rc b/sys/src/9/boot/net.rc index 27458081a..79c0b81fa 100755 --- a/sys/src/9/boot/net.rc +++ b/sys/src/9/boot/net.rc @@ -15,7 +15,16 @@ fn confignet{ } } - must ip/ipconfig -p $* + if(~ $1 ether && ~ $#* 2) @{ + ip/ipconfig -6 $* + ip/ipconfig $* ra6 recvra 1 & + ip/ipconfig -p $* & + wait + } + if not { + ip/ipconfig -p $* + } + if(~ $#fs 0) fs=`{awk -F'=' '/^[ ]*fs=/{print $2}' /net/ndb} if(~ $#auth 0) @@ -33,13 +42,13 @@ fn confignet{ } } - # set bootstrap authservers for factotum - if(! ~ $#auth 0){ - grep -v '^[ ]*auth=' /net/ndb >/env/x - cat /env/x <{echo ' auth='^$auth^' -'} >/net/ndb - rm /env/x - } + # publish info in /net/ndb for factotum + >> /net/ndb { + echo + echo 'ipbootinfo=' + for(i in $fs) echo ' fs='^$i + for(i in $auth) echo ' auth='^$i + } } fn connecttcp{ |