remove ipv6on, update ipconfig(8)
This commit is contained in:
parent
2247741fe0
commit
0c7a3ad1c9
2 changed files with 15 additions and 135 deletions
104
rc/bin/ipv6on
104
rc/bin/ipv6on
|
@ -1,104 +0,0 @@
|
||||||
#!/bin/rc
|
|
||||||
# ipv6on [netdir ndbfile [gwv4]] - configure an interface for ipv6,
|
|
||||||
# once ipv4 is configured.
|
|
||||||
if (! ~ $#* 0 2 3) {
|
|
||||||
echo usage: $0 '[netdir ndbfile [gw-v4-name]]' >[1=2]
|
|
||||||
exit usage
|
|
||||||
}
|
|
||||||
rfork e
|
|
||||||
if (~ $#* 0) {
|
|
||||||
netdir=/net
|
|
||||||
ndbf=/lib/ndb/local
|
|
||||||
gw=`{ndb/ipquery sys $sysname ipgw | sed 's/ipgw=//'}
|
|
||||||
}
|
|
||||||
if not {
|
|
||||||
netdir=$1
|
|
||||||
ndbf=$2
|
|
||||||
if (~ $#* 2)
|
|
||||||
# gw=()
|
|
||||||
gw=`{ndb/ipquery sys $sysname ipgw | sed 's/ipgw=//'}
|
|
||||||
if not
|
|
||||||
gw=$3
|
|
||||||
}
|
|
||||||
if (~ $netdir /net) {
|
|
||||||
xsfx=()
|
|
||||||
xdir=()
|
|
||||||
}
|
|
||||||
if not {
|
|
||||||
xsfx=(-x `{echo $netdir | sed 's;^/net;;'})
|
|
||||||
xdir=(-x $netdir)
|
|
||||||
}
|
|
||||||
fn nonnil { # variable
|
|
||||||
if (~ $#$1 0) {
|
|
||||||
echo no ip for $1
|
|
||||||
exit no-ip
|
|
||||||
}
|
|
||||||
if (! ~ $#$1 1) {
|
|
||||||
echo multiple ips for $1
|
|
||||||
exit multiple-ips
|
|
||||||
}
|
|
||||||
}
|
|
||||||
devdir=`{awk '/^device/{print $2}' $netdir/ipifc/*/status | grep -v /dev/null}
|
|
||||||
nonnil devdir
|
|
||||||
devtype=pkt
|
|
||||||
if(~ $devdir *ether*)
|
|
||||||
devtype=ether
|
|
||||||
|
|
||||||
#
|
|
||||||
# configure v6 for link-local addresses (fe80::) & multicast (ff02::)
|
|
||||||
#
|
|
||||||
if (! ip/ipconfig -6 $xdir $devtype $devdir)
|
|
||||||
exit 'ipconfig -6 failed'
|
|
||||||
ip/ipconfig $xdir $devtype $devdir ra6 recvra 1
|
|
||||||
|
|
||||||
mev6=`{ndb/query -f $ndbf sys $sysname ipv6 | grep :}
|
|
||||||
if (~ $#mev6 0)
|
|
||||||
mev6=`{ndb/query -mf $ndbf sys $sysname ip | grep :}
|
|
||||||
# mev4=`{ndb/query -f $ndbf sys $sysname ip | grep -v :}
|
|
||||||
|
|
||||||
# for testing
|
|
||||||
if(~ $devtype ether){
|
|
||||||
mylnk=`{ip/linklocal `{cat $devdir/addr}}
|
|
||||||
nonnil mylnk
|
|
||||||
}
|
|
||||||
|
|
||||||
if (~ $#gw 1) {
|
|
||||||
if (~ $gw [0-9]*.[0-9]*.[0-9]*.[0-9]*)
|
|
||||||
gwv4=$gw
|
|
||||||
if (~ $#gwv4 0)
|
|
||||||
gwv4=`{ndb/query -f $ndbf sys $gw ip | grep -v :}
|
|
||||||
if (~ $gw *:*)
|
|
||||||
gwv6=$gw
|
|
||||||
if (~ $#gwv6 0)
|
|
||||||
gwv6=`{ndb/query -f $ndbf sys $gw ipv6 | grep :}
|
|
||||||
if (~ $#gwv6 0)
|
|
||||||
gwv6=`{ndb/query -f $ndbf sys $gw ip | grep :}
|
|
||||||
if (~ $#gwv6 0) {
|
|
||||||
if (~ $#gwv4 1) {
|
|
||||||
# echo ping gw $gwv4...
|
|
||||||
# load arp cache with gw mac
|
|
||||||
ip/ping -qn 3 $netdir/icmp!$gwv4 >/dev/null >[2=1] &
|
|
||||||
sleep 1 # wait for ping
|
|
||||||
|
|
||||||
gweth=`{grep '* '^$gwv4^' ' $netdir/arp | awk '{print $4}' }
|
|
||||||
nonnil gweth
|
|
||||||
gwlnk=`{ip/linklocal $gweth}
|
|
||||||
nonnil gwlnk
|
|
||||||
gwv6=$gwlnk
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nonnil mev6
|
|
||||||
#
|
|
||||||
# configure my global v6 addresses
|
|
||||||
#
|
|
||||||
ip/ipconfig $xdir $devtype $devdir add $mev6 /64
|
|
||||||
ip/ipconfig $xdir loopback /dev/null add $mev6 /128
|
|
||||||
|
|
||||||
if (~ $#gwv6 1) {
|
|
||||||
#
|
|
||||||
# add default v6 route to v6 addr of v4 gw
|
|
||||||
#
|
|
||||||
echo add :: /0 $gwv6 >$netdir/iproute # need not be link-local
|
|
||||||
}
|
|
||||||
exit ''
|
|
|
@ -1,6 +1,6 @@
|
||||||
.TH IPCONFIG 8
|
.TH IPCONFIG 8
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ipconfig, rip, linklocal, ipv6on \- Internet configuration and routing
|
ipconfig, rip, linklocal \- Internet configuration and routing
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.in +0.25i
|
.in +0.25i
|
||||||
.ti -0.25i
|
.ti -0.25i
|
||||||
|
@ -52,14 +52,6 @@ ipconfig, rip, linklocal, ipv6on \- Internet configuration and routing
|
||||||
]
|
]
|
||||||
.I mac
|
.I mac
|
||||||
\&...
|
\&...
|
||||||
.PP
|
|
||||||
.B ipv6on
|
|
||||||
[
|
|
||||||
.I netmtpt
|
|
||||||
.I ndbfile
|
|
||||||
[
|
|
||||||
.I gwv4
|
|
||||||
]\|]
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Ipconfig
|
.I Ipconfig
|
||||||
binds a device interface to a mounted IP stack (default
|
binds a device interface to a mounted IP stack (default
|
||||||
|
@ -73,12 +65,13 @@ The addresses can be specified in the command line or obtained via DHCP.
|
||||||
If DHCP is requested, it will also obtain the addresses of DNS
|
If DHCP is requested, it will also obtain the addresses of DNS
|
||||||
servers, NTP servers, gateways, a Plan 9 file server,
|
servers, NTP servers, gateways, a Plan 9 file server,
|
||||||
and a Plan 9 authentication server.
|
and a Plan 9 authentication server.
|
||||||
If this is the first non-loopback
|
Information from DHCP and IPv6 router advertisements is written to
|
||||||
interface on the IP stack, the information will be written to
|
|
||||||
.B /net/ndb
|
.B /net/ndb
|
||||||
in the form of an
|
in the form of an
|
||||||
.IR ndb (8)
|
.IR ndb (8)
|
||||||
entry.
|
entry unless the
|
||||||
|
.B P
|
||||||
|
flag has been specified.
|
||||||
.PP
|
.PP
|
||||||
.I Type
|
.I Type
|
||||||
may be
|
may be
|
||||||
|
@ -175,7 +168,7 @@ turn on debugging.
|
||||||
the default gateway.
|
the default gateway.
|
||||||
.TP
|
.TP
|
||||||
.B G
|
.B G
|
||||||
use only generic DHCP options. Without this option,
|
use only generic DHCP and RA options. Without this option,
|
||||||
.I ipconfig
|
.I ipconfig
|
||||||
adds to requests a Vendor Class option with value
|
adds to requests a Vendor Class option with value
|
||||||
.BI plan9_$ cputype
|
.BI plan9_$ cputype
|
||||||
|
@ -197,10 +190,15 @@ determine parameters but don't configure the interface.
|
||||||
.TP
|
.TP
|
||||||
.B N
|
.B N
|
||||||
look in
|
look in
|
||||||
.B /lib/ndb
|
.I dbfile
|
||||||
for the IP parameters. This only works if the
|
(default
|
||||||
interface is an ethernet. It uses the ethernet address to find
|
.BR /lib/ndb/local )
|
||||||
a matching entry.
|
for the IP parameters for the specified IP address or if the
|
||||||
|
IP is omited and the device is an ethernet then all IP parameters
|
||||||
|
associated with the MAC address. IPv6 addresses are added only
|
||||||
|
if a IPv6 link local address exists on the interface or the
|
||||||
|
.B 6
|
||||||
|
flag has been given to automatically configure one.
|
||||||
.TP
|
.TP
|
||||||
.B O
|
.B O
|
||||||
addresses specified on the command line override those obtained via DHCP.
|
addresses specified on the command line override those obtained via DHCP.
|
||||||
|
@ -322,18 +320,6 @@ and
|
||||||
.I 6to4
|
.I 6to4
|
||||||
gateway
|
gateway
|
||||||
.IR gwipv4 .
|
.IR gwipv4 .
|
||||||
.PP
|
|
||||||
.I Ipv6on
|
|
||||||
uses the network database at
|
|
||||||
.I ndbfile
|
|
||||||
to configure the network mounted on
|
|
||||||
.I netmtpt
|
|
||||||
with a link-local address (derived from its MAC address)
|
|
||||||
and attempts to add a default IPv6 route to the local
|
|
||||||
IPv4 gateway's IPv6 address.
|
|
||||||
If
|
|
||||||
.I gwv4
|
|
||||||
is supplied, it will be used as the gateway IPv4 address.
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
Configure Ethernet 0 as the primary IP interface.
|
Configure Ethernet 0 as the primary IP interface.
|
||||||
Get all addresses via DHCP. Start up a connection server
|
Get all addresses via DHCP. Start up a connection server
|
||||||
|
@ -386,8 +372,6 @@ ip/ipconfig ra6 recvra 1
|
||||||
.B /sys/src/cmd/ip/rip.c
|
.B /sys/src/cmd/ip/rip.c
|
||||||
.br
|
.br
|
||||||
.B /sys/src/cmd/ip/linklocal.c
|
.B /sys/src/cmd/ip/linklocal.c
|
||||||
.br
|
|
||||||
.B /rc/bin/ipv6on
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.IR ether (3),
|
.IR ether (3),
|
||||||
.IR ip (3),
|
.IR ip (3),
|
||||||
|
|
Loading…
Reference in a new issue