--- /rc/bin/ipv6on Wed Mar 30 20:24:28 2011 +++ /rc/bin/ipv6on Fri Dec 6 07:17:28 2013 @@ -1,6 +1,7 @@ #!/bin/rc # ipv6on [netdir ndbfile [gwv4]] - configure an interface for ipv6, -# once ipv4 is configured. +# once ipv4 is configured. use ipv6 address from ndb if present, +# else do stateless-autoconfiguration (SLAC). if (! ~ $#* 0 2 3) { echo usage: $0 '[netdir ndbfile [gw-v4-name]]' >[1=2] exit usage @@ -41,37 +42,42 @@ } # -# configure v6 for link-local addresses (fe80::) & multicast (ff02::) +# configure v6 for link-local addresses (fe80::) & multicast (ff02::). +# accept router advertisements. # if (! ip/ipconfig -6 $xdir ether $netdir/ether?) exit 'ipconfig -6 failed' ip/ipconfig $xdir ether $netdir/ether? ra6 recvra 1 +# lookup any v6 address for me in ndb mev6=`{ndb/query -f $ndbf sys $sysname ipv6} if (~ $#sysname 0 || ~ $sysname '') mev6=`{ndb/query -f $ndbf sys $sysname ip | grep :} -# mev4=`{ndb/query -f $ndbf sys $sysname ip | grep -v :} # for testing mylnk=`{ip/linklocal `{cat $netdir/ether?/addr}} nonnil mylnk +# +# have gateway? try to map to a v6 address; get eui-64 of v4's mac +# if (~ $#gw 1) { - if (~ $gw [0-9]*.[0-9]*.[0-9]*.[0-9]*) + if (~ $gw [0-9]*.[0-9]*.[0-9]*.[0-9]*) # is it v4? gwv4 = $gw - if (~ $#gwv4 0 || ~ $gwv4 '') # assume namev6 and name + if (~ $#gwv4 0 || ~ $gwv4 '') gwv4=`{ndb/query -f $ndbf sys $gw ip} gwv6=`{ndb/query -f $ndbf sys $gw ipv6} - if (! ~ $#gwv4 0) { + if (! ~ $#gwv4 0) { # have v4 gateway? # 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 + sleep 1 # wait briefly for ping + # get v4 gateway's mac gweth=`{grep '* '^$gwv4^' ' $netdir/arp | awk '{print $4}' } nonnil gweth >[2]/dev/null # don't frighten users - gwlnk=`{ip/linklocal $gweth} + gwlnk=`{ip/linklocal $gweth} # get mac's eui-64 nonnil gwlnk >[2]/dev/null } } @@ -79,16 +85,23 @@ # # configure my global v6 addresses # -ip/ipconfig $xdir ether $netdir/ether? add $mev6 /64 +v6mask=`{ndb/ipquery ip $mev6 ipmask} +ip/ipconfig $xdir ether $netdir/ether? add $mev6 $v6mask ip/ipconfig $xdir loopback /dev/null add $mev6 /128 +# +# have gateway? find its v6 address and make it our default route +# if (~ $#gw 1) { - if (~ $#gwv6 0 || ~ $gwv6 '') - gwv6=`{ip/linklocal $gweth} + if (~ $#gwv6 0 || ~ $gwv6 '') { + if (~ $#gwlnk 0 || ~ $gwlnk '') + gwv6=`{ip/linklocal $gweth} + if not + gwv6=$gwlnk + } nonnil gwv6 - # + # add default v6 route to v6 addr of v4 gw - # echo add :: /0 $gwv6 >$netdir/iproute # need not be link-local } exit '' --- /sys/man/8/ipconfig Fri Jun 10 20:08:43 2011 +++ /sys/man/8/ipconfig Fri Dec 6 02:58:31 2013 @@ -357,8 +357,8 @@ .EX % bind -b '#l1' /net.alt % bind -b '#I1' /net.alt -% ip/ipconfig -x /net.alt -g 204.178.31.1 ether /net.alt/ether1\\ - 204.178.31.6 255.255.255.0 +% ip/ipconfig -x /net.alt -g 135.104.24.1 ether /net.alt/ether1\\ + 135.104.24.14 255.255.255.0 % ndb/cs -x /net.alt -f /lib/ndb/external % ndb/dns -sx /net.alt -f /lib/ndb/external % aux/listen -d /rc/bin/service.alt /net.alt/tcp --- /sys/man/8/ndb Thu Mar 29 01:07:42 2012 +++ /sys/man/8/ndb Fri Dec 6 02:57:27 2013 @@ -746,10 +746,10 @@ .EX % ndb/dnsquery > plan9.bell-labs.com ip -plan9.bell-labs.com ip 204.178.31.2 -> 204.178.31.2 ptr -2.31.178.204.in-addr.arpa ptr plan9.bell-labs.com -2.31.178.204.in-addr.arpa ptr ampl.com +plan9.bell-labs.com ip 135.104.24.16 +> 135.104.24.16 ptr +16.24.104.135.in-addr.arpa ptr plan9.bell-labs.com +16.24.104.135.in-addr.arpa ptr ampl.com > .EE .LP --- /sys/man/8/stub Mon Dec 3 00:42:28 2007 +++ /sys/man/8/stub Fri Dec 6 02:56:32 2013 @@ -44,7 +44,7 @@ % bind /net.alt/tcp /net/mit % con -l mit!plan9.bell-labs.com!whoami connected to mit!plan9.bell-labs.com!whoami on /net/mit/0 -i am 204.178.31.2 sysname achille you are 18.26.4.9 port 1248 +i am 135.104.24.16 sysname achille you are 18.26.4.9 port 1248 % .EE .SH SOURCE --- /sys/src/9/boot/boot.c Mon Dec 2 23:38:51 2013 +++ /sys/src/9/boot/boot.c Thu Dec 5 22:50:15 2013 @@ -68,7 +68,8 @@ print("%#p %s ", argv[fd], argv[fd]); print("\n"); #endif /* DEBUG */ - SET(fd, argc, argv); USED(fd, argc, argv); + SET(fd); + USED(argc, argv, fd); } /* --- /sys/src/9/kw/fns.h Wed Nov 14 01:23:42 2012 +++ /sys/src/9/kw/fns.h Fri Dec 6 00:59:13 2013 @@ -162,12 +162,10 @@ void pcisetmwi(Pcidev*); int pcisetpms(Pcidev*, int); int cas32(void*, u32int, u32int); -int tas32(void*); #define CASU(p, e, n) cas32((p), (u32int)(e), (u32int)(n)) #define CASV(p, e, n) cas32((p), (u32int)(e), (u32int)(n)) #define CASW(addr, exp, new) cas32((addr), (exp), (new)) -#define TAS(addr) tas32(addr) extern void forkret(void); extern int userureg(Ureg*); --- /sys/src/9/kw/l.s Mon Apr 30 21:23:30 2012 +++ /sys/src/9/kw/l.s Fri Dec 6 01:00:17 2013 @@ -51,8 +51,10 @@ /* drain L1 write buffer, also drains L2 eviction buffer on sheeva */ BARRIERS - /* make the l2 cache pay attention */ + /* make the l2 cache pay attention and disable resets */ MOVW $(PHYSIO+0x20100), R1 /* CPUCSREG */ + MOVW $0, R0 + MOVW R0, 8(R1) /* cpu->rstout = 0; */ MOVW (4*10)(R1), R2 ORR $(1<<3), R2 /* cpu->l2cfg |= L2exists */ MOVW R2, (4*10)(R1) @@ -77,7 +79,14 @@ BARRIERS PUTC('\r') + /* turn off watchdog; see clock.c */ + MOVW $(PHYSIO+0x20300), R1 /* tmr = (TimerReg *)soc.clock; */ + MOVW $0, R0 + MOVW R0, 0(R1) /* tmr->ctl = 0; */ + BARRIERS + /* clear Mach */ + MOVW $0, R0 MOVW $PADDR(MACHADDR), R4 /* address of Mach */ _machZ: MOVW R0, (R4) @@ -133,7 +142,7 @@ /* * set up a temporary stack; avoid data & bss segments */ - MOVW $(PHYSDRAM | (128*1024*1024)), R13 + MOVW $(PHYSDRAM | (400*1024*1024)), R13 PUTC('P') /* set the domain access control */ @@ -168,7 +177,7 @@ * set up temporary stack again, in case we've just switched * to a new register set. */ - MOVW $(KZERO|(128*1024*1024)), R13 + MOVW $(KZERO|(400*1024*1024)), R13 /* can now execute arbitrary C code */ @@ -196,7 +205,6 @@ MOVW R0, R13 ADD $(MACHSIZE), R13 /* stack pointer */ SUB $4, R13 /* space for link register */ - BL main(SB) /* void main(Mach*) */ /* fall through */ --- /sys/src/9/teg2/main.c Fri Jul 26 00:33:01 2013 +++ /sys/src/9/teg2/main.c Thu Dec 5 22:50:22 2013 @@ -718,7 +718,7 @@ * of the argument list checked in syscall. */ i = oargblen+1; - p = UINT2PTR(STACKALIGN(base + BY2PG - Ustkheadroom)); + p = UINT2PTR(STACKALIGN(base + BY2PG - Ustkheadroom - i)); memmove(p, oargb, i); /*