--- /rc/bin/ipv6on Fri Dec 6 07:17:28 2013 +++ /rc/bin/ipv6on Tue Mar 18 22:17:57 2014 @@ -1,25 +1,23 @@ #!/bin/rc -# ipv6on [netdir ndbfile [gwv4]] - configure an interface for ipv6, -# once ipv4 is configured. use ipv6 address from ndb if present, -# else do stateless-autoconfiguration (SLAC). +# ipv6on [netdir ndbfile] - configure an interface for ipv6. +# use ipv6 address from ndb if present, +# else do stateless address autoconfiguration (SLAAC). if (! ~ $#* 0 2 3) { - echo usage: $0 '[netdir ndbfile [gw-v4-name]]' >[1=2] + echo usage: $0 '[netdir ndbfile [obs-gw-v4-name]]' >[1=2] exit usage } rfork e +fn ipq { # attr val rattr + ndb/ipquery $* | sed 's/^[a-z0-9]+=//' +} + 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=() @@ -43,65 +41,32 @@ # # configure v6 for link-local addresses (fe80::) & multicast (ff02::). -# accept router advertisements. +# accept router advertisements, which will contain a default route. # 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 :} - -# 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]*) # is it v4? - gwv4 = $gw - if (~ $#gwv4 0 || ~ $gwv4 '') - gwv4=`{ndb/query -f $ndbf sys $gw ip} - gwv6=`{ndb/query -f $ndbf sys $gw ipv6} - - 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 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} # get mac's eui-64 - nonnil gwlnk >[2]/dev/null - } +# lookup any v6 address for me in ndb, else use slaac +myeth=`{cat $netdir/ether?/addr} +mev6=`{ndb/query -f $ndbf ether $myeth ipv6} +if (~ $#mev6 0 || ~ $mev6 '') + mev6=`{ndb/query -f $ndbf sys $sysname ipv6} +if (~ $#mev6 0 || ~ $mev6 '') { + # slaac: could perhaps get prefix from above RA + ipnet=`{ipq ether $myeth ipnet} + if (~ $#ipnet 0 || ~ $ipnet '') + ipnet=`{ipq sys $sysname ipnet} + nonnil ipnet + v6pfx=`{ipq ipnet $ipnet ipv6pfx} + nonnil v6pfx + mev6=`{ip/linklocal $myeth | sed 's/^fe80:/'$v6pfx'/'} } nonnil mev6 + # # configure my global v6 addresses # -v6mask=`{ndb/ipquery ip $mev6 ipmask} +v6mask=`{ipq 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 '') { - 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 '' --- /rc/bin/ssh Wed Feb 12 06:49:40 2014 +++ /rc/bin/ssh Tue Mar 18 22:17:02 2014 @@ -1,3 +1,4 @@ #!/bin/rc -# ssh host arg... - invoke ssh v1 -exec /$cputype/bin/ssh1 $* +# ssh host arg... - invoke ssh v1. if it fails, try v2. +if (! /$cputype/bin/ssh1 $* >[2]/dev/null) + exec /$cputype/bin/ssh2 $* --- /sys/games/lib/fortunes Tue Mar 4 22:43:50 2014 +++ /sys/games/lib/fortunes Tue Mar 18 22:23:37 2014 @@ -4320,3 +4320,5 @@ The U.S. government has to get out of the business of fucking with encryption standards. - Richard Clarke How do you tell a bad standard? If it begins with "I", e.g, I2O, IPMI. If it ends with "I", e.g., ACPI, EFI, IPMI, etc. If it has the word "intelligent" in it, e.g., I2O, IPMI. Or, the best, if it has all three, e.g., IPMI. - Ron Minnich It's frequently easier to read disassembled glibc object code than the glibc source. - Ron Minnich +Most of your set-top box issues can be resolved by rebooting the device. Please select this option to reboot your device. This will NOT erase the settings. - FiOS set-top box troubleshooter. +There is no avoiding war, it can only be postponed to the advantage of the enemy. - Niccolò Machiavelli --- /sys/lib/kbmap/uk Thu Mar 29 20:37:02 2012 +++ /sys/lib/kbmap/uk Tue Mar 18 22:48:58 2014 @@ -6,3 +6,7 @@ 0 86 '\ 4 86 ^\ 1 86 '| + +2 86 '\ +5 86 ^\ +6 86 '| --- /sys/man/8/dhcpd Wed Nov 20 22:29:47 2013 +++ /sys/man/8/dhcpd Tue Mar 18 22:18:14 2014 @@ -203,11 +203,11 @@ would have done. .TP .B s -Sleep 2 seconds before answering requests for static addresses. +Sleep roughly 1 to 2 seconds before answering requests for static addresses. This is used to make a server be a backup only. .TP .B S -Sleep 2 seconds before answering requests for dynamic addresses. +Sleep roughly 1 to 2 seconds before answering requests for dynamic addresses. .TP .B x The IP stack to use is mounted at --- /sys/man/8/ipconfig Fri Dec 6 02:58:31 2013 +++ /sys/man/8/ipconfig Tue Mar 18 22:18:29 2014 @@ -55,9 +55,7 @@ [ .I netmtpt .I ndbfile -[ -.I gwipv4 -]\|] +] .SH DESCRIPTION .I Ipconfig binds a device interface (default @@ -321,12 +319,15 @@ .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 gwipv4 -is supplied, it will be used as the gateway's IPv4 address. +with an IPv6 link-local address (derived from its MAC address) +and an IPv6 global address, either from an +.B ipv6 +attribute for +.B $sysname +or the interface's MAC address, +if present, +or via stateless address autoconfiguration. +It also attempts to add a default IPv6 route from a router advertisement. .SH EXAMPLES Configure Ethernet 0 as the primary IP interface. Get all addresses via DHCP. Start up a connection server @@ -393,3 +394,10 @@ .br .B /lib/rfc/rfc2373 for IPv6's modified EUI-64 +.SH BUGS +Currently, SLAAC relies on each +.B ipnet +declaration containing an +.B ipv6pfx +attribute. +This should be replaced by a router advertisement prefix. --- /sys/src/9/ip/ip.h Tue Apr 30 05:58:57 2013 +++ /sys/src/9/ip/ip.h Tue Mar 18 22:32:41 2014 @@ -38,7 +38,7 @@ Addrlen= 64, Maxproto= 20, Nhash= 64, - Maxincall= 32, /* max. conn.s in listen q not accepted yet */ + Maxincall= 64, /* max. conn.s in listen q not accepted yet */ Nchans= 1024, MAClen= 16, /* longest mac address */ --- /sys/src/9/pc/ether8169.c Wed Mar 12 00:26:22 2014 +++ /sys/src/9/pc/ether8169.c Tue Mar 18 22:32:01 2014 @@ -219,8 +219,9 @@ /* */ enum { /* Ring sizes (<= 1024) */ - Ntd = 64, /* Transmit Ring */ - Nrd = 1024, /* Receive Ring */ + /* were 1024 & 64, but 253 and 9 are ample. */ + Nrd = 256, /* Receive Ring */ + Ntd = 32, /* Transmit Ring */ Mtu = ETHERMAXTU, Mps = ROUNDUP(ETHERMAXTU+4, 128), @@ -297,7 +298,7 @@ int rcr; /* receive configuration register */ int imr; - Watermark wmrb; +// Watermark wmrb; Watermark wmrd; Watermark wmtd; @@ -513,8 +514,10 @@ nexterror(); } + dtcc = ctlr->dtcc; + assert(dtcc); csr32w(ctlr, Dtccr+4, 0); - csr32w(ctlr, Dtccr, PCIWADDR(ctlr->dtcc)|Cmd); + csr32w(ctlr, Dtccr, PCIWADDR(dtcc)|Cmd); for(timeo = 0; timeo < 1000; timeo++){ if(!(csr32r(ctlr, Dtccr) & Cmd)) break; @@ -523,8 +526,6 @@ if(csr32r(ctlr, Dtccr) & Cmd) error(Eio); - dtcc = ctlr->dtcc; - edev->oerrs = dtcc->txer; edev->crcs = dtcc->rxer; edev->frames = dtcc->fae; @@ -859,9 +860,8 @@ qunlock(&ctlr->alock); error(Enomem); } - memset(ctlr->dtcc, 0, sizeof(Dtcc)); /* paranoia */ rtl8169init(edev); - initmark(&ctlr->wmrb, Nrd, "rcv bufs unprocessed"); +// initmark(&ctlr->wmrb, Nrb, "rcv bufs unprocessed"); initmark(&ctlr->wmrd, Nrd-1, "rcv descrs processed at once"); initmark(&ctlr->wmtd, Ntd-1, "xmit descr queue len"); ctlr->init = 1; --- /sys/src/9/pc/ether82557.c Fri Sep 28 02:04:20 2012 +++ /sys/src/9/pc/ether82557.c Tue Mar 18 22:32:01 2014 @@ -20,8 +20,12 @@ #include "etherif.h" enum { - Nrfd = 64, /* receive frame area */ - Ncb = 64, /* maximum control blocks queued */ + /* + * these were both 64. increased them to try to improve lookout's + * reliability as a pxe booter. + */ + Nrfd = 128, /* receive frame area */ + Ncb = 128, /* maximum control blocks queued */ NullPointer = 0xFFFFFFFF, /* 82557 NULL pointer */ }; --- /sys/src/9/pc/ether82563.c Tue Mar 11 20:47:37 2014 +++ /sys/src/9/pc/ether82563.c Tue Mar 18 22:32:01 2014 @@ -414,10 +414,10 @@ }; enum { - Nrd = 512, /* power of two */ - Ntd = 64, /* power of two */ - /* 1024 buffers can be filled in 12 ms. at full line rate */ - Nrb = 1024, /* private receive buffers per Ctlr */ + /* were 512, 1024 & 64, but 52, 253 and 9 are ample. */ + Nrd = 128, /* power of two */ + Nrb = 256, /* private receive buffers per Ctlr */ + Ntd = 32, /* power of two */ }; enum { --- /sys/src/9/pc/ether82598.c Tue Mar 11 23:18:12 2014 +++ /sys/src/9/pc/ether82598.c Tue Mar 18 22:32:01 2014 @@ -22,10 +22,11 @@ Descalign= 128, /* 599 manual needs 128-byte alignment */ /* tunable parameters */ - Nrd = 256, /* multiple of 8, power of 2 for NEXTPOW2 */ - Nrb = 1024, - Ntd = 64, /* multiple of 8, power of 2 for NEXTPOW2 */ Goslow = 0, /* flag: go slow by throttling intrs, etc. */ + /* were 256, 1024 & 64, but 30, 47 and 1 are ample. */ + Nrd = 64, /* multiple of 8, power of 2 for NEXTPOW2 */ + Nrb = 128, + Ntd = 32, /* multiple of 8, power of 2 for NEXTPOW2 */ }; enum { --- /sys/src/9/pc/etherdp83820.c Mon Oct 31 19:46:48 2011 +++ /sys/src/9/pc/etherdp83820.c Tue Mar 18 22:32:01 2014 @@ -335,10 +335,11 @@ }; enum { - Nrd = 256, - Nrb = 4*Nrd, Rbsz = ROUNDUP(sizeof(Etherpkt)+8, 8), - Ntd = 64, + /* were 256, 4*Nrd & 64, but 52, 253 and 9 are ample. */ + Nrd = 128, + Nrb = 256, + Ntd = 32, }; typedef struct Ctlr Ctlr; --- /sys/src/9/pc/etherigbe.c Tue Mar 11 20:47:04 2014 +++ /sys/src/9/pc/etherigbe.c Tue Mar 18 22:32:01 2014 @@ -443,10 +443,11 @@ }; enum { - Nrd = 256, /* multiple of 8 */ - Ntd = 64, /* multiple of 8 */ - Nrb = 1024, /* private receive buffers per Ctlr */ Rbsz = 2048, + /* were 256, 1024 & 64, but 52, 253 and 9 are ample. */ + Nrd = 128, /* multiple of 8 */ + Nrb = 256, /* private receive buffers per Ctlr */ + Ntd = 32, /* multiple of 8 */ }; typedef struct Ctlr Ctlr; --- /sys/src/cmd/acme/cols.c Fri Mar 18 05:17:05 2005 +++ /sys/src/cmd/acme/cols.c Tue Mar 18 22:49:11 2014 @@ -111,7 +111,7 @@ colclose(Column *c, Window *w, int dofree) { Rectangle r; - int i; + int i, didmouse, up; /* w is locked */ if(!c->safe) @@ -125,7 +125,7 @@ w->tag.col = nil; w->body.col = nil; w->col = nil; - restoremouse(w); + didmouse = restoremouse(w); if(dofree){ windelete(w); winclose(w); @@ -137,6 +137,7 @@ draw(screen, r, display->white, nil, ZP); return; } + up = 0; if(i == c->nw){ /* extend last window down */ w = c->w[i-1]; r.min.y = w->r.min.y; @@ -144,10 +145,15 @@ }else{ /* extend next window up */ w = c->w[i]; r.max.y = w->r.max.y; + up = 1; } draw(screen, r, textcols[BACK], nil, ZP); - if(c->safe) + if(c->safe){ winresize(w, r, FALSE); + USED(up); + if(!didmouse) + movetodel(w); + } } void --- /sys/src/cmd/acme/fns.h Wed Jan 13 18:21:48 2010 +++ /sys/src/cmd/acme/fns.h Tue Mar 18 22:49:11 2014 @@ -19,10 +19,11 @@ char* getname(Text*, Text*, Rune*, int, int); void scrsleep(uint); void savemouse(Window*); -void restoremouse(Window*); +int restoremouse(Window*); void clearmouse(void); void allwindows(void(*)(Window*, void*), void*); uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*); +void movetodel(Window*); Window* errorwin(Mntdir*, int); Window* errorwinforwin(Window*); --- /sys/src/cmd/acme/util.c Mon May 12 21:19:58 2008 +++ /sys/src/cmd/acme/util.c Tue Mar 18 22:49:11 2014 @@ -366,12 +366,18 @@ mousew = w; } -void +int restoremouse(Window *w) { - if(mousew!=nil && mousew==w) + int did; + + did = 0; + if(mousew!=nil && mousew==w){ moveto(mousectl, prevmouse); + did = 1; + } mousew = nil; + return did; } void --- /sys/src/cmd/acme/wind.c Thu Jul 28 06:48:32 2005 +++ /sys/src/cmd/acme/wind.c Tue Mar 18 22:49:11 2014 @@ -84,6 +84,34 @@ } int +delrunepos(Window *w) +{ + int n; + Rune rune; + + for(n=0; ntag.file->nc; n++) { + bufread(w->tag.file, n, &rune, 1); + if(rune == ' ') + break; + } + n += 2; + if(n >= w->tag.file->nc) + return -1; + return n; +} + +void +movetodel(Window *w) +{ + int n; + + n = delrunepos(w); + if(n < 0) + return; + moveto(mousectl, addpt(frptofchar(&w->tag, n), Pt(4, w->tag.font->height-4))); +} + +int winresize(Window *w, Rectangle r, int safe) { Rectangle r1; --- /sys/src/cmd/db/main.c Thu Mar 21 18:25:56 2002 +++ /sys/src/cmd/db/main.c Tue Mar 18 22:17:13 2014 @@ -103,7 +103,7 @@ setsym(); dotmap = dumbmap(-1); if (name && machbyname(name) == 0) - dprint ("unknown machine %s", name); + dprint("unknown machine %s\n", name); dprint("%s binary\n", mach->name); if(setjmp(env) == 0){ if (corfil) { --- /sys/src/cmd/ip/dhcpd/dhcpd.c Fri Feb 28 20:49:18 2014 +++ /sys/src/cmd/ip/dhcpd/dhcpd.c Tue Mar 18 22:23:56 2014 @@ -409,13 +409,13 @@ /* * since we are single-threaded, this causes us to effectively - * stop listening for two seconds. + * stop listening while we sleep. */ static void slowdelay(Req *rp) { if(slowstat && rp->staticbinding || slowdyn && !rp->staticbinding) - sleep(2000); + sleep(1000); } void --- /sys/src/cmd/rx.c Sun Jul 22 03:06:10 2007 +++ /sys/src/cmd/rx.c Tue Mar 18 22:17:24 2014 @@ -24,6 +24,12 @@ exits("usage"); } +static int +catch(void *, char *s) +{ + return strstr(s, "alarm") != nil; +} + void main(int argc, char *argv[]) { @@ -58,6 +64,7 @@ usage(); host = argv[0]; args = buildargs(&argv[1]); + atnotify(catch, 1); /* try rexexec p9any then dial again with p9sk2 */ fd = call(0, host, "rexexec", &addr); @@ -97,10 +104,12 @@ rex(int fd, char *cmd, char *proto) { char buf[4096]; - int kid, n; + int kid, n, oalarm; AuthInfo *ai; + oalarm = alarm(2 * 60 * 1000); /* don't hang forever */ ai = auth_proxy(fd, auth_getkey, "proto=%s role=client %s", proto, key); + alarm(oalarm); if(ai == nil){ if(strcmp(proto, "p9any") == 0) return; --- /sys/src/cmd/venti/srv/arenas.c Wed Oct 15 20:15:24 2008 +++ /sys/src/cmd/venti/srv/arenas.c Tue Mar 18 22:18:51 2014 @@ -15,7 +15,8 @@ enum { - AHashSize = 512 + AHashSize = 512, + Emergency = 0, /* flag: performing emergency surgery */ }; static AHash *ahash[AHashSize]; @@ -142,8 +143,11 @@ ap->narenas = amn.n; ap->map = amn.map; if(okamap(ap->map, ap->narenas, ap->arenabase, ap->size, "arena table") < 0){ - freearenapart(ap, 0); - return nil; + if(!Emergency){ + freearenapart(ap, 0); + return nil; + } + /* else keep on, for emergency use */ } ap->arenas = MKNZ(Arena*, ap->narenas); @@ -152,8 +156,14 @@ ap->arenas[i] = initarena(part, ap->map[i].start, ap->map[i].stop - ap->map[i].start, ap->blocksize); if(ap->arenas[i] == nil){ seterr(ECorrupt, "%s: %r", ap->map[i].name); - freearenapart(ap, 1); - return nil; + if(!Emergency){ + freearenapart(ap, 1); + return nil; + }else{ + /* keep on, for emergency use */ + ap->narenas = i; + break; + } } if(namecmp(ap->map[i].name, ap->arenas[i]->name) != 0){ seterr(ECorrupt, "arena name mismatches with expected name: %s vs. %s",