Browse Source

Plan 9 from Bell Labs 2008-02-29

David du Colombier 16 years ago
parent
commit
5d57adfe00
61 changed files with 1519 additions and 811 deletions
  1. 65 64
      dist/replica/_plan9.db
  2. 65 65
      dist/replica/plan9.db
  3. 69 0
      dist/replica/plan9.log
  4. 2 2
      sys/include/ip.h
  5. 2 2
      sys/man/2/ip
  6. 7 1
      sys/src/9/alphapc/clock.c
  7. 1 0
      sys/src/9/alphapc/mkfile
  8. 805 0
      sys/src/9/alphapc/sd53c8xx.i
  9. 8 2
      sys/src/9/bitsy/clock.c
  10. 1 0
      sys/src/9/bitsy/dat.h
  11. 1 2
      sys/src/9/bitsy/fns.h
  12. 1 0
      sys/src/9/bitsy/mkfile
  13. 7 3
      sys/src/9/ip/arp.c
  14. 11 6
      sys/src/9/ip/devip.c
  15. 2 2
      sys/src/9/ip/ip.h
  16. 0 340
      sys/src/9/ip/ipaux.c
  17. 10 6
      sys/src/9/ip/ipifc.c
  18. 10 8
      sys/src/9/ip/iproute.c
  19. 2 1
      sys/src/9/ip/rudp.c
  20. 7 1
      sys/src/9/mtx/clock.c
  21. 1 0
      sys/src/9/mtx/mkfile
  22. 1 0
      sys/src/9/mtx/mtx
  23. 1 0
      sys/src/9/mtx/mtxcpu
  24. 1 1
      sys/src/9/pc/devarch.c
  25. 3 3
      sys/src/9/pc/devusb.c
  26. 7 1
      sys/src/9/pc/etherigbe.c
  27. 4 0
      sys/src/9/pc/mkfile
  28. 3 0
      sys/src/9/pc/pc
  29. 2 1
      sys/src/9/pc/pcauth
  30. 6 2
      sys/src/9/pc/pccpu
  31. 3 2
      sys/src/9/pc/pccpuf
  32. 3 0
      sys/src/9/pc/pcdisk
  33. 2 1
      sys/src/9/pc/pcf
  34. 26 19
      sys/src/9/pc/sdmv50xx.c
  35. 0 3
      sys/src/9/port/devbridge.c
  36. 13 0
      sys/src/9/port/devcons.c
  37. 69 69
      sys/src/9/port/edf.c
  38. 1 0
      sys/src/9/port/error.h
  39. 6 1
      sys/src/9/port/fault.c
  40. 1 1
      sys/src/9/port/portclock.c
  41. 5 3
      sys/src/9/port/portdat.h
  42. 4 2
      sys/src/9/port/portfns.h
  43. 17 12
      sys/src/9/port/taslock.c
  44. 30 28
      sys/src/9/port/tod.c
  45. 1 1
      sys/src/cmd/9nfs/server.c
  46. 11 13
      sys/src/cmd/aquarela/client.c
  47. 7 9
      sys/src/cmd/aquarela/nbresolve.c
  48. 39 3
      sys/src/cmd/fossil/9fsys.c
  49. 6 3
      sys/src/cmd/ip/6in4.c
  50. 2 1
      sys/src/cmd/ip/dhcpd/dhcpd.c
  51. 9 7
      sys/src/cmd/ip/dhcpd/dhcpleases.c
  52. 20 12
      sys/src/cmd/ip/ipconfig/main.c
  53. 4 2
      sys/src/cmd/ip/ppp/ppp.c
  54. 5 6
      sys/src/cmd/ip/pptpd.c
  55. 4 3
      sys/src/cmd/ndb/dnnotify.c
  56. 2 1
      sys/src/cmd/upas/smtp/smtpd.c
  57. 63 2
      sys/src/libip/classmask.c
  58. 0 77
      sys/src/libip/ip.h
  59. 1 1
      sys/src/libip/mkfile
  60. 55 15
      sys/src/libip/parseip.c
  61. 5 1
      sys/src/libndb/dnsquery.c

+ 65 - 64
dist/replica/_plan9.db

@@ -3,14 +3,14 @@
 386/9loaddebug - 775 sys sys 1199773344 452196
 386/9loadlite - 775 sys sys 1199773342 161880
 386/9loadlitedebug - 775 sys sys 1199773345 237979
-386/9pc - 775 sys sys 1202321022 2090361
-386/9pc.gz - 664 sys sys 1202321048 887501
-386/9pccpu - 775 sys sys 1202321091 2218905
-386/9pccpu.gz - 664 sys sys 1202321115 908814
-386/9pcdisk - 775 sys sys 1202321271 2293056
-386/9pcdisk.gz - 664 sys sys 1202321289 976280
-386/9pcf - 775 sys sys 1202321342 2962744
-386/9pcf.gz - 664 sys sys 1202321365 1260801
+386/9pc - 775 sys sys 1204234986 2108860
+386/9pc.gz - 664 sys sys 1204235000 902572
+386/9pccpu - 775 sys sys 1204235039 2235277
+386/9pccpu.gz - 664 sys sys 1204235053 916661
+386/9pcdisk - 775 sys sys 1204235093 2304320
+386/9pcdisk.gz - 664 sys sys 1204235109 979802
+386/9pcf - 775 sys sys 1204235159 2969900
+386/9pcf.gz - 664 sys sys 1204235180 1264093
 386/9pxeload - 775 sys sys 1199773341 338432
 386/bin - 20000000775 sys sys 1018897690 0
 386/bin/8a - 775 sys sys 1168402260 116604
@@ -6105,7 +6105,7 @@ sys/include/frame.h - 664 sys sys 1196212617 2708
 sys/include/geometry.h - 664 sys sys 1014929063 2632
 sys/include/html.h - 664 sys sys 1184472600 15622
 sys/include/httpd.h - 664 sys sys 1190835025 5800
-sys/include/ip.h - 664 sys sys 1198184776 4401
+sys/include/ip.h - 664 sys sys 1204230308 4401
 sys/include/keyboard.h - 664 sys sys 1131637696 865
 sys/include/libc.h - 664 sys sys 1168306860 19851
 sys/include/libsec.h - 664 sys sys 1188328413 8684
@@ -7597,7 +7597,7 @@ sys/man/2/hypot - 664 sys sys 1196638938 302
 sys/man/2/intmap - 664 sys sys 1196638940 2622
 sys/man/2/ioproc - 664 sys sys 1196638940 3060
 sys/man/2/iounit - 664 sys sys 1196638940 1001
-sys/man/2/ip - 664 sys sys 1203659619 7257
+sys/man/2/ip - 664 sys sys 1204227918 7257
 sys/man/2/isalpharune - 664 sys sys 1196638940 1059
 sys/man/2/keyboard - 664 sys sys 1196638940 2065
 sys/man/2/lock - 664 sys sys 1196638938 5705
@@ -7916,7 +7916,7 @@ sys/src/9/alphapc/arch164.c - 664 sys sys 1173386682 6082
 sys/src/9/alphapc/audio.h - 664 sys sys 1015012783 349
 sys/src/9/alphapc/axp.h - 664 sys sys 1015012783 1090
 sys/src/9/alphapc/cga.c - 664 sys sys 1015012783 1814
-sys/src/9/alphapc/clock.c - 664 sys sys 1032052963 1472
+sys/src/9/alphapc/clock.c - 664 sys sys 1204233074 1527
 sys/src/9/alphapc/cycintr.c - 664 sys sys 1018721238 230
 sys/src/9/alphapc/dat.h - 664 sys sys 1169491873 5217
 sys/src/9/alphapc/devarch.c - 664 sys sys 1039753422 9760
@@ -7937,20 +7937,21 @@ sys/src/9/alphapc/main.c - 664 sys sys 1173386681 13753
 sys/src/9/alphapc/mem.h - 664 sys sys 1137179967 2312
 sys/src/9/alphapc/memmove.s - 664 sys sys 1015012786 2936
 sys/src/9/alphapc/memset.s - 664 sys sys 1015012786 844
-sys/src/9/alphapc/mkfile - 664 sys sys 1173412020 1973
+sys/src/9/alphapc/mkfile - 664 sys sys 1204233063 1997
 sys/src/9/alphapc/mmu.c - 664 sys sys 1173788325 5218
 sys/src/9/alphapc/osf1pal.h - 664 sys sys 1137179966 1471
 sys/src/9/alphapc/pci.c - 664 sys sys 1039753420 7868
 sys/src/9/alphapc/screen.h - 664 sys sys 1147108286 3923
 sys/src/9/alphapc/sd53c8xx.c - 664 sys sys 1137179967 55257
+sys/src/9/alphapc/sd53c8xx.i - 664 sys sys 1204233026 28453
 sys/src/9/alphapc/sio.c - 664 sys sys 1015012787 293
 sys/src/9/alphapc/trap.c - 664 sys sys 1105030177 18099
 sys/src/9/bitsy - 20000000775 sys sys 1138505096 0
 sys/src/9/bitsy/Booting101 - 664 sys sys 1054798506 8841
 sys/src/9/bitsy/bitsy - 664 sys sys 1188582377 420
 sys/src/9/bitsy/bitsyreset.s - 664 sys sys 1017695510 2352
-sys/src/9/bitsy/clock.c - 664 sys sys 1037028998 4835
-sys/src/9/bitsy/dat.h - 664 sys sys 1143129783 5829
+sys/src/9/bitsy/clock.c - 664 sys sys 1204232953 4890
+sys/src/9/bitsy/dat.h - 664 sys sys 1204232953 5849
 sys/src/9/bitsy/defont.c - 664 sys sys 1017695511 21570
 sys/src/9/bitsy/devether.c - 664 sys sys 1178548255 10676
 sys/src/9/bitsy/devflash.c - 664 sys sys 1138500612 16830
@@ -7960,7 +7961,7 @@ sys/src/9/bitsy/devuda1341.c - 664 sys sys 1071245420 30346
 sys/src/9/bitsy/devµc.c - 664 sys sys 1068393562 8125
 sys/src/9/bitsy/etherif.h - 664 sys sys 1045501788 913
 sys/src/9/bitsy/etherwavelan.c - 664 sys sys 1071245513 870
-sys/src/9/bitsy/fns.h - 664 sys sys 1171761416 3086
+sys/src/9/bitsy/fns.h - 664 sys sys 1204232952 3082
 sys/src/9/bitsy/fpi.c - 664 sys sys 1017695513 5248
 sys/src/9/bitsy/fpi.h - 664 sys sys 1017695513 1679
 sys/src/9/bitsy/fpiarm.c - 664 sys sys 1173788243 9402
@@ -7973,7 +7974,7 @@ sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
 sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
-sys/src/9/bitsy/mkfile - 664 sys sys 1173368204 2832
+sys/src/9/bitsy/mkfile - 664 sys sys 1204232952 2856
 sys/src/9/bitsy/mmu.c - 664 sys sys 1171761416 11656
 sys/src/9/bitsy/mouse.c - 664 sys sys 1017695516 962
 sys/src/9/bitsy/paqfiles - 20000000775 sys sys 1039727524 0
@@ -8017,9 +8018,9 @@ sys/src/9/boot/sac.c - 664 sys sys 1184466374 815
 sys/src/9/boot/settime.c - 664 sys sys 1036813626 2473
 sys/src/9/boot/testboot.c - 664 sys sys 1039763734 496
 sys/src/9/ip - 20000000775 sys sys 1119710004 0
-sys/src/9/ip/arp.c - 664 sys sys 1184794688 11234
+sys/src/9/ip/arp.c - 664 sys sys 1204180133 11321
 sys/src/9/ip/chandial.c - 664 sys sys 1099020048 2295
-sys/src/9/ip/devip.c - 664 sys sys 1161061185 24242
+sys/src/9/ip/devip.c - 664 sys sys 1204180143 24398
 sys/src/9/ip/eipconvtest.c - 664 sys sys 1022588098 3135
 sys/src/9/ip/esp.c - 664 sys sys 1187064283 19158
 sys/src/9/ip/ethermedium.c - 664 sys sys 1187735942 15427
@@ -8029,11 +8030,11 @@ sys/src/9/ip/icmp6.c - 664 sys sys 1187036525 18131
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
 sys/src/9/ip/ip.c - 664 sys sys 1187735970 14553
-sys/src/9/ip/ip.h - 664 sys sys 1188581813 16639
-sys/src/9/ip/ipaux.c - 664 sys sys 1185486678 12341
-sys/src/9/ip/ipifc.c - 664 sys sys 1184794851 34006
+sys/src/9/ip/ip.h - 664 sys sys 1204231127 16639
+sys/src/9/ip/ipaux.c - 664 sys sys 1204231128 6250
+sys/src/9/ip/ipifc.c - 664 sys sys 1204180081 34151
 sys/src/9/ip/ipmux.c - 664 sys sys 1187047550 14991
-sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
+sys/src/9/ip/iproute.c - 664 sys sys 1204240365 14880
 sys/src/9/ip/ipv6.c - 664 sys sys 1189625381 14192
 sys/src/9/ip/ipv6.h - 664 sys sys 1189625361 4518
 sys/src/9/ip/loopbackmedium.c - 664 sys sys 1055701769 1671
@@ -8042,13 +8043,13 @@ sys/src/9/ip/netlog.c - 664 sys sys 1188581818 3953
 sys/src/9/ip/nullmedium.c - 664 sys sys 1086406910 492
 sys/src/9/ip/pktmedium.c - 664 sys sys 1084331746 1314
 sys/src/9/ip/ptclbsum.c - 664 sys sys 1022588099 1243
-sys/src/9/ip/rudp.c - 664 sys sys 1203554193 20806
+sys/src/9/ip/rudp.c - 664 sys sys 1204231129 20834
 sys/src/9/ip/tcp.c - 664 sys sys 1203551505 66252
 sys/src/9/ip/tripmedium.c - 664 sys sys 1045063515 7136
 sys/src/9/ip/udp.c - 664 sys sys 1187735914 13315
 sys/src/9/mkfile - 664 sys sys 1063857477 205
 sys/src/9/mtx - 20000000775 sys sys 1123676466 0
-sys/src/9/mtx/clock.c - 664 sys sys 1032053278 1293
+sys/src/9/mtx/clock.c - 664 sys sys 1204232769 1344
 sys/src/9/mtx/cycintr.c - 664 sys sys 1018721285 230
 sys/src/9/mtx/dat.h - 664 sys sys 1169491926 3825
 sys/src/9/mtx/devarch.c - 664 sys sys 1018721285 6793
@@ -8065,10 +8066,10 @@ sys/src/9/mtx/kbd.c - 664 sys sys 1018721286 8358
 sys/src/9/mtx/l.s - 664 sys sys 1143129840 11000
 sys/src/9/mtx/main.c - 664 sys sys 1131289814 8307
 sys/src/9/mtx/mem.h - 664 sys sys 1026848200 5959
-sys/src/9/mtx/mkfile - 664 sys sys 1173788325 1612
+sys/src/9/mtx/mkfile - 664 sys sys 1204232769 1636
 sys/src/9/mtx/mmu.c - 664 sys sys 1173788325 4695
-sys/src/9/mtx/mtx - 664 sys sys 1188582377 408
-sys/src/9/mtx/mtxcpu - 664 sys sys 1188582378 413
+sys/src/9/mtx/mtx - 664 sys sys 1188514183 413
+sys/src/9/mtx/mtxcpu - 664 sys sys 1188514195 418
 sys/src/9/mtx/pci.c - 664 sys sys 1087657434 16662
 sys/src/9/mtx/random.c - 664 sys sys 1036813598 1983
 sys/src/9/mtx/raven.c - 664 sys sys 1018721288 2587
@@ -8086,7 +8087,7 @@ sys/src/9/pc/audio.h - 664 sys sys 1015014513 343
 sys/src/9/pc/bios32.c - 664 sys sys 1173287378 3029
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/dat.h - 664 sys sys 1190268296 7549
-sys/src/9/pc/devarch.c - 664 sys sys 1194556823 19867
+sys/src/9/pc/devarch.c - 664 sys sys 1194555741 19865
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
@@ -8098,7 +8099,7 @@ sys/src/9/pc/devlpt.c - 664 sys sys 1184469951 4423
 sys/src/9/pc/devpccard.c - 664 sys sys 1184469910 39336
 sys/src/9/pc/devrtc.c - 664 sys sys 1015014515 7167
 sys/src/9/pc/devtv.c - 664 sys sys 1184469620 45423
-sys/src/9/pc/devusb.c - 664 sys sys 1202856294 20831
+sys/src/9/pc/devusb.c - 664 sys sys 1204179902 20831
 sys/src/9/pc/devvga.c - 664 sys sys 1181083003 9334
 sys/src/9/pc/dma.c - 664 sys sys 1142966373 5332
 sys/src/9/pc/ether2000.c - 664 sys sys 1173287379 4901
@@ -8121,7 +8122,7 @@ sys/src/9/pc/etherelnk3.c - 664 sys sys 1158012427 48807
 sys/src/9/pc/etherga620.c - 664 sys sys 1185652495 29895
 sys/src/9/pc/etherga620fw.h - 664 sys sys 1026847642 222295
 sys/src/9/pc/etherif.h - 664 sys sys 1088178711 961
-sys/src/9/pc/etherigbe.c - 664 sys sys 1201822310 45935
+sys/src/9/pc/etherigbe.c - 664 sys sys 1204240380 46146
 sys/src/9/pc/etherm10g.c - 664 sys sys 1202453395 28413
 sys/src/9/pc/etherm10g2k.i - 664 sys sys 1202131465 1094881
 sys/src/9/pc/etherm10g4k.i - 664 sys sys 1202131484 1065187
@@ -8145,19 +8146,19 @@ sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
 sys/src/9/pc/memory.c - 664 sys sys 1196193039 18878
-sys/src/9/pc/mkfile - 664 sys sys 1191885521 4025
+sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
 sys/src/9/pc/mmu.c - 664 sys sys 1171688128 24591
 sys/src/9/pc/mouse.c - 664 sys sys 1203981356 7190
 sys/src/9/pc/mp.c - 664 sys sys 1162388126 17349
 sys/src/9/pc/mp.h - 664 sys sys 1173288116 6799
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
-sys/src/9/pc/pc - 664 sys sys 1191885434 1520
-sys/src/9/pc/pcauth - 664 sys sys 1179696163 724
+sys/src/9/pc/pc - 664 sys sys 1204231598 1551
+sys/src/9/pc/pcauth - 664 sys sys 1204231648 767
 sys/src/9/pc/pccd - 664 sys sys 1191885773 1514
-sys/src/9/pc/pccpu - 664 sys sys 1191885782 1029
-sys/src/9/pc/pccpuf - 664 sys sys 1191885786 1607
-sys/src/9/pc/pcdisk - 664 sys sys 1191886075 1566
-sys/src/9/pc/pcf - 664 sys sys 1191885750 1603
+sys/src/9/pc/pccpu - 664 sys sys 1204231753 1059
+sys/src/9/pc/pccpuf - 664 sys sys 1204231783 1686
+sys/src/9/pc/pcdisk - 664 sys sys 1204231795 1623
+sys/src/9/pc/pcf - 664 sys sys 1204231808 1669
 sys/src/9/pc/pcfl - 664 sys sys 1188582378 1579
 sys/src/9/pc/pcflop - 664 sys sys 1190853787 1540
 sys/src/9/pc/pci.c - 664 sys sys 1196312222 29483
@@ -8177,7 +8178,7 @@ sys/src/9/pc/sd53c8xx.i - 664 sys sys 1128547230 28453
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1202251523 53036
 sys/src/9/pc/sdiahci.c - 664 sys sys 1200348596 38496
-sys/src/9/pc/sdmv50xx.c - 664 sys sys 1199910989 33838
+sys/src/9/pc/sdmv50xx.c - 664 sys sys 1204232564 34031
 sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
 sys/src/9/pc/sdscsi.c - 664 sys sys 1186618532 7957
 sys/src/9/pc/trap.c - 664 sys sys 1197062171 21897
@@ -8229,9 +8230,9 @@ sys/src/9/port/debugalloc.c - 664 sys sys 1014931171 10402
 sys/src/9/port/dev.c - 664 sys sys 1146151714 8177
 sys/src/9/port/devaoe.c - 664 sys sys 1199910511 42083
 sys/src/9/port/devaudio.c - 664 sys sys 1170456648 21199
-sys/src/9/port/devbridge.c - 664 sys sys 1187735844 24076
+sys/src/9/port/devbridge.c - 664 sys sys 1204227718 24003
 sys/src/9/port/devcap.c - 664 sys sys 1178886040 4141
-sys/src/9/port/devcons.c - 664 sys sys 1176658321 22943
+sys/src/9/port/devcons.c - 664 sys sys 1204228551 23192
 sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
 sys/src/9/port/devdup.c - 664 sys sys 1196185172 2327
 sys/src/9/port/devenv.c - 664 sys sys 1169498893 7015
@@ -8255,10 +8256,10 @@ sys/src/9/port/devtinyfs.c - 664 sys sys 1015278339 15347
 sys/src/9/port/devtls.c - 664 sys sys 1146151715 45214
 sys/src/9/port/devuart.c - 664 sys sys 1170456620 12262
 sys/src/9/port/devwd.c - 664 sys sys 1126582325 2342
-sys/src/9/port/edf.c - 664 sys sys 1138472540 13489
+sys/src/9/port/edf.c - 664 sys sys 1204230576 13592
 sys/src/9/port/edf.h - 664 sys sys 1138469072 1195
-sys/src/9/port/error.h - 664 sys sys 1117055493 2637
-sys/src/9/port/fault.c - 664 sys sys 1138459838 7265
+sys/src/9/port/error.h - 664 sys sys 1204179766 2688
+sys/src/9/port/fault.c - 664 sys sys 1204230735 7409
 sys/src/9/port/initcode.c - 664 sys sys 1055688491 574
 sys/src/9/port/latin1.c - 664 sys sys 1015278339 1418
 sys/src/9/port/latin1.h - 664 sys sys 1184794985 3575
@@ -8283,9 +8284,9 @@ sys/src/9/port/netif.h - 664 sys sys 1187735815 3059
 sys/src/9/port/page.c - 664 sys sys 1131636090 11128
 sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
-sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
-sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
-sys/src/9/port/portfns.h - 664 sys sys 1202939287 11060
+sys/src/9/port/portclock.c - 664 sys sys 1204230761 4274
+sys/src/9/port/portdat.h - 664 sys sys 1204229767 22759
+sys/src/9/port/portfns.h - 664 sys sys 1202935714 11095
 sys/src/9/port/portmkfile - 664 sys sys 1184737233 2082
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1176658321 28742
@@ -8301,10 +8302,10 @@ sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1188922869 22120
 sys/src/9/port/sysproc.c - 664 sys sys 1188922870 21419
 sys/src/9/port/systab.h - 664 sys sys 1161222889 3204
-sys/src/9/port/taslock.c - 664 sys sys 1177343190 4418
+sys/src/9/port/taslock.c - 664 sys sys 1204229744 4590
 sys/src/9/port/thwack.c - 664 sys sys 1057323394 7253
 sys/src/9/port/thwack.h - 664 sys sys 1015278340 1792
-sys/src/9/port/tod.c - 664 sys sys 1146746630 5377
+sys/src/9/port/tod.c - 664 sys sys 1204228653 5445
 sys/src/9/port/unthwack.c - 664 sys sys 1057323394 5249
 sys/src/9/port/xalloc.c - 664 sys sys 1169491770 4289
 sys/src/9/ppc - 20000000775 sys sys 1123676466 0
@@ -9452,7 +9453,7 @@ sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1146061148 4068
 sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1191523856 3306
 sys/src/cmd/9nfs/rpc.c - 664 sys sys 1191523822 5647
 sys/src/cmd/9nfs/rpc.h - 664 sys sys 1017337815 1996
-sys/src/cmd/9nfs/server.c - 664 sys sys 1191523839 11320
+sys/src/cmd/9nfs/server.c - 664 sys sys 1204179116 11319
 sys/src/cmd/9nfs/string.c - 664 sys sys 1017337815 1659
 sys/src/cmd/9nfs/strparse.c - 664 sys sys 1015090373 506
 sys/src/cmd/9nfs/system.c - 664 sys sys 1017337815 437
@@ -9506,7 +9507,7 @@ sys/src/cmd/aquarela/alarm.c - 664 sys sys 1197673331 2170
 sys/src/cmd/aquarela/alloc.c - 664 sys sys 1135892108 245
 sys/src/cmd/aquarela/aquarela.c - 664 sys sys 1198159137 7017
 sys/src/cmd/aquarela/cifscmd.c - 664 sys sys 1135892108 4430
-sys/src/cmd/aquarela/client.c - 664 sys sys 1135892108 2724
+sys/src/cmd/aquarela/client.c - 664 sys sys 1204179312 2787
 sys/src/cmd/aquarela/dump.c - 664 sys sys 1135892108 2864
 sys/src/cmd/aquarela/findname.c - 664 sys sys 1135892108 1351
 sys/src/cmd/aquarela/headers.h - 664 sys sys 1135892108 185
@@ -9520,7 +9521,7 @@ sys/src/cmd/aquarela/nblistener.c - 664 sys sys 1189049390 687
 sys/src/cmd/aquarela/nbname.c - 664 sys sys 1135892109 5457
 sys/src/cmd/aquarela/nbns.c - 664 sys sys 1135892109 2747
 sys/src/cmd/aquarela/nbnsconv.c - 664 sys sys 1135892109 6257
-sys/src/cmd/aquarela/nbresolve.c - 664 sys sys 1135892109 672
+sys/src/cmd/aquarela/nbresolve.c - 664 sys sys 1204179312 646
 sys/src/cmd/aquarela/nbss.c - 664 sys sys 1135892110 8126
 sys/src/cmd/aquarela/netbios.h - 664 sys sys 1135892110 5967
 sys/src/cmd/aquarela/smb.h - 664 sys sys 1135892110 9492
@@ -10401,7 +10402,7 @@ sys/src/cmd/fossil/9auth.c - 664 sys sys 1189552651 3972
 sys/src/cmd/fossil/9dir.c - 664 sys sys 1085333382 2219
 sys/src/cmd/fossil/9excl.c - 664 sys sys 1042005502 1887
 sys/src/cmd/fossil/9fid.c - 664 sys sys 1189110070 5584
-sys/src/cmd/fossil/9fsys.c - 664 sys sys 1194215521 33624
+sys/src/cmd/fossil/9fsys.c - 664 sys sys 1204179530 34157
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1147355153 3038
 sys/src/cmd/fossil/9p.c - 664 sys sys 1189110070 22957
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
@@ -12469,15 +12470,15 @@ sys/src/cmd/iostats/mkfile - 664 sys sys 1014925727 122
 sys/src/cmd/iostats/statfs.h - 664 sys sys 1140099908 2626
 sys/src/cmd/iostats/statsrv.c - 664 sys sys 1166824341 10773
 sys/src/cmd/ip - 20000000775 sys sys 1128605981 0
-sys/src/cmd/ip/6in4.c - 664 sys sys 1198185057 9743
+sys/src/cmd/ip/6in4.c - 664 sys sys 1204179741 9920
 sys/src/cmd/ip/arp.h - 664 sys sys 944961005 751
 sys/src/cmd/ip/dhcp.h - 664 sys sys 1184696111 3764
 sys/src/cmd/ip/dhcpclient.c - 664 sys sys 1178482836 11969
 sys/src/cmd/ip/dhcpd - 20000000775 sys sys 1063897571 0
 sys/src/cmd/ip/dhcpd/dat.h - 664 sys sys 1084471353 2522
 sys/src/cmd/ip/dhcpd/db.c - 664 sys sys 1143670612 7466
-sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1185922538 35209
-sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1032655001 779
+sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1204179700 35269
+sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1204179691 796
 sys/src/cmd/ip/dhcpd/mkfile - 664 sys sys 1169162185 443
 sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1185920230 5799
 sys/src/cmd/ip/dhcpd/ping.c - 664 sys sys 1198186463 1225
@@ -12542,7 +12543,7 @@ sys/src/cmd/ip/imap4d/utils.c - 664 sys sys 1168894057 2587
 sys/src/cmd/ip/ipconfig - 20000000775 sys sys 1176933436 0
 sys/src/cmd/ip/ipconfig/ipconfig.h - 664 sys sys 1198189129 5311
 sys/src/cmd/ip/ipconfig/ipv6.c - 664 sys sys 1198189135 20619
-sys/src/cmd/ip/ipconfig/main.c - 664 sys sys 1185923495 39912
+sys/src/cmd/ip/ipconfig/main.c - 664 sys sys 1204178443 40237
 sys/src/cmd/ip/ipconfig/mkfile - 664 sys sys 1184880750 233
 sys/src/cmd/ip/ipconfig/ppp.c - 664 sys sys 1184880751 1046
 sys/src/cmd/ip/linklocal.c - 664 sys sys 1197673397 1751
@@ -12558,7 +12559,7 @@ sys/src/cmd/ip/ppp/dotest - 775 sys sys 944961006 152
 sys/src/cmd/ip/ppp/ipaux.c - 664 sys sys 1125529107 2328
 sys/src/cmd/ip/ppp/mkfile - 664 sys sys 1063897576 352
 sys/src/cmd/ip/ppp/mppc.c - 664 sys sys 1015090267 16624
-sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1194215466 59955
+sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1204179668 60052
 sys/src/cmd/ip/ppp/ppp.h - 664 sys sys 1091904423 8284
 sys/src/cmd/ip/ppp/testppp.c - 664 sys sys 1045505281 3011
 sys/src/cmd/ip/ppp/thw.c - 664 sys sys 1015090268 5962
@@ -12830,7 +12831,7 @@ sys/src/cmd/ndb/csquery.c - 664 sys sys 1174626119 1073
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1201927753 25262
 sys/src/cmd/ndb/dn.c - 664 sys sys 1203748557 37967
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1175664421 2519
-sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1203748558 3052
+sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1204179585 3112
 sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1203748559 35408
 sys/src/cmd/ndb/dns.c - 664 sys sys 1203745528 17970
 sys/src/cmd/ndb/dns.h - 664 sys sys 1202761152 11969
@@ -14252,7 +14253,7 @@ sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1188509396 1075
 sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1188509396 20717
 sys/src/cmd/upas/smtp/smtp.h - 664 sys sys 1188509396 1356
-sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1203645213 33362
+sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1204179355 33414
 sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1201499389 1134
 sys/src/cmd/upas/smtp/smtpd.y - 664 sys sys 1181508390 6924
 sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1139699502 10238
@@ -15375,16 +15376,15 @@ sys/src/libhttpd/urlfmt.c - 664 sys sys 1014930785 425
 sys/src/libhttpd/urlunesc.c - 664 sys sys 1014930785 995
 sys/src/libip - 20000000775 sys sys 1066515138 0
 sys/src/libip/bo.c - 664 sys sys 1089213099 811
-sys/src/libip/classmask.c - 664 sys sys 944961726 622
+sys/src/libip/classmask.c - 664 sys sys 1204178762 1909
 sys/src/libip/eipfmt.c - 664 sys sys 1116097626 2188
 sys/src/libip/equivip.c - 664 sys sys 1103554773 285
-sys/src/libip/ip.h - 664 sys sys 944961727 1438
 sys/src/libip/ipaux.c - 664 sys sys 985038059 1515
-sys/src/libip/mkfile - 664 sys sys 1065576347 320
+sys/src/libip/mkfile - 664 sys sys 1204228221 333
 sys/src/libip/myetheraddr.c - 664 sys sys 1178597962 382
 sys/src/libip/myipaddr.c - 664 sys sys 1069766545 841
 sys/src/libip/parseether.c - 664 sys sys 944961726 318
-sys/src/libip/parseip.c - 664 sys sys 1169595542 2429
+sys/src/libip/parseip.c - 664 sys sys 1204228369 3520
 sys/src/libip/ptclbsum.c - 664 sys sys 1132452948 1160
 sys/src/libip/readipifc.c - 664 sys sys 1201723612 4396
 sys/src/libip/testreadipifc.c - 664 sys sys 1021580003 400
@@ -15559,7 +15559,7 @@ sys/src/libmp/test.c - 664 sys sys 964798440 12260
 sys/src/libndb - 20000000775 sys sys 1078618600 0
 sys/src/libndb/csgetval.c - 664 sys sys 1144174488 1796
 sys/src/libndb/csipinfo.c - 664 sys sys 1144174488 1178
-sys/src/libndb/dnsquery.c - 664 sys sys 1144174488 2883
+sys/src/libndb/dnsquery.c - 664 sys sys 1204228421 2977
 sys/src/libndb/ipattr.c - 664 sys sys 953844690 586
 sys/src/libndb/mkfile - 664 sys sys 1078618596 513
 sys/src/libndb/ndbaux.c - 664 sys sys 1144174488 1544
@@ -15870,3 +15870,4 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
+sys/src/cmd/ip/pptpd.c - 664 sys sys 1204259451 23509

+ 65 - 65
dist/replica/plan9.db

@@ -3,14 +3,14 @@
 386/9loaddebug - 775 sys sys 1199773344 452196
 386/9loadlite - 775 sys sys 1199773342 161880
 386/9loadlitedebug - 775 sys sys 1199773345 237979
-386/9pc - 775 sys sys 1202321022 2090361
-386/9pc.gz - 664 sys sys 1202321048 887501
-386/9pccpu - 775 sys sys 1202321091 2218905
-386/9pccpu.gz - 664 sys sys 1202321115 908814
-386/9pcdisk - 775 sys sys 1202321271 2293056
-386/9pcdisk.gz - 664 sys sys 1202321289 976280
-386/9pcf - 775 sys sys 1202321342 2962744
-386/9pcf.gz - 664 sys sys 1202321365 1260801
+386/9pc - 775 sys sys 1204234986 2108860
+386/9pc.gz - 664 sys sys 1204235000 902572
+386/9pccpu - 775 sys sys 1204235039 2235277
+386/9pccpu.gz - 664 sys sys 1204235053 916661
+386/9pcdisk - 775 sys sys 1204235093 2304320
+386/9pcdisk.gz - 664 sys sys 1204235109 979802
+386/9pcf - 775 sys sys 1204235159 2969900
+386/9pcf.gz - 664 sys sys 1204235180 1264093
 386/9pxeload - 775 sys sys 1199773341 338432
 386/bin - 20000000775 sys sys 1018897690 0
 386/bin/8a - 775 sys sys 1168402260 116604
@@ -6105,7 +6105,7 @@ sys/include/frame.h - 664 sys sys 1196212617 2708
 sys/include/geometry.h - 664 sys sys 1014929063 2632
 sys/include/html.h - 664 sys sys 1184472600 15622
 sys/include/httpd.h - 664 sys sys 1190835025 5800
-sys/include/ip.h - 664 sys sys 1198184776 4401
+sys/include/ip.h - 664 sys sys 1204230308 4401
 sys/include/keyboard.h - 664 sys sys 1131637696 865
 sys/include/libc.h - 664 sys sys 1168306860 19851
 sys/include/libsec.h - 664 sys sys 1188328413 8684
@@ -7597,7 +7597,7 @@ sys/man/2/hypot - 664 sys sys 1196638938 302
 sys/man/2/intmap - 664 sys sys 1196638940 2622
 sys/man/2/ioproc - 664 sys sys 1196638940 3060
 sys/man/2/iounit - 664 sys sys 1196638940 1001
-sys/man/2/ip - 664 sys sys 1203659619 7257
+sys/man/2/ip - 664 sys sys 1204227918 7257
 sys/man/2/isalpharune - 664 sys sys 1196638940 1059
 sys/man/2/keyboard - 664 sys sys 1196638940 2065
 sys/man/2/lock - 664 sys sys 1196638938 5705
@@ -7916,7 +7916,7 @@ sys/src/9/alphapc/arch164.c - 664 sys sys 1173386682 6082
 sys/src/9/alphapc/audio.h - 664 sys sys 1015012783 349
 sys/src/9/alphapc/axp.h - 664 sys sys 1015012783 1090
 sys/src/9/alphapc/cga.c - 664 sys sys 1015012783 1814
-sys/src/9/alphapc/clock.c - 664 sys sys 1032052963 1472
+sys/src/9/alphapc/clock.c - 664 sys sys 1204233074 1527
 sys/src/9/alphapc/cycintr.c - 664 sys sys 1018721238 230
 sys/src/9/alphapc/dat.h - 664 sys sys 1169491873 5217
 sys/src/9/alphapc/devarch.c - 664 sys sys 1039753422 9760
@@ -7937,20 +7937,21 @@ sys/src/9/alphapc/main.c - 664 sys sys 1173386681 13753
 sys/src/9/alphapc/mem.h - 664 sys sys 1137179967 2312
 sys/src/9/alphapc/memmove.s - 664 sys sys 1015012786 2936
 sys/src/9/alphapc/memset.s - 664 sys sys 1015012786 844
-sys/src/9/alphapc/mkfile - 664 sys sys 1173412020 1973
+sys/src/9/alphapc/mkfile - 664 sys sys 1204233063 1997
 sys/src/9/alphapc/mmu.c - 664 sys sys 1173788325 5218
 sys/src/9/alphapc/osf1pal.h - 664 sys sys 1137179966 1471
 sys/src/9/alphapc/pci.c - 664 sys sys 1039753420 7868
 sys/src/9/alphapc/screen.h - 664 sys sys 1147108286 3923
 sys/src/9/alphapc/sd53c8xx.c - 664 sys sys 1137179967 55257
+sys/src/9/alphapc/sd53c8xx.i - 664 sys sys 1204233026 28453
 sys/src/9/alphapc/sio.c - 664 sys sys 1015012787 293
 sys/src/9/alphapc/trap.c - 664 sys sys 1105030177 18099
 sys/src/9/bitsy - 20000000775 sys sys 1138505096 0
 sys/src/9/bitsy/Booting101 - 664 sys sys 1054798506 8841
 sys/src/9/bitsy/bitsy - 664 sys sys 1188582377 420
 sys/src/9/bitsy/bitsyreset.s - 664 sys sys 1017695510 2352
-sys/src/9/bitsy/clock.c - 664 sys sys 1037028998 4835
-sys/src/9/bitsy/dat.h - 664 sys sys 1143129783 5829
+sys/src/9/bitsy/clock.c - 664 sys sys 1204232953 4890
+sys/src/9/bitsy/dat.h - 664 sys sys 1204232953 5849
 sys/src/9/bitsy/defont.c - 664 sys sys 1017695511 21570
 sys/src/9/bitsy/devether.c - 664 sys sys 1178548255 10676
 sys/src/9/bitsy/devflash.c - 664 sys sys 1138500612 16830
@@ -7960,7 +7961,7 @@ sys/src/9/bitsy/devuda1341.c - 664 sys sys 1071245420 30346
 sys/src/9/bitsy/devµc.c - 664 sys sys 1068393562 8125
 sys/src/9/bitsy/etherif.h - 664 sys sys 1045501788 913
 sys/src/9/bitsy/etherwavelan.c - 664 sys sys 1071245513 870
-sys/src/9/bitsy/fns.h - 664 sys sys 1171761416 3086
+sys/src/9/bitsy/fns.h - 664 sys sys 1204232952 3082
 sys/src/9/bitsy/fpi.c - 664 sys sys 1017695513 5248
 sys/src/9/bitsy/fpi.h - 664 sys sys 1017695513 1679
 sys/src/9/bitsy/fpiarm.c - 664 sys sys 1173788243 9402
@@ -7973,7 +7974,7 @@ sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
 sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
-sys/src/9/bitsy/mkfile - 664 sys sys 1173368204 2832
+sys/src/9/bitsy/mkfile - 664 sys sys 1204232952 2856
 sys/src/9/bitsy/mmu.c - 664 sys sys 1171761416 11656
 sys/src/9/bitsy/mouse.c - 664 sys sys 1017695516 962
 sys/src/9/bitsy/paqfiles - 20000000775 sys sys 1039727524 0
@@ -8017,9 +8018,9 @@ sys/src/9/boot/sac.c - 664 sys sys 1184466374 815
 sys/src/9/boot/settime.c - 664 sys sys 1036813626 2473
 sys/src/9/boot/testboot.c - 664 sys sys 1039763734 496
 sys/src/9/ip - 20000000775 sys sys 1119710004 0
-sys/src/9/ip/arp.c - 664 sys sys 1184794688 11234
+sys/src/9/ip/arp.c - 664 sys sys 1204180133 11321
 sys/src/9/ip/chandial.c - 664 sys sys 1099020048 2295
-sys/src/9/ip/devip.c - 664 sys sys 1161061185 24242
+sys/src/9/ip/devip.c - 664 sys sys 1204180143 24398
 sys/src/9/ip/eipconvtest.c - 664 sys sys 1022588098 3135
 sys/src/9/ip/esp.c - 664 sys sys 1187064283 19158
 sys/src/9/ip/ethermedium.c - 664 sys sys 1187735942 15427
@@ -8029,11 +8030,11 @@ sys/src/9/ip/icmp6.c - 664 sys sys 1187036525 18131
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
 sys/src/9/ip/ip.c - 664 sys sys 1187735970 14553
-sys/src/9/ip/ip.h - 664 sys sys 1188581813 16639
-sys/src/9/ip/ipaux.c - 664 sys sys 1185486678 12341
-sys/src/9/ip/ipifc.c - 664 sys sys 1184794851 34006
+sys/src/9/ip/ip.h - 664 sys sys 1204231127 16639
+sys/src/9/ip/ipaux.c - 664 sys sys 1204231128 6250
+sys/src/9/ip/ipifc.c - 664 sys sys 1204180081 34151
 sys/src/9/ip/ipmux.c - 664 sys sys 1187047550 14991
-sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
+sys/src/9/ip/iproute.c - 664 sys sys 1204240365 14880
 sys/src/9/ip/ipv6.c - 664 sys sys 1189625381 14192
 sys/src/9/ip/ipv6.h - 664 sys sys 1189625361 4518
 sys/src/9/ip/loopbackmedium.c - 664 sys sys 1055701769 1671
@@ -8042,13 +8043,13 @@ sys/src/9/ip/netlog.c - 664 sys sys 1188581818 3953
 sys/src/9/ip/nullmedium.c - 664 sys sys 1086406910 492
 sys/src/9/ip/pktmedium.c - 664 sys sys 1084331746 1314
 sys/src/9/ip/ptclbsum.c - 664 sys sys 1022588099 1243
-sys/src/9/ip/rudp.c - 664 sys sys 1203554193 20806
+sys/src/9/ip/rudp.c - 664 sys sys 1204231129 20834
 sys/src/9/ip/tcp.c - 664 sys sys 1203551505 66252
 sys/src/9/ip/tripmedium.c - 664 sys sys 1045063515 7136
 sys/src/9/ip/udp.c - 664 sys sys 1187735914 13315
 sys/src/9/mkfile - 664 sys sys 1063857477 205
 sys/src/9/mtx - 20000000775 sys sys 1123676466 0
-sys/src/9/mtx/clock.c - 664 sys sys 1032053278 1293
+sys/src/9/mtx/clock.c - 664 sys sys 1204232769 1344
 sys/src/9/mtx/cycintr.c - 664 sys sys 1018721285 230
 sys/src/9/mtx/dat.h - 664 sys sys 1169491926 3825
 sys/src/9/mtx/devarch.c - 664 sys sys 1018721285 6793
@@ -8065,10 +8066,10 @@ sys/src/9/mtx/kbd.c - 664 sys sys 1018721286 8358
 sys/src/9/mtx/l.s - 664 sys sys 1143129840 11000
 sys/src/9/mtx/main.c - 664 sys sys 1131289814 8307
 sys/src/9/mtx/mem.h - 664 sys sys 1026848200 5959
-sys/src/9/mtx/mkfile - 664 sys sys 1173788325 1612
+sys/src/9/mtx/mkfile - 664 sys sys 1204232769 1636
 sys/src/9/mtx/mmu.c - 664 sys sys 1173788325 4695
-sys/src/9/mtx/mtx - 664 sys sys 1188582377 408
-sys/src/9/mtx/mtxcpu - 664 sys sys 1188582378 413
+sys/src/9/mtx/mtx - 664 sys sys 1188514183 413
+sys/src/9/mtx/mtxcpu - 664 sys sys 1188514195 418
 sys/src/9/mtx/pci.c - 664 sys sys 1087657434 16662
 sys/src/9/mtx/random.c - 664 sys sys 1036813598 1983
 sys/src/9/mtx/raven.c - 664 sys sys 1018721288 2587
@@ -8086,7 +8087,7 @@ sys/src/9/pc/audio.h - 664 sys sys 1015014513 343
 sys/src/9/pc/bios32.c - 664 sys sys 1173287378 3029
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/dat.h - 664 sys sys 1190268296 7549
-sys/src/9/pc/devarch.c - 664 sys sys 1194556823 19867
+sys/src/9/pc/devarch.c - 664 sys sys 1194555741 19865
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
@@ -8098,7 +8099,7 @@ sys/src/9/pc/devlpt.c - 664 sys sys 1184469951 4423
 sys/src/9/pc/devpccard.c - 664 sys sys 1184469910 39336
 sys/src/9/pc/devrtc.c - 664 sys sys 1015014515 7167
 sys/src/9/pc/devtv.c - 664 sys sys 1184469620 45423
-sys/src/9/pc/devusb.c - 664 sys sys 1202856294 20831
+sys/src/9/pc/devusb.c - 664 sys sys 1204179902 20831
 sys/src/9/pc/devvga.c - 664 sys sys 1181083003 9334
 sys/src/9/pc/dma.c - 664 sys sys 1142966373 5332
 sys/src/9/pc/ether2000.c - 664 sys sys 1173287379 4901
@@ -8121,7 +8122,7 @@ sys/src/9/pc/etherelnk3.c - 664 sys sys 1158012427 48807
 sys/src/9/pc/etherga620.c - 664 sys sys 1185652495 29895
 sys/src/9/pc/etherga620fw.h - 664 sys sys 1026847642 222295
 sys/src/9/pc/etherif.h - 664 sys sys 1088178711 961
-sys/src/9/pc/etherigbe.c - 664 sys sys 1201822310 45935
+sys/src/9/pc/etherigbe.c - 664 sys sys 1204240380 46146
 sys/src/9/pc/etherm10g.c - 664 sys sys 1202453395 28413
 sys/src/9/pc/etherm10g2k.i - 664 sys sys 1202131465 1094881
 sys/src/9/pc/etherm10g4k.i - 664 sys sys 1202131484 1065187
@@ -8145,19 +8146,19 @@ sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
 sys/src/9/pc/memory.c - 664 sys sys 1196193039 18878
-sys/src/9/pc/mkfile - 664 sys sys 1191885521 4025
+sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
 sys/src/9/pc/mmu.c - 664 sys sys 1171688128 24591
 sys/src/9/pc/mouse.c - 664 sys sys 1203981356 7190
 sys/src/9/pc/mp.c - 664 sys sys 1162388126 17349
 sys/src/9/pc/mp.h - 664 sys sys 1173288116 6799
 sys/src/9/pc/nv_dma.h - 664 sys sys 1081384508 12943
-sys/src/9/pc/pc - 664 sys sys 1191885434 1520
-sys/src/9/pc/pcauth - 664 sys sys 1179696163 724
+sys/src/9/pc/pc - 664 sys sys 1204231598 1551
+sys/src/9/pc/pcauth - 664 sys sys 1204231648 767
 sys/src/9/pc/pccd - 664 sys sys 1191885773 1514
-sys/src/9/pc/pccpu - 664 sys sys 1191885782 1029
-sys/src/9/pc/pccpuf - 664 sys sys 1191885786 1607
-sys/src/9/pc/pcdisk - 664 sys sys 1191886075 1566
-sys/src/9/pc/pcf - 664 sys sys 1191885750 1603
+sys/src/9/pc/pccpu - 664 sys sys 1204231753 1059
+sys/src/9/pc/pccpuf - 664 sys sys 1204231783 1686
+sys/src/9/pc/pcdisk - 664 sys sys 1204231795 1623
+sys/src/9/pc/pcf - 664 sys sys 1204231808 1669
 sys/src/9/pc/pcfl - 664 sys sys 1188582378 1579
 sys/src/9/pc/pcflop - 664 sys sys 1190853787 1540
 sys/src/9/pc/pci.c - 664 sys sys 1196312222 29483
@@ -8177,7 +8178,7 @@ sys/src/9/pc/sd53c8xx.i - 664 sys sys 1128547230 28453
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1202251523 53036
 sys/src/9/pc/sdiahci.c - 664 sys sys 1200348596 38496
-sys/src/9/pc/sdmv50xx.c - 664 sys sys 1199910989 33838
+sys/src/9/pc/sdmv50xx.c - 664 sys sys 1204232564 34031
 sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
 sys/src/9/pc/sdscsi.c - 664 sys sys 1186618532 7957
 sys/src/9/pc/trap.c - 664 sys sys 1197062171 21897
@@ -8229,9 +8230,9 @@ sys/src/9/port/debugalloc.c - 664 sys sys 1014931171 10402
 sys/src/9/port/dev.c - 664 sys sys 1146151714 8177
 sys/src/9/port/devaoe.c - 664 sys sys 1199910511 42083
 sys/src/9/port/devaudio.c - 664 sys sys 1170456648 21199
-sys/src/9/port/devbridge.c - 664 sys sys 1187735844 24076
+sys/src/9/port/devbridge.c - 664 sys sys 1204227718 24003
 sys/src/9/port/devcap.c - 664 sys sys 1178886040 4141
-sys/src/9/port/devcons.c - 664 sys sys 1176658321 22943
+sys/src/9/port/devcons.c - 664 sys sys 1204228551 23192
 sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
 sys/src/9/port/devdup.c - 664 sys sys 1196185172 2327
 sys/src/9/port/devenv.c - 664 sys sys 1169498893 7015
@@ -8255,10 +8256,10 @@ sys/src/9/port/devtinyfs.c - 664 sys sys 1015278339 15347
 sys/src/9/port/devtls.c - 664 sys sys 1146151715 45214
 sys/src/9/port/devuart.c - 664 sys sys 1170456620 12262
 sys/src/9/port/devwd.c - 664 sys sys 1126582325 2342
-sys/src/9/port/edf.c - 664 sys sys 1138472540 13489
+sys/src/9/port/edf.c - 664 sys sys 1204230576 13592
 sys/src/9/port/edf.h - 664 sys sys 1138469072 1195
-sys/src/9/port/error.h - 664 sys sys 1117055493 2637
-sys/src/9/port/fault.c - 664 sys sys 1138459838 7265
+sys/src/9/port/error.h - 664 sys sys 1204179766 2688
+sys/src/9/port/fault.c - 664 sys sys 1204230735 7409
 sys/src/9/port/initcode.c - 664 sys sys 1055688491 574
 sys/src/9/port/latin1.c - 664 sys sys 1015278339 1418
 sys/src/9/port/latin1.h - 664 sys sys 1184794985 3575
@@ -8283,9 +8284,9 @@ sys/src/9/port/netif.h - 664 sys sys 1187735815 3059
 sys/src/9/port/page.c - 664 sys sys 1131636090 11128
 sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
-sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
-sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
-sys/src/9/port/portfns.h - 664 sys sys 1202939287 11060
+sys/src/9/port/portclock.c - 664 sys sys 1204230761 4274
+sys/src/9/port/portdat.h - 664 sys sys 1204229767 22759
+sys/src/9/port/portfns.h - 664 sys sys 1202935714 11095
 sys/src/9/port/portmkfile - 664 sys sys 1184737233 2082
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1176658321 28742
@@ -8301,10 +8302,10 @@ sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1188922869 22120
 sys/src/9/port/sysproc.c - 664 sys sys 1188922870 21419
 sys/src/9/port/systab.h - 664 sys sys 1161222889 3204
-sys/src/9/port/taslock.c - 664 sys sys 1177343190 4418
+sys/src/9/port/taslock.c - 664 sys sys 1204229744 4590
 sys/src/9/port/thwack.c - 664 sys sys 1057323394 7253
 sys/src/9/port/thwack.h - 664 sys sys 1015278340 1792
-sys/src/9/port/tod.c - 664 sys sys 1146746630 5377
+sys/src/9/port/tod.c - 664 sys sys 1204228653 5445
 sys/src/9/port/unthwack.c - 664 sys sys 1057323394 5249
 sys/src/9/port/xalloc.c - 664 sys sys 1169491770 4289
 sys/src/9/ppc - 20000000775 sys sys 1123676466 0
@@ -9452,7 +9453,7 @@ sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1146061148 4068
 sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1191523856 3306
 sys/src/cmd/9nfs/rpc.c - 664 sys sys 1191523822 5647
 sys/src/cmd/9nfs/rpc.h - 664 sys sys 1017337815 1996
-sys/src/cmd/9nfs/server.c - 664 sys sys 1191523839 11320
+sys/src/cmd/9nfs/server.c - 664 sys sys 1204179116 11319
 sys/src/cmd/9nfs/string.c - 664 sys sys 1017337815 1659
 sys/src/cmd/9nfs/strparse.c - 664 sys sys 1015090373 506
 sys/src/cmd/9nfs/system.c - 664 sys sys 1017337815 437
@@ -9506,7 +9507,7 @@ sys/src/cmd/aquarela/alarm.c - 664 sys sys 1197673331 2170
 sys/src/cmd/aquarela/alloc.c - 664 sys sys 1135892108 245
 sys/src/cmd/aquarela/aquarela.c - 664 sys sys 1198159137 7017
 sys/src/cmd/aquarela/cifscmd.c - 664 sys sys 1135892108 4430
-sys/src/cmd/aquarela/client.c - 664 sys sys 1135892108 2724
+sys/src/cmd/aquarela/client.c - 664 sys sys 1204179312 2787
 sys/src/cmd/aquarela/dump.c - 664 sys sys 1135892108 2864
 sys/src/cmd/aquarela/findname.c - 664 sys sys 1135892108 1351
 sys/src/cmd/aquarela/headers.h - 664 sys sys 1135892108 185
@@ -9520,7 +9521,7 @@ sys/src/cmd/aquarela/nblistener.c - 664 sys sys 1189049390 687
 sys/src/cmd/aquarela/nbname.c - 664 sys sys 1135892109 5457
 sys/src/cmd/aquarela/nbns.c - 664 sys sys 1135892109 2747
 sys/src/cmd/aquarela/nbnsconv.c - 664 sys sys 1135892109 6257
-sys/src/cmd/aquarela/nbresolve.c - 664 sys sys 1135892109 672
+sys/src/cmd/aquarela/nbresolve.c - 664 sys sys 1204179312 646
 sys/src/cmd/aquarela/nbss.c - 664 sys sys 1135892110 8126
 sys/src/cmd/aquarela/netbios.h - 664 sys sys 1135892110 5967
 sys/src/cmd/aquarela/smb.h - 664 sys sys 1135892110 9492
@@ -10401,7 +10402,7 @@ sys/src/cmd/fossil/9auth.c - 664 sys sys 1189552651 3972
 sys/src/cmd/fossil/9dir.c - 664 sys sys 1085333382 2219
 sys/src/cmd/fossil/9excl.c - 664 sys sys 1042005502 1887
 sys/src/cmd/fossil/9fid.c - 664 sys sys 1189110070 5584
-sys/src/cmd/fossil/9fsys.c - 664 sys sys 1194215521 33624
+sys/src/cmd/fossil/9fsys.c - 664 sys sys 1204179530 34157
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1147355153 3038
 sys/src/cmd/fossil/9p.c - 664 sys sys 1189110070 22957
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
@@ -12469,15 +12470,15 @@ sys/src/cmd/iostats/mkfile - 664 sys sys 1014925727 122
 sys/src/cmd/iostats/statfs.h - 664 sys sys 1140099908 2626
 sys/src/cmd/iostats/statsrv.c - 664 sys sys 1166824341 10773
 sys/src/cmd/ip - 20000000775 sys sys 1128605981 0
-sys/src/cmd/ip/6in4.c - 664 sys sys 1198185057 9743
+sys/src/cmd/ip/6in4.c - 664 sys sys 1204179741 9920
 sys/src/cmd/ip/arp.h - 664 sys sys 944961005 751
 sys/src/cmd/ip/dhcp.h - 664 sys sys 1184696111 3764
 sys/src/cmd/ip/dhcpclient.c - 664 sys sys 1178482836 11969
 sys/src/cmd/ip/dhcpd - 20000000775 sys sys 1063897571 0
 sys/src/cmd/ip/dhcpd/dat.h - 664 sys sys 1084471353 2522
 sys/src/cmd/ip/dhcpd/db.c - 664 sys sys 1143670612 7466
-sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1185922538 35209
-sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1032655001 779
+sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1204179700 35269
+sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1204179691 796
 sys/src/cmd/ip/dhcpd/mkfile - 664 sys sys 1169162185 443
 sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1185920230 5799
 sys/src/cmd/ip/dhcpd/ping.c - 664 sys sys 1198186463 1225
@@ -12542,7 +12543,7 @@ sys/src/cmd/ip/imap4d/utils.c - 664 sys sys 1168894057 2587
 sys/src/cmd/ip/ipconfig - 20000000775 sys sys 1176933436 0
 sys/src/cmd/ip/ipconfig/ipconfig.h - 664 sys sys 1198189129 5311
 sys/src/cmd/ip/ipconfig/ipv6.c - 664 sys sys 1198189135 20619
-sys/src/cmd/ip/ipconfig/main.c - 664 sys sys 1185923495 39912
+sys/src/cmd/ip/ipconfig/main.c - 664 sys sys 1204178443 40237
 sys/src/cmd/ip/ipconfig/mkfile - 664 sys sys 1184880750 233
 sys/src/cmd/ip/ipconfig/ppp.c - 664 sys sys 1184880751 1046
 sys/src/cmd/ip/linklocal.c - 664 sys sys 1197673397 1751
@@ -12558,7 +12559,7 @@ sys/src/cmd/ip/ppp/dotest - 775 sys sys 944961006 152
 sys/src/cmd/ip/ppp/ipaux.c - 664 sys sys 1125529107 2328
 sys/src/cmd/ip/ppp/mkfile - 664 sys sys 1063897576 352
 sys/src/cmd/ip/ppp/mppc.c - 664 sys sys 1015090267 16624
-sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1194215466 59955
+sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1204179668 60052
 sys/src/cmd/ip/ppp/ppp.h - 664 sys sys 1091904423 8284
 sys/src/cmd/ip/ppp/testppp.c - 664 sys sys 1045505281 3011
 sys/src/cmd/ip/ppp/thw.c - 664 sys sys 1015090268 5962
@@ -12567,7 +12568,7 @@ sys/src/cmd/ip/ppp/thwack.h - 664 sys sys 964662210 2052
 sys/src/cmd/ip/ppp/unthwack.c - 664 sys sys 1015090268 5883
 sys/src/cmd/ip/pppoe.c - 664 sys sys 1125530113 12516
 sys/src/cmd/ip/pptp.c - 664 sys sys 1182582403 16596
-sys/src/cmd/ip/pptpd.c - 664 sys sys 1135487970 23548
+sys/src/cmd/ip/pptpd.c - 664 sys sys 1204259451 23509
 sys/src/cmd/ip/rarpd.c - 664 sys sys 1084470989 3389
 sys/src/cmd/ip/rexexec.c - 664 sys sys 1121977160 742
 sys/src/cmd/ip/rip.c - 664 sys sys 1178482790 12383
@@ -12830,7 +12831,7 @@ sys/src/cmd/ndb/csquery.c - 664 sys sys 1174626119 1073
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1201927753 25262
 sys/src/cmd/ndb/dn.c - 664 sys sys 1203748557 37967
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1175664421 2519
-sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1203748558 3052
+sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1204179585 3112
 sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1203748559 35408
 sys/src/cmd/ndb/dns.c - 664 sys sys 1203745528 17970
 sys/src/cmd/ndb/dns.h - 664 sys sys 1202761152 11969
@@ -14252,7 +14253,7 @@ sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1188509396 1075
 sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1188509396 20717
 sys/src/cmd/upas/smtp/smtp.h - 664 sys sys 1188509396 1356
-sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1203645213 33362
+sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1204179355 33414
 sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1201499389 1134
 sys/src/cmd/upas/smtp/smtpd.y - 664 sys sys 1181508390 6924
 sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1139699502 10238
@@ -15375,16 +15376,15 @@ sys/src/libhttpd/urlfmt.c - 664 sys sys 1014930785 425
 sys/src/libhttpd/urlunesc.c - 664 sys sys 1014930785 995
 sys/src/libip - 20000000775 sys sys 1066515138 0
 sys/src/libip/bo.c - 664 sys sys 1089213099 811
-sys/src/libip/classmask.c - 664 sys sys 944961726 622
+sys/src/libip/classmask.c - 664 sys sys 1204178762 1909
 sys/src/libip/eipfmt.c - 664 sys sys 1116097626 2188
 sys/src/libip/equivip.c - 664 sys sys 1103554773 285
-sys/src/libip/ip.h - 664 sys sys 944961727 1438
 sys/src/libip/ipaux.c - 664 sys sys 985038059 1515
-sys/src/libip/mkfile - 664 sys sys 1065576347 320
+sys/src/libip/mkfile - 664 sys sys 1204228221 333
 sys/src/libip/myetheraddr.c - 664 sys sys 1178597962 382
 sys/src/libip/myipaddr.c - 664 sys sys 1069766545 841
 sys/src/libip/parseether.c - 664 sys sys 944961726 318
-sys/src/libip/parseip.c - 664 sys sys 1169595542 2429
+sys/src/libip/parseip.c - 664 sys sys 1204228369 3520
 sys/src/libip/ptclbsum.c - 664 sys sys 1132452948 1160
 sys/src/libip/readipifc.c - 664 sys sys 1201723612 4396
 sys/src/libip/testreadipifc.c - 664 sys sys 1021580003 400
@@ -15559,7 +15559,7 @@ sys/src/libmp/test.c - 664 sys sys 964798440 12260
 sys/src/libndb - 20000000775 sys sys 1078618600 0
 sys/src/libndb/csgetval.c - 664 sys sys 1144174488 1796
 sys/src/libndb/csipinfo.c - 664 sys sys 1144174488 1178
-sys/src/libndb/dnsquery.c - 664 sys sys 1144174488 2883
+sys/src/libndb/dnsquery.c - 664 sys sys 1204228421 2977
 sys/src/libndb/ipattr.c - 664 sys sys 953844690 586
 sys/src/libndb/mkfile - 664 sys sys 1078618596 513
 sys/src/libndb/ndbaux.c - 664 sys sys 1144174488 1544

+ 69 - 0
dist/replica/plan9.log

@@ -18589,3 +18589,72 @@
 1204057804 2 c 386/bin/auth/debug - 775 sys sys 1204057810 101408
 1204057804 3 c 386/bin/upas/fs - 775 sys sys 1204057817 331512
 1204142404 0 c rc/bin/addpsfonts - 775 sys sys 1204141960 266
+1204178405 0 c sys/src/cmd/ip/ipconfig/main.c - 664 sys sys 1204178443 40237
+1204178405 1 c sys/src/libip/classmask.c - 664 sys sys 1204178762 1909
+1204178405 2 c sys/src/libip/parseip.c - 664 sys sys 1204178772 3590
+1204180205 0 c sys/src/9/ip/arp.c - 664 sys sys 1204180133 11321
+1204180205 1 c sys/src/9/ip/devip.c - 664 sys sys 1204180143 24398
+1204180205 2 c sys/src/9/ip/ipifc.c - 664 sys sys 1204180081 34151
+1204180205 3 c sys/src/9/ip/iproute.c - 664 sys sys 1204180152 14845
+1204180205 4 c sys/src/9/pc/devusb.c - 664 sys sys 1204179902 20831
+1204180205 5 c sys/src/9/port/error.h - 664 sys sys 1204179766 2688
+1204180205 6 c sys/src/cmd/9nfs/server.c - 664 sys sys 1204179116 11319
+1204180205 7 c sys/src/cmd/aquarela/client.c - 664 sys sys 1204179312 2787
+1204180205 8 c sys/src/cmd/aquarela/nbresolve.c - 664 sys sys 1204179312 646
+1204180205 9 c sys/src/cmd/ip/6in4.c - 664 sys sys 1204179741 9920
+1204180205 10 c sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1204179700 35269
+1204180205 11 c sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1204179691 796
+1204180205 12 c sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1204179668 60052
+1204180205 13 c sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1204179585 3112
+1204180205 14 c sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1204179355 33414
+1204180205 15 c sys/src/cmd/fossil/9fsys.c - 664 sys sys 1204179530 34157
+1204228804 0 c sys/man/2/ip - 664 sys sys 1204227918 7257
+1204228804 1 c sys/src/9/port/devbridge.c - 664 sys sys 1204227718 24003
+1204228804 2 c sys/src/9/port/devcons.c - 664 sys sys 1204228551 23192
+1204228804 3 c sys/src/9/port/tod.c - 664 sys sys 1204228653 5445
+1204228804 4 c sys/src/libip/mkfile - 664 sys sys 1204228221 333
+1204228804 5 c sys/src/libip/parseip.c - 664 sys sys 1204228369 3520
+1204228804 6 c sys/src/libndb/dnsquery.c - 664 sys sys 1204228421 2977
+1204228804 7 d sys/src/libip/ip.h - 664 sys sys 944961727 0
+1204230604 0 c sys/include/ip.h - 664 sys sys 1204230308 4401
+1204230604 1 c sys/src/9/port/edf.c - 664 sys sys 1204230576 13592
+1204230604 2 c sys/src/9/port/portdat.h - 664 sys sys 1204229767 22759
+1204230604 3 c sys/src/9/port/portfns.h - 664 sys sys 1202935714 11095
+1204230604 4 c sys/src/9/port/taslock.c - 664 sys sys 1204229744 4590
+1204232404 0 c sys/src/9/ip/ip.h - 664 sys sys 1204231127 16639
+1204232404 1 c sys/src/9/ip/ipaux.c - 664 sys sys 1204231128 6250
+1204232404 2 c sys/src/9/ip/rudp.c - 664 sys sys 1204231129 20834
+1204232404 3 c sys/src/9/pc/devarch.c - 664 sys sys 1194555741 19865
+1204232404 4 c sys/src/9/pc/mkfile - 664 sys sys 1204231465 4152
+1204232404 5 c sys/src/9/pc/pc - 664 sys sys 1204231598 1551
+1204232404 6 c sys/src/9/pc/pcauth - 664 sys sys 1204231648 767
+1204232404 7 c sys/src/9/pc/pccpu - 664 sys sys 1204231753 1059
+1204232404 8 c sys/src/9/pc/pcdisk - 664 sys sys 1204231795 1623
+1204232404 9 c sys/src/9/pc/pcf - 664 sys sys 1204231808 1669
+1204232404 10 c sys/src/9/pc/pccpuf - 664 sys sys 1204231783 1686
+1204232404 11 c sys/src/9/pc/sdmv50xx.c - 664 sys sys 1204231890 33839
+1204232404 12 c sys/src/9/port/fault.c - 664 sys sys 1204230735 7409
+1204232404 13 c sys/src/9/port/portclock.c - 664 sys sys 1204230761 4274
+1204234204 0 c sys/src/9/alphapc/clock.c - 664 sys sys 1204233074 1527
+1204234204 1 c sys/src/9/alphapc/mkfile - 664 sys sys 1204233063 1997
+1204234204 2 a sys/src/9/alphapc/sd53c8xx.i - 664 sys sys 1204233026 28453
+1204234204 3 c sys/src/9/bitsy/clock.c - 664 sys sys 1204232953 4890
+1204234204 4 c sys/src/9/bitsy/dat.h - 664 sys sys 1204232953 5849
+1204234204 5 c sys/src/9/bitsy/fns.h - 664 sys sys 1204232952 3082
+1204234204 6 c sys/src/9/bitsy/mkfile - 664 sys sys 1204232952 2856
+1204234204 7 c sys/src/9/mtx/clock.c - 664 sys sys 1204232769 1344
+1204234204 8 c sys/src/9/mtx/mkfile - 664 sys sys 1204232769 1636
+1204234204 9 c sys/src/9/mtx/mtx - 664 sys sys 1188514183 413
+1204234204 10 c sys/src/9/mtx/mtxcpu - 664 sys sys 1188514195 418
+1204234204 11 c sys/src/9/pc/sdmv50xx.c - 664 sys sys 1204232564 34031
+1204236004 0 c 386/9pc - 775 sys sys 1204234986 2108860
+1204236004 1 c 386/9pc.gz - 664 sys sys 1204235000 902572
+1204236004 2 c 386/9pccpu - 775 sys sys 1204235039 2235277
+1204236004 3 c 386/9pccpu.gz - 664 sys sys 1204235053 916661
+1204236004 4 c 386/9pcdisk - 775 sys sys 1204235093 2304320
+1204236004 5 c 386/9pcdisk.gz - 664 sys sys 1204235109 979802
+1204236004 6 c 386/9pcf - 775 sys sys 1204235159 2969900
+1204236004 7 c 386/9pcf.gz - 664 sys sys 1204235180 1264093
+1204241404 0 c sys/src/9/ip/iproute.c - 664 sys sys 1204240365 14880
+1204241404 1 c sys/src/9/pc/etherigbe.c - 664 sys sys 1204240380 46146
+1204259404 0 c sys/src/cmd/ip/pptpd.c - 664 sys sys 1204259451 23509

+ 2 - 2
sys/include/ip.h

@@ -160,8 +160,8 @@ uchar*	defmask(uchar*);
 void	maskip(uchar*, uchar*, uchar*);
 int	eipfmt(Fmt*);
 int	isv4(uchar*);
-ulong	parseip(uchar*, char*);
-ulong	parseipmask(uchar*, char*);
+vlong	parseip(uchar*, char*);
+vlong	parseipmask(uchar*, char*);
 char*	v4parseip(uchar*, char*);
 char*	v4parsecidr(uchar*, uchar*, char*);
 int	parseether(uchar*, char*);

+ 2 - 2
sys/man/2/ip

@@ -12,10 +12,10 @@ eipfmt, parseip, parseipmask, v4parseip, v4parsecidr, parseether, myipaddr, myet
 int	eipfmt(Fmt*)
 .PP
 .B
-ulong	parseip(uchar *ipaddr, char *str)
+vlong	parseip(uchar *ipaddr, char *str)
 .PP
 .B
-ulong	parseipmask(uchar *ipaddr, char *str)
+vlong	parseipmask(uchar *ipaddr, char *str)
 .PP
 .B
 char*	v4parseip(uchar *ipaddr, char *str)

+ 7 - 1
sys/src/9/alphapc/clock.c

@@ -58,6 +58,12 @@ fastticks(uvlong* hz)
 	return ticks;
 }
 
+ulong
+µs(void)
+{
+	return fastticks2us(cycletimer());
+}
+
 /*  
  *  performance measurement ticks.  must be low overhead.
  *  doesn't have to count over a second.
@@ -69,7 +75,7 @@ perfticks(void)
 }
 
 void
-timerset(uvlong)
+timerset(Tval)
 {
 }
 

+ 1 - 0
sys/src/9/alphapc/mkfile

@@ -60,6 +60,7 @@ LIB=\
 	/$objtype/lib/libmemlayer.a\
 	/$objtype/lib/libmemdraw.a\
 	/$objtype/lib/libdraw.a\
+	/$objtype/lib/libip.a\
 	/$objtype/lib/libc.a\
 	/$objtype/lib/libsec.a\
 

+ 805 - 0
sys/src/9/alphapc/sd53c8xx.i

@@ -0,0 +1,805 @@
+unsigned long na_script[] = {
+			/*	extern	scsi_id_buf */
+			/*	extern	msg_out_buf */
+			/*	extern	cmd_buf */
+			/*	extern	data_buf */
+			/*	extern	status_buf */
+			/*	extern	msgin_buf */
+			/*	extern	dsa_0 */
+			/*	extern  dsa_1 */
+			/*	extern	dsa_head */
+			/*	extern	ssid_mask */
+			/*	SIR_MSG_IO_COMPLETE = 0 */
+			/*	error_not_cmd_complete = 1 */
+			/*	error_disconnected = 2 */
+			/*	error_reselected = 3 */
+			/*	error_unexpected_phase = 4 */
+			/*	error_weird_message = 5 */
+			/*	SIR_ERROR_NOT_MSG_IN_AFTER_RESELECT = 6 */
+			/*	error_not_identify_after_reselect = 7 */
+			/*	error_too_much_data = 8 */
+			/*	error_too_little_data = 9 */
+			/*	SIR_MSG_REJECT = 10 */
+			/*	SIR_MSG_SDTR = 11 */
+			/*	SIR_EV_RESPONSE_OK = 12 */
+			/*	error_sigp_set = 13 */
+			/*	SIR_EV_PHASE_SWITCH_AFTER_ID = 14 */
+			/*	SIR_MSG_WDTR = 15 */
+			/*	SIR_MSG_IGNORE_WIDE_RESIDUE = 16 */
+			/*	SIR_NOTIFY_DISC = 100 */
+			/*	SIR_NOTIFY_RESELECT = 101 */
+			/*	SIR_NOTIFY_MSG_IN = 102 */
+			/*	SIR_NOTIFY_STATUS = 103 */
+			/*	SIR_NOTIFY_DUMP = 104 */
+			/*	SIR_NOTIFY_DUMP2 = 105 */
+			/*	SIR_NOTIFY_SIGP = 106 */
+			/*	SIR_NOTIFY_ISSUE = 107 */
+			/*	SIR_NOTIFY_WAIT_RESELECT = 108 */
+			/*	SIR_NOTIFY_ISSUE_CHECK = 109 */
+			/*	SIR_NOTIFY_DUMP_NEXT_CODE = 110 */
+			/*	SIR_NOTIFY_COMMAND = 111 */
+			/*	SIR_NOTIFY_DATA_IN = 112 */
+			/*	SIR_NOTIFY_DATA_OUT = 113 */
+			/*	SIR_NOTIFY_BLOCK_DATA_IN = 114 */
+			/*	SIR_NOTIFY_WSR = 115 */
+			/*	SIR_NOTIFY_LOAD_SYNC = 116 */
+			/*	SIR_NOTIFY_RESELECTED_ON_SELECT = 117 */
+			/*	SIR_NOTIFY_LOAD_STATE = 118 */
+			/*	STATE_FREE = 0 */
+			/*	STATE_ALLOCATED = 1 */
+			/*	STATE_ISSUE = 2 */
+			/*	STATE_DISCONNECTED = 3 */
+			/*	STATE_DONE = 4 */
+			/*	STATE_END = 5 */
+			/*	RESULT_OK = 0 */
+			/*	MSG_IDENTIFY = 0x80 */
+			/*	MSG_DISCONNECT = 0x04 */
+			/*	MSG_SAVE_DATA_POINTER = 0x02 */
+			/*	MSG_RESTORE_POINTERS = 0x03 */
+			/*	MSG_IGNORE_WIDE_RESIDUE = 0x23 */
+			/*	X_MSG = 0x01 */
+			/*	X_MSG_SDTR = 0x01 */
+			/*	X_MSG_WDTR = 0x03 */
+			/*	MSG_REJECT = 0x07 */
+			/*	BSIZE = 512 */
+/* 0000 */ 0x80880000L, /*		jump	wait_for_reselection */
+/* 0004 */ 0x00000514L,
+/* 0008 */ 0x88880000L, /*		call	load_sync */
+/* 000c */ 0x00000790L,
+/* 0010 */ 0x60000200L, /*		clear	target */
+/* 0014 */ 0x00000000L,
+/* 0018 */ 0x47000000L, /*		select	atn from scsi_id_buf, reselected_on_select */
+/* 001c */ 0x000004ecL,
+/* 0020 */ 0x878b0000L, /*		jump	start1, when msg_in */
+/* 0024 */ 0x00000000L,
+/* 0028 */ 0x1e000000L, /*		move	from msg_out_buf, when msg_out */
+/* 002c */ 0x00000001L,
+/* 0030 */ 0x868b0000L, /*		jump	start1, when msg_out */
+/* 0034 */ 0x00fffff0L,
+/* 0038 */ 0x82830000L, /*		jump	to_decisions, when not cmd */
+/* 003c */ 0x000005b8L,
+/* 0040 */ 0x60000008L, /*		clear	atn */
+/* 0044 */ 0x00000000L,
+/* 0048 */ 0x1a000000L, /*		move	from cmd_buf, when cmd */
+/* 004c */ 0x00000002L,
+/* 0050 */ 0x81830000L, /*		jump	to_decisions, when not data_in */
+/* 0054 */ 0x000005a0L,
+/* 0058 */ 0xc0000004L, /*		move	memory 4, state, scratcha */
+/* 005c */ 0x00000640L,
+/* 0060 */ 0x00000034L,
+/* 0064 */ 0xc0000004L, /*		move	memory 4, dmaaddr, scratchb */
+/* 0068 */ 0x00000644L,
+/* 006c */ 0x0000005cL,
+/* 0070 */ 0x72360000L, /*		move	scratcha2 to sfbr */
+/* 0074 */ 0x00000000L,
+/* 0078 */ 0x808c0000L, /*		jump	data_in_normal, if 0 */
+/* 007c */ 0x00000078L,
+/* 0080 */ 0x29000200L, /*		move	BSIZE, ptr dmaaddr, when data_in */
+/* 0084 */ 0x00000644L,
+/* 0088 */ 0x7e5d0200L, /*		move	scratchb1 + BSIZE / 256 to scratchb1 */
+/* 008c */ 0x00000000L,
+/* 0090 */ 0x7f5e0000L, /*		move	scratchb2 + 0 to scratchb2 with carry */
+/* 0094 */ 0x00000000L,
+/* 0098 */ 0x7f5f0000L, /*		move	scratchb3 + 0 to scratchb3 with carry */
+/* 009c */ 0x00000000L,
+/* 00a0 */ 0x7e36ff00L, /*		move	scratcha2 + 255 to scratcha2 */
+/* 00a4 */ 0x00000000L,
+/* 00a8 */ 0xc0000004L, /*		move	memory 4, scratchb, dmaaddr */
+/* 00ac */ 0x0000005cL,
+/* 00b0 */ 0x00000644L,
+/* 00b4 */ 0x818b0000L, /*		jump	data_in_block_loop, when data_in */
+/* 00b8 */ 0x00ffffb4L,
+/* 00bc */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 00c0 */ 0x00000034L,
+/* 00c4 */ 0x00000640L,
+/* 00c8 */ 0x88880000L, /*		call	save_state */
+/* 00cc */ 0x0000065cL,
+/* 00d0 */ 0x80880000L, /*		jump	to_decisions */
+/* 00d4 */ 0x00000520L,
+/* 00d8 */ 0xc0000004L, /*		move	memory 4, scratchb, dmaaddr */
+/* 00dc */ 0x0000005cL,
+/* 00e0 */ 0x00000644L,
+/* 00e4 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 00e8 */ 0x00000034L,
+/* 00ec */ 0x00000640L,
+/* 00f0 */ 0x80880000L, /*		jump	to_decisions */
+/* 00f4 */ 0x00000500L,
+/* 00f8 */ 0x72370000L, /*		move	scratcha3 to sfbr */
+/* 00fc */ 0x00000000L,
+/* 0100 */ 0x98040000L, /*		int	error_too_much_data, if not 0 */
+/* 0104 */ 0x00000008L,
+/* 0108 */ 0x19000000L, /*		move	from data_buf, when data_in */
+/* 010c */ 0x00000003L,
+/* 0110 */ 0x78370200L, /*		move	2 to scratcha3 */
+/* 0114 */ 0x00000000L,
+/* 0118 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 011c */ 0x00000034L,
+/* 0120 */ 0x00000640L,
+/* 0124 */ 0x88880000L, /*		call	save_state */
+/* 0128 */ 0x00000600L,
+/* 012c */ 0x80880000L, /*		jump	post_data_to_decisions */
+/* 0130 */ 0x000004f4L,
+/* 0134 */ 0xc0000004L, /*		move	memory 4, state, scratcha */
+/* 0138 */ 0x00000640L,
+/* 013c */ 0x00000034L,
+/* 0140 */ 0xc0000004L, /*		move	memory 4, dmaaddr, scratchb */
+/* 0144 */ 0x00000644L,
+/* 0148 */ 0x0000005cL,
+/* 014c */ 0x72360000L, /*		move	scratcha2 to sfbr */
+/* 0150 */ 0x00000000L,
+/* 0154 */ 0x808c0000L, /*		jump	data_out_normal, if 0 */
+/* 0158 */ 0x0000005cL,
+/* 015c */ 0xc0000004L, /*		move	memory 4, dmaaddr, scratchb */
+/* 0160 */ 0x00000644L,
+/* 0164 */ 0x0000005cL,
+/* 0168 */ 0x28000200L, /*		move	BSIZE, ptr dmaaddr, when data_out */
+/* 016c */ 0x00000644L,
+/* 0170 */ 0x7e5d0200L, /*		move	scratchb1 + BSIZE / 256 to scratchb1 */
+/* 0174 */ 0x00000000L,
+/* 0178 */ 0x7f5e0000L, /*		move	scratchb2 + 0 to scratchb2 with carry */
+/* 017c */ 0x00000000L,
+/* 0180 */ 0x7f5f0000L, /*		move	scratchb3 + 0 to scratchb3 with carry */
+/* 0184 */ 0x00000000L,
+/* 0188 */ 0x7e36ff00L, /*		move	scratcha2 + 255 to scratcha2 */
+/* 018c */ 0x00000000L,
+/* 0190 */ 0xc0000004L, /*		move	memory 4, scratchb, dmaaddr */
+/* 0194 */ 0x0000005cL,
+/* 0198 */ 0x00000644L,
+/* 019c */ 0x808b0000L, /*		jump	data_out_block_loop, when data_out */
+/* 01a0 */ 0x00ffffa8L,
+/* 01a4 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 01a8 */ 0x00000034L,
+/* 01ac */ 0x00000640L,
+/* 01b0 */ 0x80880000L, /*		jump	to_decisions */
+/* 01b4 */ 0x00000440L,
+/* 01b8 */ 0x72370000L, /*		move	scratcha3 to sfbr */
+/* 01bc */ 0x00000000L,
+/* 01c0 */ 0x98040000L, /*		int	error_too_little_data, if not 0 */
+/* 01c4 */ 0x00000009L,
+/* 01c8 */ 0x18000000L, /*		move	from data_buf, when data_out */
+/* 01cc */ 0x00000003L,
+/* 01d0 */ 0x78370200L, /*		move	2 to scratcha3 */
+/* 01d4 */ 0x00000000L,
+/* 01d8 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 01dc */ 0x00000034L,
+/* 01e0 */ 0x00000640L,
+/* 01e4 */ 0x88880000L, /*		call	save_state */
+/* 01e8 */ 0x00000540L,
+/* 01ec */ 0x80880000L, /*		jump	post_data_to_decisions */
+/* 01f0 */ 0x00000434L,
+/* 01f4 */ 0x1b000000L, /*		move	from status_buf, when status */
+/* 01f8 */ 0x00000004L,
+/* 01fc */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0200 */ 0x00000004L,
+/* 0204 */ 0x0f000001L, /*		move	1, scratcha, when msg_in */
+/* 0208 */ 0x00000034L,
+/* 020c */ 0x808c0007L, /*		jump	rejected, if MSG_REJECT */
+/* 0210 */ 0x00000088L,
+/* 0214 */ 0x808c0004L, /*		jump	disconnected, if MSG_DISCONNECT */
+/* 0218 */ 0x00000298L,
+/* 021c */ 0x808c0002L, /*		jump	msg_in_skip, if MSG_SAVE_DATA_POINTER */
+/* 0220 */ 0x00000090L,
+/* 0224 */ 0x808c0003L, /*		jump	msg_in_skip, if MSG_RESTORE_POINTERS */
+/* 0228 */ 0x00000088L,
+/* 022c */ 0x808c0023L, /*		jump	ignore_wide, if MSG_IGNORE_WIDE_RESIDUE */
+/* 0230 */ 0x000001f0L,
+/* 0234 */ 0x808c0001L, /*		jump	extended, if X_MSG */
+/* 0238 */ 0x00000088L,
+/* 023c */ 0x98040000L, /*		int	error_not_cmd_complete, if not 0 */
+/* 0240 */ 0x00000001L,
+/* 0244 */ 0x7c027e00L, /*		move	scntl2&0x7e to scntl2 */
+/* 0248 */ 0x00000000L,
+/* 024c */ 0x60000040L, /*		clear	ack */
+/* 0250 */ 0x00000000L,
+/* 0254 */ 0x48000000L, /*		wait	disconnect */
+/* 0258 */ 0x00000000L,
+/* 025c */ 0xc0000004L, /*		move	memory 4, state, scratcha */
+/* 0260 */ 0x00000640L,
+/* 0264 */ 0x00000034L,
+/* 0268 */ 0x78340400L, /*		move	STATE_DONE to scratcha0 */
+/* 026c */ 0x00000000L,
+/* 0270 */ 0x78350000L, /*		move	RESULT_OK to scratcha1 */
+/* 0274 */ 0x00000000L,
+/* 0278 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 027c */ 0x00000034L,
+/* 0280 */ 0x00000640L,
+/* 0284 */ 0x88880000L, /*		call	save_state */
+/* 0288 */ 0x000004a0L,
+/* 028c */ 0x98180000L, /*		intfly	0 */
+/* 0290 */ 0x00000000L,
+/* 0294 */ 0x80880000L, /*		jump	issue_check */
+/* 0298 */ 0x000004b8L,
+/* 029c */ 0x98080000L, /*		int	SIR_MSG_REJECT */
+/* 02a0 */ 0x0000000aL,
+/* 02a4 */ 0x60000040L, /*		clear	ack */
+/* 02a8 */ 0x00000000L,
+/* 02ac */ 0x80880000L, /*		jump	to_decisions */
+/* 02b0 */ 0x00000344L,
+/* 02b4 */ 0x60000040L, /*		clear	ack */
+/* 02b8 */ 0x00000000L,
+/* 02bc */ 0x80880000L, /*		jump	to_decisions */
+/* 02c0 */ 0x00000334L,
+/* 02c4 */ 0x60000040L, /*		clear	ack */
+/* 02c8 */ 0x00000000L,
+/* 02cc */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 02d0 */ 0x00000004L,
+/* 02d4 */ 0x0f000001L, /*		move	1, scratcha1, when msg_in */
+/* 02d8 */ 0x00000035L,
+/* 02dc */ 0x808c0003L, /*		jump	ext_3, if 3 */
+/* 02e0 */ 0x00000030L,
+/* 02e4 */ 0x808c0002L, /*		jump	ext_2, if 2 */
+/* 02e8 */ 0x00000098L,
+/* 02ec */ 0x98040001L, /*		int	error_weird_message, if not 1 */
+/* 02f0 */ 0x00000005L,
+/* 02f4 */ 0x60000040L, /*		clear	ack */
+/* 02f8 */ 0x00000000L,
+/* 02fc */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0300 */ 0x00000004L,
+/* 0304 */ 0x0f000001L, /*		move	1, scratcha1, when msg_in */
+/* 0308 */ 0x00000035L,
+/* 030c */ 0x80880000L, /*		jump	ext_done */
+/* 0310 */ 0x000000c8L,
+/* 0314 */ 0x60000040L, /*	ext_3:	clear	ack */
+/* 0318 */ 0x00000000L,
+/* 031c */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0320 */ 0x00000004L,
+/* 0324 */ 0x0f000001L, /*		move	1, scratcha1, when msg_in */
+/* 0328 */ 0x00000035L,
+/* 032c */ 0x60000040L, /*		clear	ack */
+/* 0330 */ 0x00000000L,
+/* 0334 */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0338 */ 0x00000004L,
+/* 033c */ 0x0f000001L, /*		move	1, scratcha2, when msg_in */
+/* 0340 */ 0x00000036L,
+/* 0344 */ 0x60000040L, /*		clear	ack */
+/* 0348 */ 0x00000000L,
+/* 034c */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0350 */ 0x00000004L,
+/* 0354 */ 0x0f000001L, /*		move	1, scratcha3, when msg_in */
+/* 0358 */ 0x00000037L,
+/* 035c */ 0x72350000L, /*		move	scratcha1 to sfbr */
+/* 0360 */ 0x00000000L,
+/* 0364 */ 0x80840001L, /*		jump	ext_done, if not X_MSG_SDTR */
+/* 0368 */ 0x00000070L,
+/* 036c */ 0x98080000L, /*	sdtr:	int	SIR_MSG_SDTR */
+/* 0370 */ 0x0000000bL,
+/* 0374 */ 0x60000040L, /*		clear	ack */
+/* 0378 */ 0x00000000L,
+/* 037c */ 0x80880000L, /*		jump	to_decisions */
+/* 0380 */ 0x00000274L,
+/* 0384 */ 0x60000040L, /*	ext_2:	clear	ack */
+/* 0388 */ 0x00000000L,
+/* 038c */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0390 */ 0x00000004L,
+/* 0394 */ 0x0f000001L, /*		move	1, scratcha1, when msg_in */
+/* 0398 */ 0x00000035L,
+/* 039c */ 0x60000040L, /*		clear	ack */
+/* 03a0 */ 0x00000000L,
+/* 03a4 */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 03a8 */ 0x00000004L,
+/* 03ac */ 0x0f000001L, /*		move	1, scratcha2, when msg_in */
+/* 03b0 */ 0x00000036L,
+/* 03b4 */ 0x72350000L, /*		move	scratcha1 to sfbr */
+/* 03b8 */ 0x00000000L,
+/* 03bc */ 0x80840003L, /*		jump	ext_done, if not X_MSG_WDTR */
+/* 03c0 */ 0x00000018L,
+/* 03c4 */ 0x98080000L, /*	wdtr:	int	SIR_MSG_WDTR */
+/* 03c8 */ 0x0000000fL,
+/* 03cc */ 0x60000040L, /*		clear	ack */
+/* 03d0 */ 0x00000000L,
+/* 03d4 */ 0x80880000L, /*		jump	to_decisions */
+/* 03d8 */ 0x0000021cL,
+/* 03dc */ 0x58000008L, /*		set	atn */
+/* 03e0 */ 0x00000000L,
+/* 03e4 */ 0x60000040L, /*		clear	ack */
+/* 03e8 */ 0x00000000L,
+/* 03ec */ 0x78340700L, /*		move	MSG_REJECT to scratcha */
+/* 03f0 */ 0x00000000L,
+/* 03f4 */ 0x9e030000L, /*		int	error_unexpected_phase, when not msg_out */
+/* 03f8 */ 0x00000004L,
+/* 03fc */ 0x60000008L, /*		clear	atn */
+/* 0400 */ 0x00000000L,
+/* 0404 */ 0x0e000001L, /*		move	1, scratcha, when msg_out */
+/* 0408 */ 0x00000034L,
+/* 040c */ 0x60000040L, /*		clear	ack */
+/* 0410 */ 0x00000000L,
+/* 0414 */ 0x868b0000L, /*		jump	reject, when msg_out */
+/* 0418 */ 0x00ffffc0L,
+/* 041c */ 0x80880000L, /*		jump	to_decisions */
+/* 0420 */ 0x000001d4L,
+/* 0424 */ 0x60000040L, /*		clear	ack */
+/* 0428 */ 0x00000000L,
+/* 042c */ 0x9f030000L, /*		int	error_unexpected_phase, when not msg_in */
+/* 0430 */ 0x00000004L,
+/* 0434 */ 0x0f000001L, /*		move	1, scratcha1, when msg_in */
+/* 0438 */ 0x00000035L,
+/* 043c */ 0x98080000L, /*		int	SIR_MSG_IGNORE_WIDE_RESIDUE */
+/* 0440 */ 0x00000010L,
+/* 0444 */ 0x60000040L, /*		clear	ack */
+/* 0448 */ 0x00000000L,
+/* 044c */ 0x80880000L, /*		jump	to_decisions */
+/* 0450 */ 0x000001a4L,
+/* 0454 */ 0x58000008L, /*		set	atn */
+/* 0458 */ 0x00000000L,
+/* 045c */ 0x60000040L, /*		clear	ack */
+/* 0460 */ 0x00000000L,
+/* 0464 */ 0x9e030000L, /*		int	error_unexpected_phase, when not msg_out */
+/* 0468 */ 0x00000004L,
+/* 046c */ 0x1e000000L, /*		move	from msg_out_buf, when msg_out */
+/* 0470 */ 0x00000001L,
+/* 0474 */ 0x868b0000L, /*		jump	response_repeat, when msg_out */
+/* 0478 */ 0x00fffff0L,
+/* 047c */ 0x878b0000L, /*		jump	response_msg_in, when msg_in */
+/* 0480 */ 0x00000010L,
+/* 0484 */ 0x98080000L, /*		int	SIR_EV_RESPONSE_OK */
+/* 0488 */ 0x0000000cL,
+/* 048c */ 0x80880000L, /*		jump	to_decisions */
+/* 0490 */ 0x00000164L,
+/* 0494 */ 0x0f000001L, /*		move	1, scratcha, when msg_in */
+/* 0498 */ 0x00000034L,
+/* 049c */ 0x808c0007L, /*		jump	rejected, if MSG_REJECT */
+/* 04a0 */ 0x00fffdf8L,
+/* 04a4 */ 0x98080000L, /*		int	SIR_EV_RESPONSE_OK */
+/* 04a8 */ 0x0000000cL,
+/* 04ac */ 0x80880000L, /*		jump	msg_in_not_reject */
+/* 04b0 */ 0x00fffd60L,
+/* 04b4 */ 0x7c027e00L, /*		move	scntl2&0x7e to scntl2 */
+/* 04b8 */ 0x00000000L,
+/* 04bc */ 0x60000040L, /*		clear 	ack */
+/* 04c0 */ 0x00000000L,
+/* 04c4 */ 0x48000000L, /*		wait	disconnect */
+/* 04c8 */ 0x00000000L,
+/* 04cc */ 0xc0000004L, /*		move	memory 4, state, scratcha */
+/* 04d0 */ 0x00000640L,
+/* 04d4 */ 0x00000034L,
+/* 04d8 */ 0x78340300L, /*		move	STATE_DISCONNECTED to scratcha0 */
+/* 04dc */ 0x00000000L,
+/* 04e0 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 04e4 */ 0x00000034L,
+/* 04e8 */ 0x00000640L,
+/* 04ec */ 0x88880000L, /*		call	save_state */
+/* 04f0 */ 0x00000238L,
+/* 04f4 */ 0x74020100L, /*		move	scntl2&0x01 to sfbr */
+/* 04f8 */ 0x00000000L,
+/* 04fc */ 0x98040000L, /*		int	SIR_NOTIFY_WSR, if not 0 */
+/* 0500 */ 0x00000073L,
+/* 0504 */ 0x80880000L, /*		jump	issue_check */
+/* 0508 */ 0x00000248L,
+/* 050c */ 0x98080000L, /*		int	SIR_NOTIFY_RESELECTED_ON_SELECT */
+/* 0510 */ 0x00000075L,
+/* 0514 */ 0x80880000L, /*		jump	reselected */
+/* 0518 */ 0x00000008L,
+/* 051c */ 0x54000000L, /*		wait reselect sigp_set */
+/* 0520 */ 0x00000228L,
+/* 0524 */ 0x60000200L, /*		clear	target */
+/* 0528 */ 0x00000000L,
+/* 052c */ 0x9f030000L, /*		int	SIR_ERROR_NOT_MSG_IN_AFTER_RESELECT, when not msg_in */
+/* 0530 */ 0x00000006L,
+/* 0534 */ 0x0f000001L, /*		move	1, scratchb, when msg_in */
+/* 0538 */ 0x0000005cL,
+/* 053c */ 0x98041f80L, /*		int	error_not_identify_after_reselect, if not MSG_IDENTIFY and mask 0x1f */
+/* 0540 */ 0x00000007L,
+/* 0544 */ 0xc0000004L, /*	 	move	memory 4, dsa_head, dsa */
+/* 0548 */ 0x00000008L,
+/* 054c */ 0x00000010L,
+/* 0550 */ 0x88880000L, /*		call	load_state */
+/* 0554 */ 0x00000100L,
+/* 0558 */ 0xc0000004L, /*		move	memory 4, state, scratcha */
+/* 055c */ 0x00000640L,
+/* 0560 */ 0x00000034L,
+/* 0564 */ 0x72340000L, /*		move	scratcha0 to sfbr */
+/* 0568 */ 0x00000000L,
+/* 056c */ 0x80840003L, /*		jump	find_dsa_next, if not STATE_DISCONNECTED */
+/* 0570 */ 0x00000040L,
+/* 0574 */ 0x980c0005L, /*		int	error_reselected, if STATE_END */
+/* 0578 */ 0x00000003L,
+/* 057c */ 0x740a0900L, /*		move	ssid & ssid_mask to sfbr */
+/* 0580 */ 0x00000000L,
+/* 0584 */ 0xc0000001L, /*		move	memory 1, targ, find_dsa_smc1 */
+/* 0588 */ 0x00000648L,
+/* 058c */ 0x00000590L,
+/* 0590 */ 0x808400ffL, /*		jump	find_dsa_next, if not 255 */
+/* 0594 */ 0x0000001cL,
+/* 0598 */ 0xc0000001L, /*		move	memory 1, lun, find_dsa_smc2 */
+/* 059c */ 0x0000064cL,
+/* 05a0 */ 0x000005acL,
+/* 05a4 */ 0x725c0000L, /*		move	scratchb0 to sfbr */
+/* 05a8 */ 0x00000000L,
+/* 05ac */ 0x808cf8ffL, /*		jump	reload_sync, if 255 and mask ~7 */
+/* 05b0 */ 0x00000034L,
+/* 05b4 */ 0xc0000004L, /*		move	memory 4, next, dsa */
+/* 05b8 */ 0x00000654L,
+/* 05bc */ 0x00000010L,
+/* 05c0 */ 0x80880000L, /*		jump	find_dsa_loop */
+/* 05c4 */ 0x00ffff88L,
+/* 05c8 */ 0x60000008L, /*		clear	atn */
+/* 05cc */ 0x00000000L,
+/* 05d0 */ 0x878b0000L, /*	        jump    msg_in_phase, when msg_in */
+/* 05d4 */ 0x00fffc2cL,
+/* 05d8 */ 0x98080000L, /*	        int     SIR_MSG_REJECT */
+/* 05dc */ 0x0000000aL,
+/* 05e0 */ 0x80880000L, /*	        jump    to_decisions */
+/* 05e4 */ 0x00000010L,
+/* 05e8 */ 0x88880000L, /*		call	load_sync */
+/* 05ec */ 0x000001b0L,
+/* 05f0 */ 0x60000040L, /*		clear	ack */
+/* 05f4 */ 0x00000000L,
+/* 05f8 */ 0x818b0000L, /*		jump	data_in_phase, when data_in */
+/* 05fc */ 0x00fffa58L,
+/* 0600 */ 0x828a0000L, /*		jump	cmd_phase, if cmd */
+/* 0604 */ 0x00fffa38L,
+/* 0608 */ 0x808a0000L, /*		jump	data_out_phase, if data_out */
+/* 060c */ 0x00fffb24L,
+/* 0610 */ 0x838a0000L, /*		jump	status_phase, if status */
+/* 0614 */ 0x00fffbdcL,
+/* 0618 */ 0x878a0000L, /*		jump	msg_in_phase, if msg_in */
+/* 061c */ 0x00fffbe4L,
+/* 0620 */ 0x98080000L, /*		int	error_unexpected_phase */
+/* 0624 */ 0x00000004L,
+/* 0628 */ 0x838b0000L, /*		jump	status_phase, when status */
+/* 062c */ 0x00fffbc4L,
+/* 0630 */ 0x878a0000L, /*		jump	msg_in_phase, if msg_in */
+/* 0634 */ 0x00fffbccL,
+/* 0638 */ 0x98080000L, /*		int	error_unexpected_phase */
+/* 063c */ 0x00000004L,
+/* 0640 */ 0x00000000L, /*	state:	defw	0 */
+/* 0644 */ 0x00000000L, /*	dmaaddr: defw	0 */
+/* 0648 */ 0x00000000L, /*	targ:	defw	0 */
+/* 064c */ 0x00000000L, /*	lun:	defw	0 */
+/* 0650 */ 0x00000000L, /*	sync:	defw	0 */
+/* 0654 */ 0x00000000L, /*	next:	defw	0 */
+			/*	dsa_load_len = dsa_load_end - dsa_copy */
+			/*	dsa_save_len = dsa_save_end - dsa_copy */
+/* 0658 */ 0x80880000L, /*		jump load_state_okay */
+/* 065c */ 0x000000acL,
+/* 0660 */ 0x72100000L, /*		move	dsa0 to sfbr */
+/* 0664 */ 0x00000000L,
+/* 0668 */ 0x80840000L, /*		jump load_state_okay, if not 0 */
+/* 066c */ 0x0000009cL,
+/* 0670 */ 0x72110000L, /*		move	dsa1 to sfbr */
+/* 0674 */ 0x00000000L,
+/* 0678 */ 0x80840000L, /*		jump load_state_okay, if not 0 */
+/* 067c */ 0x0000008cL,
+/* 0680 */ 0x72120000L, /*		move	dsa2 to sfbr */
+/* 0684 */ 0x00000000L,
+/* 0688 */ 0x80840000L, /*		jump load_state_okay, if not 0 */
+/* 068c */ 0x0000007cL,
+/* 0690 */ 0x72130000L, /*		move	dsa3 to sfbr */
+/* 0694 */ 0x00000000L,
+/* 0698 */ 0x80840000L, /*		jump load_state_okay, if not 0 */
+/* 069c */ 0x0000006cL,
+/* 06a0 */ 0xc0000004L, /*		move	memory 4, dsa, dmaaddr */
+/* 06a4 */ 0x00000010L,
+/* 06a8 */ 0x00000644L,
+/* 06ac */ 0xc0000004L, /*		move	memory 4, dsa, targ */
+/* 06b0 */ 0x00000010L,
+/* 06b4 */ 0x00000648L,
+/* 06b8 */ 0xc0000004L, /*		move	memory 4, dsa, lun */
+/* 06bc */ 0x00000010L,
+/* 06c0 */ 0x0000064cL,
+/* 06c4 */ 0xc0000004L, /*		move	memory 4, dsa, sync */
+/* 06c8 */ 0x00000010L,
+/* 06cc */ 0x00000650L,
+/* 06d0 */ 0xc0000004L, /*		move	memory 4, dsa, next */
+/* 06d4 */ 0x00000010L,
+/* 06d8 */ 0x00000654L,
+/* 06dc */ 0xc0000004L, /*		move	memory 4, dsa, scratcha */
+/* 06e0 */ 0x00000010L,
+/* 06e4 */ 0x00000034L,
+/* 06e8 */ 0x68080500L, /*		move	STATE_END to sfbr */
+/* 06ec */ 0x00000000L,
+/* 06f0 */ 0x6a340000L, /*		move	sfbr to scratcha0 */
+/* 06f4 */ 0x00000000L,
+/* 06f8 */ 0xc0000004L, /*		move	memory 4, scratcha, state */
+/* 06fc */ 0x00000034L,
+/* 0700 */ 0x00000640L,
+/* 0704 */ 0x90080000L, /*		return */
+/* 0708 */ 0x00000000L,
+/* 070c */ 0xc0000004L, /*		move	memory 4, dsa, load_state_smc0 + 4 */
+/* 0710 */ 0x00000010L,
+/* 0714 */ 0x0000071cL,
+/* 0718 */ 0xc0000018L, /*		move	memory dsa_load_len, 0, dsa_copy */
+/* 071c */ 0x00000000L,
+/* 0720 */ 0x00000640L,
+/* 0724 */ 0x90080000L, /*		return */
+/* 0728 */ 0x00000000L,
+/* 072c */ 0xc0000004L, /*		move	memory 4, dsa, save_state_smc0 + 8 */
+/* 0730 */ 0x00000010L,
+/* 0734 */ 0x00000740L,
+/* 0738 */ 0xc0000008L, /*		move	memory dsa_save_len, dsa_copy, 0 */
+/* 073c */ 0x00000640L,
+/* 0740 */ 0x00000000L,
+/* 0744 */ 0x90080000L, /*		return */
+/* 0748 */ 0x00000000L,
+/* 074c */ 0x721a0000L, /*		move	ctest2 to sfbr */
+/* 0750 */ 0x00000000L,
+/* 0754 */ 0xc0000004L, /*		move	memory 4, dsa_head, dsa */
+/* 0758 */ 0x00000008L,
+/* 075c */ 0x00000010L,
+/* 0760 */ 0x88880000L, /*	 	call	load_state */
+/* 0764 */ 0x00fffef0L,
+/* 0768 */ 0xc0000004L, /*		move	memory 4, state, scratcha */
+/* 076c */ 0x00000640L,
+/* 0770 */ 0x00000034L,
+/* 0774 */ 0x72340000L, /*		move	scratcha0 to sfbr */
+/* 0778 */ 0x00000000L,
+/* 077c */ 0x808c0002L, /*		jump	start, if STATE_ISSUE */
+/* 0780 */ 0x00fff884L,
+/* 0784 */ 0x808c0005L, /*		jump	wait_for_reselection, if STATE_END */
+/* 0788 */ 0x00fffd90L,
+/* 078c */ 0xc0000004L, /*		move	memory 4, next, dsa */
+/* 0790 */ 0x00000654L,
+/* 0794 */ 0x00000010L,
+/* 0798 */ 0x80880000L, /*		jump	issue_check_loop */
+/* 079c */ 0x00ffffc0L,
+/* 07a0 */ 0xc0000004L, /*		move	memory 4, sync, scratcha */
+/* 07a4 */ 0x00000650L,
+/* 07a8 */ 0x00000034L,
+/* 07ac */ 0x72340000L, /*		move	scratcha0 to sfbr */
+/* 07b0 */ 0x00000000L,
+/* 07b4 */ 0x6a030000L, /*		move	sfbr to scntl3 */
+/* 07b8 */ 0x00000000L,
+/* 07bc */ 0x72350000L, /*		move	scratcha1 to sfbr */
+/* 07c0 */ 0x00000000L,
+/* 07c4 */ 0x6a050000L, /*		move	sfbr to sxfer */
+/* 07c8 */ 0x00000000L,
+/* 07cc */ 0x90080000L, /*		return */
+/* 07d0 */ 0x00000000L,
+};
+
+#define NA_SCRIPT_SIZE 501
+
+struct na_patch na_patches[] = {
+	{ 0x0006, 5 }, /* 00000018 */
+	{ 0x000b, 4 }, /* 0000002c */
+	{ 0x0013, 4 }, /* 0000004c */
+	{ 0x0017, 1 }, /* 0000005c */
+	{ 0x0018, 2 }, /* 00000060 */
+	{ 0x001a, 1 }, /* 00000068 */
+	{ 0x001b, 2 }, /* 0000006c */
+	{ 0x0021, 1 }, /* 00000084 */
+	{ 0x002b, 2 }, /* 000000ac */
+	{ 0x002c, 1 }, /* 000000b0 */
+	{ 0x0030, 2 }, /* 000000c0 */
+	{ 0x0031, 1 }, /* 000000c4 */
+	{ 0x0037, 2 }, /* 000000dc */
+	{ 0x0038, 1 }, /* 000000e0 */
+	{ 0x003a, 2 }, /* 000000e8 */
+	{ 0x003b, 1 }, /* 000000ec */
+	{ 0x0043, 4 }, /* 0000010c */
+	{ 0x0047, 2 }, /* 0000011c */
+	{ 0x0048, 1 }, /* 00000120 */
+	{ 0x004e, 1 }, /* 00000138 */
+	{ 0x004f, 2 }, /* 0000013c */
+	{ 0x0051, 1 }, /* 00000144 */
+	{ 0x0052, 2 }, /* 00000148 */
+	{ 0x0058, 1 }, /* 00000160 */
+	{ 0x0059, 2 }, /* 00000164 */
+	{ 0x005b, 1 }, /* 0000016c */
+	{ 0x0065, 2 }, /* 00000194 */
+	{ 0x0066, 1 }, /* 00000198 */
+	{ 0x006a, 2 }, /* 000001a8 */
+	{ 0x006b, 1 }, /* 000001ac */
+	{ 0x0073, 4 }, /* 000001cc */
+	{ 0x0077, 2 }, /* 000001dc */
+	{ 0x0078, 1 }, /* 000001e0 */
+	{ 0x007e, 4 }, /* 000001f8 */
+	{ 0x0082, 2 }, /* 00000208 */
+	{ 0x0098, 1 }, /* 00000260 */
+	{ 0x0099, 2 }, /* 00000264 */
+	{ 0x009f, 2 }, /* 0000027c */
+	{ 0x00a0, 1 }, /* 00000280 */
+	{ 0x00b6, 2 }, /* 000002d8 */
+	{ 0x00c2, 2 }, /* 00000308 */
+	{ 0x00ca, 2 }, /* 00000328 */
+	{ 0x00d0, 2 }, /* 00000340 */
+	{ 0x00d6, 2 }, /* 00000358 */
+	{ 0x00e6, 2 }, /* 00000398 */
+	{ 0x00ec, 2 }, /* 000003b0 */
+	{ 0x0102, 2 }, /* 00000408 */
+	{ 0x010e, 2 }, /* 00000438 */
+	{ 0x011c, 4 }, /* 00000470 */
+	{ 0x0126, 2 }, /* 00000498 */
+	{ 0x0134, 1 }, /* 000004d0 */
+	{ 0x0135, 2 }, /* 000004d4 */
+	{ 0x0139, 2 }, /* 000004e4 */
+	{ 0x013a, 1 }, /* 000004e8 */
+	{ 0x014e, 2 }, /* 00000538 */
+	{ 0x0152, 4 }, /* 00000548 */
+	{ 0x0153, 2 }, /* 0000054c */
+	{ 0x0157, 1 }, /* 0000055c */
+	{ 0x0158, 2 }, /* 00000560 */
+	{ 0x015f, 3 }, /* 0000057c */
+	{ 0x0162, 1 }, /* 00000588 */
+	{ 0x0163, 1 }, /* 0000058c */
+	{ 0x0167, 1 }, /* 0000059c */
+	{ 0x0168, 1 }, /* 000005a0 */
+	{ 0x016e, 1 }, /* 000005b8 */
+	{ 0x016f, 2 }, /* 000005bc */
+	{ 0x01a9, 2 }, /* 000006a4 */
+	{ 0x01aa, 1 }, /* 000006a8 */
+	{ 0x01ac, 2 }, /* 000006b0 */
+	{ 0x01ad, 1 }, /* 000006b4 */
+	{ 0x01af, 2 }, /* 000006bc */
+	{ 0x01b0, 1 }, /* 000006c0 */
+	{ 0x01b2, 2 }, /* 000006c8 */
+	{ 0x01b3, 1 }, /* 000006cc */
+	{ 0x01b5, 2 }, /* 000006d4 */
+	{ 0x01b6, 1 }, /* 000006d8 */
+	{ 0x01b8, 2 }, /* 000006e0 */
+	{ 0x01b9, 2 }, /* 000006e4 */
+	{ 0x01bf, 2 }, /* 000006fc */
+	{ 0x01c0, 1 }, /* 00000700 */
+	{ 0x01c4, 2 }, /* 00000710 */
+	{ 0x01c5, 1 }, /* 00000714 */
+	{ 0x01c8, 1 }, /* 00000720 */
+	{ 0x01cc, 2 }, /* 00000730 */
+	{ 0x01cd, 1 }, /* 00000734 */
+	{ 0x01cf, 1 }, /* 0000073c */
+	{ 0x01d6, 4 }, /* 00000758 */
+	{ 0x01d7, 2 }, /* 0000075c */
+	{ 0x01db, 1 }, /* 0000076c */
+	{ 0x01dc, 2 }, /* 00000770 */
+	{ 0x01e4, 1 }, /* 00000790 */
+	{ 0x01e5, 2 }, /* 00000794 */
+	{ 0x01e9, 1 }, /* 000007a4 */
+	{ 0x01ea, 2 }, /* 000007a8 */
+};
+#define NA_PATCHES 94
+
+enum na_external {
+	X_scsi_id_buf,
+	X_msg_out_buf,
+	X_cmd_buf,
+	X_data_buf,
+	X_status_buf,
+	X_msgin_buf,
+	X_dsa_0,
+	X_dsa_1,
+	X_dsa_head,
+	X_ssid_mask,
+};
+
+enum {
+	E_issue_check_loop = 1888,
+	E_save_state_smc0 = 1848,
+	E_load_state_smc0 = 1816,
+	E_load_state_okay = 1804,
+	E_dsa_load_end = 1624,
+	E_sync = 1616,
+	E_dsa_save_end = 1608,
+	E_dsa_copy = 1600,
+	E_id_out_mismatch_recover = 1480,
+	E_next = 1620,
+	E_reload_sync = 1512,
+	E_find_dsa_smc2 = 1452,
+	E_lun = 1612,
+	E_find_dsa_smc1 = 1424,
+	E_targ = 1608,
+	E_find_dsa_next = 1460,
+	E_load_state = 1624,
+	E_find_dsa_loop = 1360,
+	E_find_dsa = 1348,
+	E_sigp_set = 1868,
+	E_reselected = 1316,
+	E_wsr_check = 1268,
+	E_response_msg_in = 1172,
+	E_response_repeat = 1132,
+	E_response = 1108,
+	E_reject = 988,
+	E_wdtr = 964,
+	E_sdtr = 876,
+	E_ext_done = 988,
+	E_ext_1 = 756,
+	E_ext_2 = 900,
+	E_ext_3 = 788,
+	E_issue_check = 1876,
+	E_extended = 708,
+	E_ignore_wide = 1060,
+	E_msg_in_skip = 692,
+	E_disconnected = 1204,
+	E_msg_in_not_reject = 532,
+	E_rejected = 668,
+	E_msg_in_phase = 516,
+	E_status_phase = 500,
+	E_data_out_mismatch = 464,
+	E_data_out_block_mismatch = 368,
+	E_data_out_normal = 440,
+	E_data_out_block_loop = 332,
+	E_data_out_phase = 308,
+	E_post_data_to_decisions = 1576,
+	E_data_in_mismatch = 272,
+	E_data_mismatch_recover = 228,
+	E_data_block_mismatch_recover = 216,
+	E_save_state = 1836,
+	E_data_in_block_mismatch = 136,
+	E_data_in_normal = 248,
+	E_data_in_block_loop = 112,
+	E_dmaaddr = 1604,
+	E_state = 1600,
+	E_data_in_phase = 88,
+	E_cmd_out_mismatch = 80,
+	E_cmd_phase = 64,
+	E_to_decisions = 1528,
+	E_id_out_mismatch = 48,
+	E_start1 = 40,
+	E_reselected_on_select = 1292,
+	E_load_sync = 1952,
+	E_start = 8,
+	E_wait_for_reselection = 1308,
+};
+#define A_dsa_save_len 8
+#define A_dsa_load_len 24
+#define A_BSIZE 512
+#define A_MSG_REJECT 7
+#define A_X_MSG_WDTR 3
+#define A_X_MSG_SDTR 1
+#define A_X_MSG 1
+#define A_MSG_IGNORE_WIDE_RESIDUE 35
+#define A_MSG_RESTORE_POINTERS 3
+#define A_MSG_SAVE_DATA_POINTER 2
+#define A_MSG_DISCONNECT 4
+#define A_MSG_IDENTIFY 128
+#define A_RESULT_OK 0
+#define A_STATE_END 5
+#define A_STATE_DONE 4
+#define A_STATE_DISCONNECTED 3
+#define A_STATE_ISSUE 2
+#define A_STATE_ALLOCATED 1
+#define A_STATE_FREE 0
+#define A_SIR_NOTIFY_LOAD_STATE 118
+#define A_SIR_NOTIFY_RESELECTED_ON_SELECT 117
+#define A_SIR_NOTIFY_LOAD_SYNC 116
+#define A_SIR_NOTIFY_WSR 115
+#define A_SIR_NOTIFY_BLOCK_DATA_IN 114
+#define A_SIR_NOTIFY_DATA_OUT 113
+#define A_SIR_NOTIFY_DATA_IN 112
+#define A_SIR_NOTIFY_COMMAND 111
+#define A_SIR_NOTIFY_DUMP_NEXT_CODE 110
+#define A_SIR_NOTIFY_ISSUE_CHECK 109
+#define A_SIR_NOTIFY_WAIT_RESELECT 108
+#define A_SIR_NOTIFY_ISSUE 107
+#define A_SIR_NOTIFY_SIGP 106
+#define A_SIR_NOTIFY_DUMP2 105
+#define A_SIR_NOTIFY_DUMP 104
+#define A_SIR_NOTIFY_STATUS 103
+#define A_SIR_NOTIFY_MSG_IN 102
+#define A_SIR_NOTIFY_RESELECT 101
+#define A_SIR_NOTIFY_DISC 100
+#define A_SIR_MSG_IGNORE_WIDE_RESIDUE 16
+#define A_SIR_MSG_WDTR 15
+#define A_SIR_EV_PHASE_SWITCH_AFTER_ID 14
+#define A_error_sigp_set 13
+#define A_SIR_EV_RESPONSE_OK 12
+#define A_SIR_MSG_SDTR 11
+#define A_SIR_MSG_REJECT 10
+#define A_error_too_little_data 9
+#define A_error_too_much_data 8
+#define A_error_not_identify_after_reselect 7
+#define A_SIR_ERROR_NOT_MSG_IN_AFTER_RESELECT 6
+#define A_error_weird_message 5
+#define A_error_unexpected_phase 4
+#define A_error_reselected 3
+#define A_error_disconnected 2
+#define A_error_not_cmd_complete 1
+#define A_SIR_MSG_IO_COMPLETE 0

+ 8 - 2
sys/src/9/bitsy/clock.c

@@ -42,7 +42,7 @@ static int clockinited;
 
 static void	clockintr(Ureg*, void*);
 static void	rtcintr(Ureg*, void*);
-static uvlong	when;	/* scheduled time of next interrupt */
+static Tval	when;	/* scheduled time of next interrupt */
 
 long	timeradjust;
 
@@ -138,8 +138,14 @@ fastticks(uvlong *hz)
 	return high+x;
 }
 
+ulong
+µs(void)
+{
+	return fastticks2us(fastticks(nil));
+}
+
 void
-timerset(uvlong v)
+timerset(Tval v)
 {
 	ulong next, tics;	/* Must be unsigned! */
 	static int count;

+ 1 - 0
sys/src/9/bitsy/dat.h

@@ -20,6 +20,7 @@ typedef struct Proc		Proc;
 typedef struct Uart		Uart;
 typedef struct Ureg		Ureg;
 typedef struct Vctl		Vctl;
+typedef long		Tval;
 
 #pragma incomplete Ureg
 

+ 1 - 2
sys/src/9/bitsy/fns.h

@@ -100,8 +100,7 @@ uchar*	tarlookup(uchar*, char*, int*);
 void	timersinit(void);
 void	timeradd(Timer*);
 void	timerdel(Timer*);
-void	timerintr(Ureg *, uvlong);
-void	timerset(uvlong);
+void	timerset(Tval);
 void	touser(void*);
 void	trapdump(char *tag);
 void	trapinit(void);

+ 1 - 0
sys/src/9/bitsy/mkfile

@@ -59,6 +59,7 @@ LIB=\
 	/$objtype/lib/libmemlayer.a\
 	/$objtype/lib/libmemdraw.a\
 	/$objtype/lib/libdraw.a\
+	/$objtype/lib/libip.a\
 	/$objtype/lib/libc.a\
 	/$objtype/lib/libsec.a\
 	/$objtype/lib/libip.a\

+ 7 - 3
sys/src/9/ip/arp.c

@@ -48,6 +48,7 @@ char *Ebadarp = "bad arp";
 #define haship(s) ((s)[IPaddrlen-1]%NHASH)
 
 extern int 	ReTransTimer = RETRANS_TIMER;
+
 static void 	rxmitproc(void *v);
 
 void
@@ -446,7 +447,8 @@ arpwrite(Fs *fs, char *s, int len)
 		default:
 			error(Ebadarg);
 		case 3:
-			parseip(ip, f[1]);
+			if (parseip(ip, f[1]) == -1)
+				error(Ebadip);
 			if(isv4(ip))
 				r = v4lookup(fs, ip+IPv4off, nil);
 			else
@@ -460,7 +462,8 @@ arpwrite(Fs *fs, char *s, int len)
 			m = ipfindmedium(f[1]);
 			if(m == nil)
 				error(Ebadarp);
-			parseip(ip, f[2]);
+			if (parseip(ip, f[2]) == -1)
+				error(Ebadip);
 			n = parsemac(mac, f[3], m->maclen);
 			break;
 		}
@@ -473,7 +476,8 @@ arpwrite(Fs *fs, char *s, int len)
 		if(n != 2)
 			error(Ebadarg);
 
-		parseip(ip, f[1]);
+		if (parseip(ip, f[1]) == -1)
+			error(Ebadip);
 		qlock(arp);
 
 		l = &arp->hash[haship(ip)];

+ 11 - 6
sys/src/9/ip/devip.c

@@ -851,7 +851,8 @@ setladdrport(Conv* c, char* str, int announcing)
 		if(strcmp(str, "*") == 0)
 			ipmove(c->laddr, IPnoaddr);
 		else {
-			parseip(addr, str);
+			if(parseip(addr, str) == -1)
+				return Ebadip;
 			if(ipforme(c->p->f, addr))
 				ipmove(c->laddr, addr);
 			else
@@ -883,7 +884,8 @@ setraddrport(Conv* c, char* str)
 	if(p == nil)
 		return "malformed address";
 	*p++ = 0;
-	parseip(c->raddr, str);
+	if (parseip(c->raddr, str) == -1)
+		return Ebadip;
 	c->rport = atoi(p);
 	p = strchr(p, '!');
 	if(p){
@@ -1132,13 +1134,15 @@ ipwrite(Chan* ch, void *v, long n, vlong off)
 			if(cb->nf == 2){
 				if(!ipismulticast(c->raddr))
 					error("addmulti for a non multicast address");
-				parseip(ia, cb->f[1]);
+				if (parseip(ia, cb->f[1]) == -1)
+					error(Ebadip);
 				ipifcaddmulti(c, c->raddr, ia);
 			} else {
-				parseip(ma, cb->f[2]);
+				if (parseip(ia, cb->f[1]) == -1 ||
+				    parseip(ma, cb->f[2]) == -1)
+					error(Ebadip);
 				if(!ipismulticast(ma))
 					error("addmulti for a non multicast address");
-				parseip(ia, cb->f[1]);
 				ipifcaddmulti(c, ma, ia);
 			}
 		} else if(strcmp(cb->f[0], "remmulti") == 0){
@@ -1146,7 +1150,8 @@ ipwrite(Chan* ch, void *v, long n, vlong off)
 				error("remmulti needs interface address");
 			if(!ipismulticast(c->raddr))
 				error("remmulti for a non multicast address");
-			parseip(ia, cb->f[1]);
+			if (parseip(ia, cb->f[1]) == -1)
+				error(Ebadip);
 			ipifcremmulti(c, c->raddr, ia);
 		} else if(x->ctl != nil) {
 			p = x->ctl(c, cb->f, cb->nf);

+ 2 - 2
sys/src/9/ip/ip.h

@@ -564,8 +564,8 @@ extern void	arpenter(Fs*, int version, uchar *ip, uchar *mac, int len, int noref
  */
 
 extern int	myetheraddr(uchar*, char*);
-extern ulong	parseip(uchar*, char*);
-extern ulong	parseipmask(uchar*, char*);
+extern vlong	parseip(uchar*, char*);
+extern vlong	parseipmask(uchar*, char*);
 extern char*	v4parseip(uchar*, char*);
 extern void	maskip(uchar *from, uchar *mask, uchar *to);
 extern int	parsemac(uchar *to, char *from, int len);

+ 0 - 340
sys/src/9/ip/ipaux.c

@@ -7,46 +7,6 @@
 #include	"ip.h"
 #include	"ipv6.h"
 
-/*
- *  well known IP addresses
- */
-uchar IPv4bcast[IPaddrlen] = {
-	0, 0, 0, 0,
-	0, 0, 0, 0,
-	0, 0, 0xff, 0xff,
-	0xff, 0xff, 0xff, 0xff
-};
-uchar IPv4allsys[IPaddrlen] = {
-	0, 0, 0, 0,
-	0, 0, 0, 0,
-	0, 0, 0xff, 0xff,
-	0xe0, 0, 0, 0x01
-};
-uchar IPv4allrouter[IPaddrlen] = {
-	0, 0, 0, 0,
-	0, 0, 0, 0,
-	0, 0, 0xff, 0xff,
-	0xe0, 0, 0, 0x02
-};
-uchar IPallbits[IPaddrlen] = {
-	0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff, 0xff, 0xff
-};
-
-uchar IPnoaddr[IPaddrlen];
-
-/*
- *  prefix of all v4 addresses
- */
-uchar v4prefix[IPaddrlen] = {
-	0, 0, 0, 0,
-	0, 0, 0, 0,
-	0, 0, 0xff, 0xff,
-	0, 0, 0, 0
-};
-
 char *v6hdrtypes[Maxhdrtype] =
 {
 	[HBH]		"HopbyHop",
@@ -231,308 +191,8 @@ enum
 	Isprefix= 16,
 };
 
-static uchar prefixvals[256] =
-{
-[0x00] 0 | Isprefix,
-[0x80] 1 | Isprefix,
-[0xC0] 2 | Isprefix,
-[0xE0] 3 | Isprefix,
-[0xF0] 4 | Isprefix,
-[0xF8] 5 | Isprefix,
-[0xFC] 6 | Isprefix,
-[0xFE] 7 | Isprefix,
-[0xFF] 8 | Isprefix,
-};
-
-int
-eipfmt(Fmt *f)
-{
-	char buf[5*8];
-	static char *efmt = "%.2lux%.2lux%.2lux%.2lux%.2lux%.2lux";
-	static char *ifmt = "%d.%d.%d.%d";
-	uchar *p, ip[16];
-	ulong *lp;
-	ushort s;
-	int i, j, n, eln, eli;
-
-	switch(f->r) {
-	case 'E':		/* Ethernet address */
-		p = va_arg(f->args, uchar*);
-		snprint(buf, sizeof buf, efmt, p[0], p[1], p[2], p[3], p[4], p[5]);
-		return fmtstrcpy(f, buf);
-
-	case 'I':		/* Ip address */
-		p = va_arg(f->args, uchar*);
-common:
-		if(memcmp(p, v4prefix, 12) == 0){
-			snprint(buf, sizeof buf, ifmt, p[12], p[13], p[14], p[15]);
-			return fmtstrcpy(f, buf);
-		}
-
-		/* find longest elision */
-		eln = eli = -1;
-		for(i = 0; i < 16; i += 2){
-			for(j = i; j < 16; j += 2)
-				if(p[j] != 0 || p[j+1] != 0)
-					break;
-			if(j > i && j - i > eln){
-				eli = i;
-				eln = j - i;
-			}
-		}
-
-		/* print with possible elision */
-		n = 0;
-		for(i = 0; i < 16; i += 2){
-			if(i == eli){
-				n += sprint(buf+n, "::");
-				i += eln;
-				if(i >= 16)
-					break;
-			} else if(i != 0)
-				n += sprint(buf+n, ":");
-			s = (p[i]<<8) + p[i+1];
-			n += sprint(buf+n, "%ux", s);
-		}
-		return fmtstrcpy(f, buf);
-
-	case 'i':		/* v6 address as 4 longs */
-		lp = va_arg(f->args, ulong*);
-		for(i = 0; i < 4; i++)
-			hnputl(ip+4*i, *lp++);
-		p = ip;
-		goto common;
-
-	case 'V':		/* v4 ip address */
-		p = va_arg(f->args, uchar*);
-		snprint(buf, sizeof buf, ifmt, p[0], p[1], p[2], p[3]);
-		return fmtstrcpy(f, buf);
-
-	case 'M':		/* ip mask */
-		p = va_arg(f->args, uchar*);
-
-		/* look for a prefix mask */
-		for(i = 0; i < 16; i++)
-			if(p[i] != 0xff)
-				break;
-		if(i < 16){
-			if((prefixvals[p[i]] & Isprefix) == 0)
-				goto common;
-			for(j = i+1; j < 16; j++)
-				if(p[j] != 0)
-					goto common;
-			n = 8*i + (prefixvals[p[i]] & ~Isprefix);
-		} else
-			n = 8*16;
-
-		/* got one, use /xx format */
-		snprint(buf, sizeof buf, "/%d", n);
-		return fmtstrcpy(f, buf);
-	}
-	return fmtstrcpy(f, "(eipfmt)");
-}
-
 #define CLASS(p) ((*(uchar*)(p))>>6)
 
-extern char*
-v4parseip(uchar *to, char *from)
-{
-	int i;
-	char *p;
-
-	p = from;
-	for(i = 0; i < 4 && *p; i++){
-		to[i] = strtoul(p, &p, 0);
-		if(*p == '.')
-			p++;
-	}
-	switch(CLASS(to)){
-	case 0:	/* class A - 1 uchar net */
-	case 1:
-		if(i == 3){
-			to[3] = to[2];
-			to[2] = to[1];
-			to[1] = 0;
-		} else if(i == 2){
-			to[3] = to[1];
-			to[1] = 0;
-		}
-		break;
-	case 2:	/* class B - 2 uchar net */
-		if(i == 3){
-			to[3] = to[2];
-			to[2] = 0;
-		}
-		break;
-	}
-	return p;
-}
-
-int
-isv4(uchar *ip)
-{
-	return memcmp(ip, v4prefix, IPv4off) == 0;
-}
-
-
-/*
- *  the following routines are unrolled with no memset's to speed
- *  up the usual case
- */
-void
-v4tov6(uchar *v6, uchar *v4)
-{
-	v6[0] = 0;
-	v6[1] = 0;
-	v6[2] = 0;
-	v6[3] = 0;
-	v6[4] = 0;
-	v6[5] = 0;
-	v6[6] = 0;
-	v6[7] = 0;
-	v6[8] = 0;
-	v6[9] = 0;
-	v6[10] = 0xff;
-	v6[11] = 0xff;
-	v6[12] = v4[0];
-	v6[13] = v4[1];
-	v6[14] = v4[2];
-	v6[15] = v4[3];
-}
-
-int
-v6tov4(uchar *v4, uchar *v6)
-{
-	if(v6[0] == 0
-	&& v6[1] == 0
-	&& v6[2] == 0
-	&& v6[3] == 0
-	&& v6[4] == 0
-	&& v6[5] == 0
-	&& v6[6] == 0
-	&& v6[7] == 0
-	&& v6[8] == 0
-	&& v6[9] == 0
-	&& v6[10] == 0xff
-	&& v6[11] == 0xff)
-	{
-		v4[0] = v6[12];
-		v4[1] = v6[13];
-		v4[2] = v6[14];
-		v4[3] = v6[15];
-		return 0;
-	} else {
-		memset(v4, 0, 4);
-		return -1;
-	}
-}
-
-ulong
-parseip(uchar *to, char *from)
-{
-	int i, elipsis = 0, v4 = 1;
-	ulong x;
-	char *p, *op;
-
-	memset(to, 0, IPaddrlen);
-	p = from;
-	for(i = 0; i < 16 && *p; i+=2){
-		op = p;
-		x = strtoul(p, &p, 16);
-		if(*p == '.' || (*p == 0 && i == 0)){
-			p = v4parseip(to+i, op);
-			i += 4;
-			break;
-		} else {
-			to[i] = x>>8;
-			to[i+1] = x;
-		}
-		if(*p == ':'){
-			v4 = 0;
-			if(*++p == ':'){
-				elipsis = i+2;
-				p++;
-			}
-		}
-	}
-	if(i < 16){
-		memmove(&to[elipsis+16-i], &to[elipsis], i-elipsis);
-		memset(&to[elipsis], 0, 16-i);
-	}
-	if(v4){
-		to[10] = to[11] = 0xff;
-		return nhgetl(to+12);
-	} else
-		return 6;
-}
-
-/*
- *  hack to allow ip v4 masks to be entered in the old
- *  style
- */
-ulong
-parseipmask(uchar *to, char *from)
-{
-	ulong x;
-	int i;
-	uchar *p;
-
-	if(*from == '/'){
-		/* as a number of prefix bits */
-		i = atoi(from+1);
-		if(i < 0)
-			i = 0;
-		if(i > 128)
-			i = 128;
-		memset(to, 0, IPaddrlen);
-		for(p = to; i >= 8; i -= 8)
-			*p++ = 0xff;
-		if(i > 0)
-			*p = ~((1<<(8-i))-1);
-		x = nhgetl(to+IPv4off);
-	} else {
-		/* as a straight bit mask */
-		x = parseip(to, from);
-		if(memcmp(to, v4prefix, IPv4off) == 0)
-			memset(to, 0xff, IPv4off);
-	}
-	return x;
-}
-
-void
-maskip(uchar *from, uchar *mask, uchar *to)
-{
-	int i;
-
-	for(i = 0; i < IPaddrlen; i++)
-		to[i] = from[i] & mask[i];
-}
-
-uchar classmask[4][16] = {
-	0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0x00,0x00,0x00,
-	0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0x00,0x00,0x00,
-	0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0x00,0x00,
-	0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x00,
-};
-
-uchar*
-defmask(uchar *ip)
-{
-	if(isv4(ip))
-		return classmask[ip[IPv4off]>>6];
-	else {
-		if(ipcmp(ip, v6loopback) == 0)
-			return IPallbits;
-		else if(memcmp(ip, v6linklocal, v6llpreflen) == 0)
-			return v6linklocalmask;
-		else if(memcmp(ip, v6solicitednode, v6snpreflen) == 0)
-			return v6solicitednodemask;
-		else if(memcmp(ip, v6multicast, v6mcpreflen) == 0)
-			return v6multicastmask;
-		return IPallbits;
-	}
-}
-
 void
 ipv62smcast(uchar *smcast, uchar *a)
 {

+ 10 - 6
sys/src/9/ip/ipifc.c

@@ -390,19 +390,21 @@ ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp)
 			ifc->maxtu = mtu;
 		/* fall through */
 	case 4:
-		parseip(ip, argv[1]);
+		if (parseip(ip, argv[1]) == -1 || parseip(rem, argv[3]) == -1)
+			return Ebadip;
 		parseipmask(mask, argv[2]);
-		parseip(rem, argv[3]);
 		maskip(rem, mask, net);
 		break;
 	case 3:
-		parseip(ip, argv[1]);
+		if (parseip(ip, argv[1]) == -1)
+			return Ebadip;
 		parseipmask(mask, argv[2]);
 		maskip(ip, mask, rem);
 		maskip(rem, mask, net);
 		break;
 	case 2:
-		parseip(ip, argv[1]);
+		if (parseip(ip, argv[1]) == -1)
+			return Ebadip;
 		memmove(mask, defmask(ip), IPaddrlen);
 		maskip(ip, mask, rem);
 		maskip(rem, mask, net);
@@ -590,12 +592,14 @@ ipifcrem(Ipifc *ifc, char **argv, int argc)
 	if(argc < 3)
 		return Ebadarg;
 
-	parseip(ip, argv[1]);
+	if (parseip(ip, argv[1]) == -1)
+		return Ebadip;
 	parseipmask(mask, argv[2]);
 	if(argc < 4)
 		maskip(ip, mask, rem);
 	else
-		parseip(rem, argv[3]);
+		if (parseip(rem, argv[3]) == -1)
+			return Ebadip;
 
 	wlock(ifc);
 

+ 10 - 8
sys/src/9/ip/iproute.c

@@ -12,10 +12,10 @@ static void	addnode(Fs*, Route**, Route*);
 static void	calcd(Route*);
 
 /* these are used for all instances of IP */
-Route*	v4freelist;
-Route*	v6freelist;
-RWlock	routelock;
-ulong	v4routegeneration, v6routegeneration;
+static Route*	v4freelist;
+static Route*	v6freelist;
+static RWlock	routelock;
+static ulong	v4routegeneration, v6routegeneration;
 
 static void
 freeroute(Route *r)
@@ -617,7 +617,7 @@ routetype(int type, char *p)
 		*p = 'p';
 }
 
-char *rformat = "%-15I %-4M %-15I %4.4s %4.4s %3s\n";
+static char *rformat = "%-15I %-4M %-15I %4.4s %4.4s %3s\n";
 
 void
 convroute(Route *r, uchar *addr, uchar *mask, uchar *gate, char *t, int *nifc)
@@ -815,7 +815,8 @@ routewrite(Fs *f, Chan *c, char *p, int n)
 	} else if(strcmp(cb->f[0], "remove") == 0){
 		if(cb->nf < 3)
 			error(Ebadarg);
-		parseip(addr, cb->f[1]);
+		if (parseip(addr, cb->f[1]) == -1)
+			error(Ebadip);
 		parseipmask(mask, cb->f[2]);
 		if(memcmp(addr, v4prefix, IPv4off) == 0)
 			v4delroute(f, addr+IPv4off, mask+IPv4off, 1);
@@ -824,9 +825,10 @@ routewrite(Fs *f, Chan *c, char *p, int n)
 	} else if(strcmp(cb->f[0], "add") == 0){
 		if(cb->nf < 4)
 			error(Ebadarg);
-		parseip(addr, cb->f[1]);
+		if(parseip(addr, cb->f[1]) == -1 ||
+		    parseip(gate, cb->f[3]) == -1)
+			error(Ebadip);
 		parseipmask(mask, cb->f[2]);
-		parseip(gate, cb->f[3]);
 		tag = "none";
 		if(c != nil){
 			a = c->aux;

+ 2 - 1
sys/src/9/ip/rudp.c

@@ -607,7 +607,8 @@ rudpctl(Conv *c, char **f, int n)
 	} else if(strcmp(f[0], "hangup") == 0){
 		if(n < 3)
 			return "bad syntax";
-		parseip(ip, f[1]);
+		if (parseip(ip, f[1]) == -1)
+			return Ebadip;
 		x = atoi(f[2]);
 		qlock(ucb);
 		relforget(c, ip, x, 1);

+ 7 - 1
sys/src/9/mtx/clock.c

@@ -58,7 +58,7 @@ clockintr(Ureg *ureg)
 }
 
 void
-timerset(uvlong)
+timerset(Tval)
 {
 }
 
@@ -95,6 +95,12 @@ fastticks(uvlong *hz)
 	return m->ticks;
 }
 
+ulong
+µs(void)
+{
+	return fastticks2us(m->ticks);
+}
+
 /*  
  *  performance measurement ticks.  must be low overhead.
  *  doesn't have to count over a second.

+ 1 - 0
sys/src/9/mtx/mkfile

@@ -58,6 +58,7 @@ LIB=\
 	/$objtype/lib/libmemlayer.a\
 	/$objtype/lib/libmemdraw.a\
 	/$objtype/lib/libdraw.a\
+	/$objtype/lib/libip.a\
 	/$objtype/lib/libc.a\
 	/$objtype/lib/libsec.a\
 

+ 1 - 0
sys/src/9/mtx/mtx

@@ -37,6 +37,7 @@ port
 	int cpuserver = 0;
 
 boot
+	tcp
 
 bootdir
 	bootmtx.out boot

+ 1 - 0
sys/src/9/mtx/mtxcpu

@@ -37,6 +37,7 @@ port
 	int cpuserver = 1;
 
 boot cpu
+	tcp
 
 bootdir
 	bootmtxcpu.out boot

+ 1 - 1
sys/src/9/pc/devarch.c

@@ -986,7 +986,7 @@ ulong
  *  set next timer interrupt
  */
 void
-timerset(uvlong x)
+timerset(Tval x)
 {
 	if(doi8253set)
 		(*arch->timerset)(x);

+ 3 - 3
sys/src/9/pc/devusb.c

@@ -454,13 +454,13 @@ usbreset(void)
 	int cardno, ctlrno;
 	Usbhost *uh;
 
+	if(getconf("*nousbprobe"))
+		return;
+
 	for(ctlrno = 0; ctlrno < MaxUsb; ctlrno++)
 		if((uh = usbprobe(-1, ctlrno)) != nil)
 			usbhost[ctlrno] = uh;
 
-	if(getconf("*nousbprobe"))
-		return;
-
 	cardno = ctlrno = 0;
 	while(usbtypes[cardno].type != nil && ctlrno < MaxUsb){
 		if(usbhost[ctlrno] != nil){

+ 7 - 1
sys/src/9/pc/etherigbe.c

@@ -1193,7 +1193,7 @@ igbeattach(Ether* edev)
 	ctlr = edev->ctlr;
 	ctlr->edev = edev;			/* point back to Ether* */
 	qlock(&ctlr->alock);
-	if(ctlr->alloc != nil){
+	if(ctlr->alloc != nil){			/* already allocated? */
 		qunlock(&ctlr->alock);
 		return;
 	}
@@ -1202,6 +1202,7 @@ igbeattach(Ether* edev)
 	ctlr->ntd = ROUND(Ntd, 8);
 	ctlr->alloc = malloc(ctlr->nrd*sizeof(Rd)+ctlr->ntd*sizeof(Td) + 127);
 	if(ctlr->alloc == nil){
+		print("igbe: can't allocate ctlr->alloc\n");
 		qunlock(&ctlr->alock);
 		return;
 	}
@@ -1210,6 +1211,11 @@ igbeattach(Ether* edev)
 
 	ctlr->rb = malloc(ctlr->nrd*sizeof(Block*));
 	ctlr->tb = malloc(ctlr->ntd*sizeof(Block*));
+	if (ctlr->rb == nil || ctlr->tb == nil) {
+		print("igbe: can't allocate ctlr->rb or ctlr->tb\n");
+		qunlock(&ctlr->alock);
+		return;
+	}
 
 	if(waserror()){
 		while(ctlr->nrb > 0){

+ 4 - 0
sys/src/9/pc/mkfile

@@ -65,8 +65,10 @@ LIB=\
 	/$objtype/lib/libmemlayer.a\
 	/$objtype/lib/libmemdraw.a\
 	/$objtype/lib/libdraw.a\
+	/$objtype/lib/libip.a\
 	/$objtype/lib/libc.a\
 	/$objtype/lib/libsec.a\
+	/$objtype/lib/libmp.a\
 
 ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'}
 VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'}
@@ -108,12 +110,14 @@ apic.$O archmp.$O mp.$O:	mp.h
 $SDEV:				../port/sd.h
 sd53c8xx.$O:			sd53c8xx.i
 sdiahci.$O:			ahci.h
+devaoe.$O sdaoe.$O:		../port/aoe.h
 main.$O:			init.h reboot.h
 wavelan.$O:			wavelan.c ../pc/wavelan.c ../pc/wavelan.h
 etherwavelan.$O:		etherwavelan.c ../pc/wavelan.h
 devusb.$O usbuhci.$O usbohci.$O: usb.h
 trap.$O:			/sys/include/tos.h
 uartaxp.$O:			uartaxp.i
+etherm10g.$O:			etherm10g2k.i etherm10g4k.i
 
 init.h:		../port/initcode.c init9.c
 	$CC ../port/initcode.c

+ 3 - 0
sys/src/9/pc/pc

@@ -24,6 +24,7 @@ dev
 	mouse		mouse
 	vga
 	kbmap
+	kbin
 
 	sd
 	floppy		dma
@@ -63,10 +64,12 @@ link
 	etherwavelan	wavelan devi82365 cis pci
 	ethermedium
 #	etherm10g
+	ether82598	pci
 	pcmciamodem
 	netdevmedium
 	loopbackmedium
 	usbuhci
+	usbohci
 
 misc
 	archmp		mp apic

+ 2 - 1
sys/src/9/pc/pcauth

@@ -1,3 +1,4 @@
+# pcauth - pc kernel for our auth servers
 dev
 	root
 	cons
@@ -69,4 +70,4 @@ bootdir
 	/386/bin/auth/factotum
 	/386/bin/fossil/fossil
 	/386/bin/venti/venti
-	/386/bin/disk/kfs
+#	/386/bin/disk/kfs

+ 6 - 2
sys/src/9/pc/pccpu

@@ -17,12 +17,14 @@ dev
 	cap
 	kprof
 	fs
+	segment
 
 	ether		netif
 	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno
 
 	sd
 	floppy		dma
+	aoe
 
 	uart
 	usb
@@ -45,12 +47,13 @@ link
 	etherigbe	pci ethermii
 	ethervgbe	pci ethermii
 	ethervt6102	pci ethermii
-#	etherm10g	pci
+#	etherm10g	pci ethermii
+	ether82598	pci
 	ethersink
 	ethermedium
 	loopbackmedium
-# perhaps this is causing panics
 	usbuhci
+	usbohci
 
 misc
 	archmp		mp apic
@@ -64,6 +67,7 @@ misc
 	sdmv50xx	pci sdscsi
 	sdmylex		pci sdscsi
 	sdiahci		pci sdscsi
+	sdaoe		sdscsi
 
 ip
 	tcp

+ 3 - 2
sys/src/9/pc/pccpuf

@@ -1,3 +1,4 @@
+# pccpuf - pc cpu server with fossil root and maybe venti block store
 dev
 	root
 	cons
@@ -62,6 +63,7 @@ link
 	netdevmedium
 	loopbackmedium
 	usbuhci
+	usbohci
 
 misc
 	archmp		mp apic
@@ -98,7 +100,6 @@ misc
 	vgavesa
 	vgavmware	+cur
 
-
 ip
 	tcp
 	udp
@@ -121,6 +122,6 @@ bootdir
 	bootpccpuf.out boot
 	/386/bin/ip/ipconfig
 	/386/bin/auth/factotum
-	/386/bin/disk/kfs
+#	/386/bin/disk/kfs
 	/386/bin/fossil/fossil
 	/386/bin/venti/venti

+ 3 - 0
sys/src/9/pc/pcdisk

@@ -1,3 +1,4 @@
+# pcdisk - pc terminal with kfs or cfs root
 dev
 	root
 	cons
@@ -22,6 +23,8 @@ dev
 	draw		screen vga vgax
 	mouse		mouse
 	vga
+	kbmap
+	kbin
 
 	sd
 	floppy		dma

+ 2 - 1
sys/src/9/pc/pcf

@@ -1,3 +1,4 @@
+# pcf - pc terminal with fossil root and maybe venti block store
 dev
 	root
 	cons
@@ -121,6 +122,6 @@ bootdir
 	bootpcf.out boot
 	/386/bin/ip/ipconfig
 	/386/bin/auth/factotum
-	/386/bin/disk/kfs
+#	/386/bin/disk/kfs
 	/386/bin/fossil/fossil
 	/386/bin/venti/venti

+ 26 - 19
sys/src/9/pc/sdmv50xx.c

@@ -17,19 +17,21 @@
 #include "io.h"
 #include "../port/error.h"
 
-#include	"../port/sd.h"
+#include "../port/sd.h"
 
 #define dprint if(!0){}else iprint
 #define idprint if(!0){}else iprint
 #define ioprint if(!0){}else iprint
 
-enum{
+enum {
 	NCtlr		= 4,
 	NCtlrdrv	= 8,
 	NDrive		= NCtlr*NCtlrdrv,
 
 	Read 		= 0,
 	Write,
+
+	Coraiddebug	= 0,
 };
 
 enum {
@@ -160,7 +162,7 @@ struct Chip
 	Edma	*edma;
 };
 
-enum{
+enum {
 	DMautoneg,
 	DMsatai,
 	DMsataii,
@@ -356,7 +358,7 @@ struct Rx				/* command response block */
 };
 
 static Drive 	*mvsatadrive[NDrive];
-static int		nmvsatadrive;
+static int	nmvsatadrive;
 
 /*
  * Little-endian parsing for drive data.
@@ -1481,10 +1483,10 @@ rdregs(char *p, char *e, void *base, Regs *r, int n, char *prefix)
 {
 	int i;
 
-	for(i=0; i<n; i++)
-		p = seprint(p, e, "%s%s%-19s %.8ux\n",
-			prefix ? prefix : "", prefix ? ": " : "",
-			r[i].name, *(ulong *)((uchar*)base+r[i].offset));
+	for(i = 0; i < n; i++)
+		p = seprint(p, e, "%s%s%-19s %.8lux\n",
+			prefix? prefix: "", prefix? ": ": "",
+			r[i].name, *(ulong *)((uchar*)base + r[i].offset));
 	return p;
 }
 
@@ -1494,12 +1496,9 @@ rdinfo(char *p, char *e, ushort *info)
 	int i;
 
 	p = seprint(p, e, "info");
-	for(i=0; i<256; i++){
-		p = seprint(p, e, "%s%.4ux%s",
-			i%8==0 ? "\t" : "",
-			info[i],
-			i%8==7 ? "\n" : "");
-	}
+	for(i = 0; i < 256; i++)
+		p = seprint(p, e, "%s%.4ux%s", i%8 == 0? "\t": "", info[i],
+			i%8 == 7? "\n": "");
 	return p;
 }
 
@@ -1551,6 +1550,10 @@ mv50wctl(SDunit *unit, Cmdbuf *cb)
 	return -1;
 }
 
+/*
+ * sd(3): ``Reading /dev/sdctl yields information about each controller,
+ * one line per controller.''
+ */
 static char*
 mv50rtopctl(SDev *sdev, char *p, char *e)
 {
@@ -1563,11 +1566,15 @@ mv50rtopctl(SDev *sdev, char *p, char *e)
 
 	snprint(name, sizeof name, "sd%c", sdev->idno);
 	p = rdregs(p, e, ctlr->mmio, regsctlr, nelem(regsctlr), name);
-	/* info for first disk */
-	p = rdregs(p, e, ctlr->chip[0].arb, regsarb, nelem(regsarb), name);
-	p = rdregs(p, e, &ctlr->chip[0].arb->bridge[0], regsbridge, nelem(regsbridge), name);
-	p = rdregs(p, e, &ctlr->chip[0].edma[0], regsedma, nelem(regsedma), name);
-
+	if (Coraiddebug) {
+		/* info for first disk.  BUG: this shouldn't be here. */
+		p = rdregs(p, e, ctlr->chip[0].arb,
+			regsarb, nelem(regsarb), name);
+		p = rdregs(p, e, &ctlr->chip[0].arb->bridge[0],
+			regsbridge, nelem(regsbridge), name);
+		p = rdregs(p, e, &ctlr->chip[0].edma[0],
+			regsedma, nelem(regsedma), name);
+	}
 	return p;
 }
 

+ 0 - 3
sys/src/9/port/devbridge.c

@@ -189,9 +189,6 @@ static void	portfree(Port *port);
 static void	cacheflushport(Bridge *b, int port);
 static void	etherwrite(Port *port, Block *bp);
 
-extern ulong	parseip(uchar*, char*);
-extern ushort	ipcsum(uchar *addr);
-
 static void
 bridgeinit(void)
 {

+ 13 - 0
sys/src/9/port/devcons.c

@@ -299,6 +299,19 @@ panic(char *fmt, ...)
 	exit(1);
 }
 
+/* libmp at least contains a few calls to sysfatal; simulate with panic */
+void
+sysfatal(char *fmt, ...)
+{
+	char err[256];
+	va_list arg;
+
+	va_start(arg, fmt);
+	vseprint(err, err + sizeof err, fmt, arg);
+	va_end(arg);
+	panic("sysfatal: %s", err);
+}
+
 void
 _assert(char *fmt)
 {

+ 69 - 69
sys/src/9/port/edf.c

@@ -9,8 +9,11 @@
 #include	<trace.h>
 
 /* debugging */
-int	edfprint = 0;
-#define DPRINT	if(edfprint)print
+enum {
+	Dontprint = 1,
+};
+
+#define DPRINT	if(Dontprint){}else print
 
 static long	now;	/* Low order 32 bits of time in µs */
 extern ulong	delayedscheds;
@@ -21,7 +24,6 @@ extern ulong	runvec;
 /* Statistics stuff */
 ulong		nilcount;
 ulong		scheds;
-long		edfruntime;
 ulong		edfnrun;
 int		misseddeadlines;
 
@@ -56,7 +58,7 @@ timeconv(Fmt *f)
 	case 'U':
 		t = va_arg(f->args, uvlong);
 		break;
-	case 't':	// vlong in nanoseconds
+	case 't':			/* vlong in nanoseconds */
 		t = va_arg(f->args, long);
 		break;
 	default:
@@ -70,18 +72,17 @@ timeconv(Fmt *f)
 		sign = "";
 	if (t > Onesecond){
 		t += OneRound;
-		sprint(buf, "%s%d.%.3ds", sign, (int)(t / Onesecond), (int)(t % Onesecond)/Onemillisecond);
+		sprint(buf, "%s%d.%.3ds", sign, (int)(t / Onesecond),
+			(int)(t % Onesecond)/Onemillisecond);
 	}else if (t > Onemillisecond)
-		sprint(buf, "%s%d.%.3dms", sign, (int)(t / Onemillisecond), (int)(t % Onemillisecond));
+		sprint(buf, "%s%d.%.3dms", sign, (int)(t / Onemillisecond),
+			(int)(t % Onemillisecond));
 	else
 		sprint(buf, "%s%dµs", sign, (int)t);
 	return fmtstrcpy(f, buf);
 }
 
-/*
-uvlong x;
-ulong xpc;
-*/
+long edfcycles;
 
 Edf*
 edflock(Proc *p)
@@ -91,12 +92,12 @@ edflock(Proc *p)
 	if (p->edf == nil)
 		return nil;
 	ilock(&thelock);
-	if ((e = p->edf) && (e->flags & Admitted)){
-/*
-		cycles(&x);
-		xpc = getcallerpc(&p);
-*/
-		now = fastticks2us(fastticks(nil));
+	if((e = p->edf) && (e->flags & Admitted)){
+		thelock.pc = getcallerpc(&p);
+#ifdef EDFCYCLES
+		edfcycles -= lcycles();
+#endif
+		now = µs();
 		return e;
 	}
 	iunlock(&thelock);
@@ -106,21 +107,12 @@ edflock(Proc *p)
 void
 edfunlock(void)
 {
-/*
-	uvlong y;
-	ulong n, upc;
-	cycles(&y);
-	upc = 0;
-	if((n = y - x) > 500000) upc = xpc;
-*/
-
-	edfruntime += todget(nil) - now;
+
+#ifdef EDFCYCLES
+	edfcycles += lcycles();
+#endif
 	edfnrun++;
 	iunlock(&thelock);
-/*
-	if(upc)
-		print("edfunlock %ld 0x%lux\n", n, upc);
-*/
 }
 
 void
@@ -130,8 +122,8 @@ edfinit(Proc*p)
 		fmtinstall('t', timeconv);
 		edfinited++;
 	}
-	now = fastticks2us(fastticks(nil));
-	DPRINT("%t edfinit %lud[%s]\n", now, p->pid, statename[p->state]);
+	now = µs();
+	DPRINT("%lud edfinit %lud[%s]\n", now, p->pid, statename[p->state]);
 	p->edf = malloc(sizeof(Edf));
 	if(p->edf == nil)
 		error(Enomem);
@@ -150,8 +142,8 @@ deadlineintr(Ureg*, Timer *t)
 		return;
 
 	p = t->ta;
-	now = fastticks2us(fastticks(nil));
-	DPRINT("%t deadlineintr %lud[%s]\n", now, p->pid, statename[p->state]);
+	now = µs();
+	DPRINT("%lud deadlineintr %lud[%s]\n", now, p->pid, statename[p->state]);
 	/* If we're interrupting something other than the proc pointed to by t->a,
 	 * we've already achieved recheduling, so we need not do anything
 	 * Otherwise, we must cause a reschedule, but if we call sched()
@@ -159,9 +151,8 @@ deadlineintr(Ureg*, Timer *t)
 	 * Instead, we cause the resched to happen when the interrupted proc
 	 * returns to user space
 	 */
-	if (p == up){
-		pt = proctrace;
-		if(up->trace && pt)
+	if(p == up){
+		if(up->trace && (pt = proctrace))
 			pt(up, SInts, 0);
 		up->delaysched++;
  		delayedscheds++;
@@ -179,10 +170,10 @@ release(Proc *p)
 
 	e = p->edf;
 	e->flags &= ~Yield;
-	if (e->d - now < 0){
+	if(e->d - now < 0){
 		e->periods++;
 		e->r = now;
-		if ((e->flags & Sporadic) == 0){
+		if((e->flags & Sporadic) == 0){
 			/*
 			 * Non sporadic processes stay true to their period;
 			 * calculate next release time.
@@ -202,15 +193,15 @@ release(Proc *p)
 		}
 		e->d = e->r + e->D;
 		e->S = e->C;
-		DPRINT("%t release %lud[%s], r=%t, d=%t, t=%t, S=%t\n",
+		DPRINT("%lud release %lud[%s], r=%lud, d=%lud, t=%lud, S=%lud\n",
 			now, p->pid, statename[p->state], e->r, e->d, e->t, e->S);
-		if (pt = proctrace){
+		if(pt = proctrace){
 			nowns = todget(nil);
 			pt(p, SRelease, nowns);
 			pt(p, SDeadline, nowns + 1000LL*e->D);
 		}
 	}else{
-		DPRINT("%t release %lud[%s], too late t=%t, called from 0x%lux\n",
+		DPRINT("%lud release %lud[%s], too late t=%lud, called from 0x%lux\n",
 			now, p->pid, statename[p->state], e->t, getcallerpc(&p));
 	}
 }
@@ -228,7 +219,7 @@ releaseintr(Ureg*, Timer *t)
 	p = t->ta;
 	if((edflock(p)) == nil)
 		return;
-	DPRINT("%t releaseintr %lud[%s]\n", now, p->pid, statename[p->state]);
+	DPRINT("%lud releaseintr %lud[%s]\n", now, p->pid, statename[p->state]);
 	switch(p->state){
 	default:
 		edfunlock();
@@ -236,7 +227,7 @@ releaseintr(Ureg*, Timer *t)
 	case Ready:
 		/* remove proc from current runq */
 		rq = &runq[p->priority];
-		if (dequeueproc(rq, p) != p){
+		if(dequeueproc(rq, p) != p){
 			DPRINT("releaseintr: can't find proc or lock race\n");
 			release(p);	/* It'll start best effort */
 			edfunlock();
@@ -247,8 +238,11 @@ releaseintr(Ureg*, Timer *t)
 	case Waitrelease:
 		release(p);
 		edfunlock();
+		if(p->state == Wakeme){
+			iprint("releaseintr: wakeme\n");
+		}
 		ready(p);
-		if (up){
+		if(up){
 			up->delaysched++;
 			delayedscheds++;
 		}
@@ -260,10 +254,10 @@ releaseintr(Ureg*, Timer *t)
 	case Wakeme:
 		release(p);
 		edfunlock();
-		if (p->trend)
+		if(p->trend)
 			wakeup(p->trend);
 		p->trend = nil;
-		if (up){
+		if(up){
 			up->delaysched++;
 			delayedscheds++;
 		}
@@ -282,15 +276,15 @@ edfrecord(Proc *p)
 	if((e = edflock(p)) == nil)
 		return;
 	used = now - e->s;
-	if (e->d - now <= 0)
+	if(e->d - now <= 0)
 		e->edfused += used;
 	else
 		e->extraused += used;
-	if (e->S > 0){
+	if(e->S > 0){
 		if(e->S <= used){
 			if(pt = proctrace)
 				pt(p, SSlice, 0);
-			DPRINT("%t edfrecord slice used up\n", now);
+			DPRINT("%lud edfrecord slice used up\n", now);
 			e->d = now;
 			e->S = 0;
 		}else
@@ -311,7 +305,7 @@ edfrun(Proc *p, int edfpri)
 	/* Called with edflock held */
 	if(edfpri){
 		tns = e->d - now;
-		if (tns <= 0 || e->S == 0){
+		if(tns <= 0 || e->S == 0){
 			/* Deadline reached or resources exhausted,
 			 * deschedule forthwith
 			 */
@@ -322,9 +316,11 @@ edfrun(Proc *p, int edfpri)
 		}
 		if(e->S < tns)
 			tns = e->S;
-		e->tns = 1000LL * tns;
+		if(tns < 20)
+			tns = 20;
+		e->tns = 1000LL * tns;	/* µs to ns */
 		if(e->tt == nil || e->tf != deadlineintr){
-			DPRINT("%t edfrun, deadline=%t\n", now, tns);
+			DPRINT("%lud edfrun, deadline=%lud\n", now, tns);
 		}else{
 			DPRINT("v");
 		}
@@ -375,7 +371,7 @@ edfadmit(Proc *p)
 
 	edflock(p);
 
-	if(pt = proctrace)
+	if(p->trace && (pt = proctrace))
 		pt(p, SAdmit, 0);
 
 	/* Look for another proc with the same period to synchronize to */
@@ -395,13 +391,13 @@ edfadmit(Proc *p)
 		e->d = 0;
 		release(p);
 		if (p == up){
-			DPRINT("%t edfadmit self %lud[%s], release now: r=%t d=%t t=%t\n",
+			DPRINT("%lud edfadmit self %lud[%s], release now: r=%lud d=%lud t=%lud\n",
 				now, p->pid, statename[p->state], e->r, e->d, e->t);
 			/* We're already running */
 			edfrun(p, 1);
 		}else{
 			/* We're releasing another proc */
-			DPRINT("%t edfadmit other %lud[%s], release now: r=%t d=%t t=%t\n",
+			DPRINT("%lud edfadmit other %lud[%s], release now: r=%lud d=%lud t=%lud\n",
 				now, p->pid, statename[p->state], e->r, e->d, e->t);
 			p->ta = p;
 			edfunlock();
@@ -413,13 +409,13 @@ edfadmit(Proc *p)
 		/* Release in synch to something else */
 		e->t = r->edf->t;
 		if (p == up){
-			DPRINT("%t edfadmit self %lud[%s], release at %t\n",
+			DPRINT("%lud edfadmit self %lud[%s], release at %lud\n",
 				now, p->pid, statename[p->state], e->t);
 			edfunlock();
 			qunlock(&edfschedlock);
 			return nil;
 		}else{
-			DPRINT("%t edfadmit other %lud[%s], release at %t\n",
+			DPRINT("%lud edfadmit other %lud[%s], release at %lud\n",
 				now, p->pid, statename[p->state], e->t);
 			if(e->tt == nil){
 				e->tf = releaseintr;
@@ -444,9 +440,9 @@ edfstop(Proc *p)
 	Edf *e;
 	void (*pt)(Proc*, int, vlong);
 
-	if (e = edflock(p)){
-		DPRINT("%t edfstop %lud[%s]\n", now, p->pid, statename[p->state]);
-		if(pt = proctrace)
+	if(e = edflock(p)){
+		DPRINT("%lud edfstop %lud[%s]\n", now, p->pid, statename[p->state]);
+		if(p->trace && (pt = proctrace))
 			pt(p, SExpel, 0);
 		e->flags &= ~Admitted;
 		if(e->tt)
@@ -458,7 +454,7 @@ edfstop(Proc *p)
 static int
 yfn(void *)
 {
-	now = fastticks2us(fastticks(nil));
+	now = µs();
 	return up->trend == nil || now - up->edf->r >= 0;
 }
 
@@ -472,7 +468,7 @@ edfyield(void)
 
 	if((e = edflock(up)) == nil)
 		return;
-	if(pt = proctrace)
+	if(up->trace && (pt = proctrace))
 		pt(up, SYield, 0);
 	if((n = now - e->t) > 0){
 		if(n < e->T)
@@ -510,6 +506,10 @@ edfready(Proc *p)
 
 	if((e = edflock(p)) == nil)
 		return 0;
+
+	if(p->state == Wakeme && p->r){
+		iprint("edfready: wakeme\n");
+	}
 	if(e->d - now <= 0){
 		/* past deadline, arrange for next release */
 		if((e->flags & Sporadic) == 0){
@@ -523,7 +523,7 @@ edfready(Proc *p)
 				else
 					e->t = now + e->T - (n % e->T);
 			}
-		}	
+		}
 		if(now - e->t < 0){
 			/* Next release is in the future, schedule it */
 			if(e->tt == nil || e->tf != releaseintr){
@@ -535,7 +535,7 @@ edfready(Proc *p)
 				e->tf = releaseintr;
 				e->ta = p;
 				timeradd(e);
-				DPRINT("%t edfready %lud[%s], release=%t\n",
+				DPRINT("%lud edfready %lud[%s], release=%lud\n",
 					now, p->pid, statename[p->state], e->t);
 			}
 			if(p->state == Running && (e->flags & (Yield|Yieldonblock)) == 0 && (e->flags & Extratime)){
@@ -550,13 +550,13 @@ edfready(Proc *p)
 				edfunlock();
 				return 0;	/* Stick on runq[PriExtra] */
 			}
-			DPRINT("%t edfready %lud[%s] wait release at %t\n",
+			DPRINT("%lud edfready %lud[%s] wait release at %lud\n",
 				now, p->pid, statename[p->state], e->t);
 			p->state = Waitrelease;
 			edfunlock();
 			return 1;	/* Make runnable later */
 		}
-		DPRINT("%t edfready %lud %s release now\n", now, p->pid, statename[p->state]);
+		DPRINT("%lud edfready %lud %s release now\n", now, p->pid, statename[p->state]);
 		/* release now */
 		release(p);
 	}
@@ -585,7 +585,7 @@ edfready(Proc *p)
 	p->readytime = m->ticks;
 	p->state = Ready;
 	unlock(runq);
-	if(pt = proctrace)
+	if(p->trace && (pt = proctrace))
 		pt(p, SReady, 0);
 	return 1;
 }
@@ -648,7 +648,7 @@ testschedulability(Proc *theproc)
 		case Dl:
 			H += p->edf->C;
 			Cb = 0;
-			DPRINT("\tStep %3d, Ticks %t, pid %lud, deadline, H += %t → %t, Cb = %t\n",
+			DPRINT("\tStep %3d, Ticks %lud, pid %lud, deadline, H += %lud → %lud, Cb = %lud\n",
 				steps, ticks, p->pid, p->edf->C, H, Cb);
 			if (H+Cb>ticks){
 				DPRINT("not schedulable\n");
@@ -659,7 +659,7 @@ testschedulability(Proc *theproc)
 			testenq(p);
 			break;
 		case Rl:
-			DPRINT("\tStep %3d, Ticks %t, pid %lud, release, G  %t, C%t\n",
+			DPRINT("\tStep %3d, Ticks %lud, pid %lud, release, G  %lud, C%lud\n",
 				steps, ticks, p->pid, p->edf->C, G);
 			if(ticks && G <= ticks){
 				DPRINT("schedulable\n");

+ 1 - 0
sys/src/9/port/error.h

@@ -49,3 +49,4 @@ extern char Eshortstat[];	/* stat buffer too small */
 extern char Ebadstat[];		/* malformed stat buffer */
 extern char Enegoff[];		/* negative i/o offset */
 extern char Ecmdargs[];		/* wrong #args in control message */
+extern char Ebadip[];		/* bad ip address syntax */

+ 6 - 1
sys/src/9/port/fault.c

@@ -55,6 +55,9 @@ faulterror(char *s, Chan *c, int freemem)
 	pexit(s, freemem);
 }
 
+void	(*checkaddr)(ulong, Segment *, Page *);
+ulong	addr2check;
+
 int
 fixfault(Segment *s, ulong addr, int read, int doputmmu)
 {
@@ -168,6 +171,8 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu)
 			}
 		}
 
+		if (checkaddr && addr == addr2check)
+			(*checkaddr)(addr, s, *pg);
 		mmuphys = PPN((*pg)->pa) |PTEWRITE|PTEUNCACHED|PTEVALID;
 		(*pg)->modref = PG_MOD|PG_REF;
 		break;
@@ -322,7 +327,7 @@ okaddr(ulong addr, ulong len, int write)
 			return 1;
 		}
 	}
-	pprint("suicide: invalid address 0x%lux in sys call pc=0x%lux\n", addr, userpc());
+	pprint("suicide: invalid address 0x%lux/%lud in sys call pc=0x%lux\n", addr, len, userpc());
 	return 0;
 }
 

+ 1 - 1
sys/src/9/port/portclock.c

@@ -160,7 +160,7 @@ hzclock(Ureg *ur)
 }
 
 void
-timerintr(Ureg *u, uvlong)
+timerintr(Ureg *u, Tval)
 {
 	Timer *t;
 	Timers *tt;

+ 5 - 3
sys/src/9/port/portdat.h

@@ -145,6 +145,7 @@ struct Block
 	ushort	flag;
 	ushort	checksum;		/* IP checksum of complete packet (minus media header) */
 };
+
 #define BLEN(s)	((s)->wp - (s)->rp)
 #define BALLOC(s) ((s)->lim - (s)->base)
 
@@ -216,7 +217,7 @@ struct Dev
 	void	(*remove)(Chan*);
 	int	(*wstat)(Chan*, uchar*, int);
 	void	(*power)(int);	/* power mgt: power(1) => on, power (0) => off */
-	int	(*config)(int, char*, DevConf*);	// returns nil on error
+	int	(*config)(int, char*, DevConf*);	/* returns nil on error */
 };
 
 struct Dirtab
@@ -531,7 +532,8 @@ struct Timer
 	/* Internal */
 	Lock;
 	Timers	*tt;		/* Timers queue this timer runs on */
-	vlong	twhen;		/* ns represented in fastticks */
+	Tval	tticks;		/* tns converted to ticks */
+	Tval	twhen;		/* ns represented in fastticks */
 	Timer	*tnext;
 };
 
@@ -595,8 +597,8 @@ enum
 	Nrq		= Npriq+2,	/* number of priority levels including real time */
 	PriRelease	= Npriq,	/* released edf processes */
 	PriEdf		= Npriq+1,	/* active edf processes */
-	PriExtra	= 0,		/* edf processes we don't care about */
 	PriNormal	= 10,		/* base priority for normal processes */
+	PriExtra	= Npriq-1,	/* edf processes at high best-effort pri */
 	PriKproc	= 13,		/* base priority for kernel processes */
 	PriRoot		= 13,		/* base priority for root processes */
 };

+ 4 - 2
sys/src/9/port/portfns.h

@@ -328,8 +328,8 @@ void		swapinit(void);
 void		timeradd(Timer*);
 void		timerdel(Timer*);
 void		timersinit(void);
-void		timerintr(Ureg*, uvlong);
-void		timerset(uvlong);
+void		timerintr(Ureg*, Tval);
+void		timerset(Tval);
 ulong		tk2ms(ulong);
 #define		TK2MS(x) ((x)*(1000/HZ))
 uvlong		tod2fastticks(vlong);
@@ -384,7 +384,9 @@ void		hnputs(void*, ushort);
 uvlong		nhgetv(void*);
 uint		nhgetl(void*);
 ushort		nhgets(void*);
+ulong		µs(void);
 void		_xinc(long*);
 long		_xdec(long*);
+long		lcycles(void);
 
 #pragma varargck argpos iprint 1

+ 17 - 12
sys/src/9/port/taslock.c

@@ -6,8 +6,10 @@
 #include "../port/error.h"
 #include "edf.h"
 
-uvlong maxlockcycles;
-uvlong maxilockcycles;
+long maxlockcycles;
+long maxilockcycles;
+long cumlockcycles;
+long cumilockcycles;
 ulong maxlockpc;
 ulong maxilockpc;
 
@@ -79,7 +81,7 @@ lock(Lock *l)
 		l->p = up;
 		l->isilock = 0;
 #ifdef LOCKCYCLES
-		cycles(&l->lockcycles);
+		l->lockcycles = -lcycles();
 #endif
 		return 0;
 	}
@@ -114,7 +116,7 @@ lock(Lock *l)
 			l->p = up;
 			l->isilock = 0;
 #ifdef LOCKCYCLES
-			cycles(&l->lockcycles);
+			l->lockcycles = -lcycles();
 #endif
 			return 1;
 		}
@@ -165,7 +167,7 @@ acquire:
 	l->isilock = 1;
 	l->m = MACHP(m->machno);
 #ifdef LOCKCYCLES
-	cycles(&l->lockcycles);
+	l->lockcycles = -lcycles();
 #endif
 }
 
@@ -187,7 +189,7 @@ canlock(Lock *l)
 	l->m = MACHP(m->machno);
 	l->isilock = 0;
 #ifdef LOCKCYCLES
-	cycles(&l->lockcycles);
+	l->lockcycles = -lcycles();
 #endif
 	return 1;
 }
@@ -196,9 +198,8 @@ void
 unlock(Lock *l)
 {
 #ifdef LOCKCYCLES
-	uvlong x;
-	cycles(&x);
-	l->lockcycles = x - l->lockcycles;
+	l->lockcycles += lcycles();
+	cumlockcycles += l->lockcycles;
 	if(l->lockcycles > maxlockcycles){
 		maxlockcycles = l->lockcycles;
 		maxlockpc = l->pc;
@@ -223,19 +224,23 @@ unlock(Lock *l)
 	}
 }
 
+ulong ilockpcs[0x100] = { [0xff] = 1 };
+static int n;
+
 void
 iunlock(Lock *l)
 {
 	ulong sr;
 
 #ifdef LOCKCYCLES
-	uvlong x;
-	cycles(&x);
-	l->lockcycles = x - l->lockcycles;
+	l->lockcycles += lcycles();
+	cumilockcycles += l->lockcycles;
 	if(l->lockcycles > maxilockcycles){
 		maxilockcycles = l->lockcycles;
 		maxilockpc = l->pc;
 	}
+	if(l->lockcycles > 2400)
+		ilockpcs[n++ & 0xff]  = l->pc;
 #endif
 	if(l->key == 0)
 		print("iunlock: not locked: pc %luX\n", getcallerpc(&l));

+ 30 - 28
sys/src/9/port/tod.c

@@ -35,20 +35,20 @@
 #define MicroFREQ	1000000ULL
 
 struct {
-	int	init;		// true if initialized
+	int	init;		/* true if initialized */
 	ulong	cnt;
 	Lock;
-	uvlong	multiplier;	// ns = off + (multiplier*ticks)>>31
-	uvlong	divider;	// ticks = (divider*(ns-off))>>31
-	uvlong	umultiplier;	// µs = (µmultiplier*ticks)>>31
-	uvlong	udivider;	// ticks = (µdivider*µs)>>31
-	vlong	hz;		// frequency of fast clock
-	vlong	last;		// last reading of fast clock
-	vlong	off;		// offset from epoch to last
-	vlong	lasttime;	// last return value from todget
-	vlong	delta;		// add 'delta' each slow clock tick from sstart to send
-	ulong	sstart;		// ...
-	ulong	send;		// ...
+	uvlong	multiplier;	/* ns = off + (multiplier*ticks)>>31 */
+	uvlong	divider;	/* ticks = (divider*(ns-off))>>31 */
+	uvlong	umultiplier;	/* µs = (µmultiplier*ticks)>>31 */
+	uvlong	udivider;	/* ticks = (µdivider*µs)>>31 */
+	vlong	hz;		/* frequency of fast clock */
+	vlong	last;		/* last reading of fast clock */
+	vlong	off;		/* offset from epoch to last */
+	vlong	lasttime;	/* last return value from todget */
+	vlong	delta;	/* add 'delta' each slow clock tick from sstart to send */
+	ulong	sstart;		/* ... */
+	ulong	send;		/* ... */
 } tod;
 
 static void todfix(void);
@@ -59,7 +59,7 @@ todinit(void)
 	if(tod.init)
 		return;
 	ilock(&tod);
-	tod.last = fastticks((uvlong*)&tod.hz);
+	tod.last = fastticks((uvlong *)&tod.hz);
 	iunlock(&tod);
 	todsetfreq(tod.hz);
 	tod.init = 1;
@@ -77,9 +77,9 @@ todsetfreq(vlong f)
 
 	/* calculate multiplier for time conversion */
 	tod.multiplier = mk64fract(TODFREQ, f);
-	tod.divider = mk64fract(f, TODFREQ);
+	tod.divider = mk64fract(f, TODFREQ) + 1;
 	tod.umultiplier = mk64fract(MicroFREQ, f);
-	tod.udivider = mk64fract(f, MicroFREQ);
+	tod.udivider = mk64fract(f, MicroFREQ) + 1;
 	iunlock(&tod);
 }
 
@@ -128,14 +128,16 @@ todget(vlong *ticksp)
 	if(!tod.init)
 		todinit();
 
-	// we don't want time to pass twixt the measuring of fastticks
-	// and grabbing tod.last.  Also none of the vlongs are atomic so
-	// we have to look at them inside the lock.
+	/*
+	 * we don't want time to pass twixt the measuring of fastticks
+	 * and grabbing tod.last.  Also none of the vlongs are atomic so
+	 * we have to look at them inside the lock.
+	 */
 	ilock(&tod);
 	tod.cnt++;
 	ticks = fastticks(nil);
 
-	// add in correction
+	/* add in correction */
 	if(tod.sstart != tod.send){
 		t = MACHP(0)->ticks;
 		if(t >= tod.send)
@@ -144,14 +146,14 @@ todget(vlong *ticksp)
 		tod.sstart = t;
 	}
 
-	// convert to epoch
+	/* convert to epoch */
 	diff = ticks - tod.last;
 	if(diff < 0)
 		diff = 0;
 	mul64fract(&x, diff, tod.multiplier);
 	x += tod.off;
 
-	// time can't go backwards
+	/* time can't go backwards */
 	if(x < tod.lasttime)
 		x = tod.lasttime;
 	else
@@ -194,16 +196,16 @@ todfix(void)
 	diff = ticks - tod.last;
 	if(diff > tod.hz){
 		ilock(&tod);
-	
-		// convert to epoch
+
+		/* convert to epoch */
 		mul64fract(&x, diff, tod.multiplier);
 if(x > 30000000000ULL) print("todfix %llud\n", x);
 		x += tod.off;
-	
-		// protect against overflows
+
+		/* protect against overflows */
 		tod.last = ticks;
 		tod.off = x;
-	
+
 		iunlock(&tod);
 	}
 }
@@ -308,6 +310,6 @@ mk64fract(uvlong to, uvlong from)
 	}
 
 	return (to/from)<<(32-shift);
-*/
-	return (to<<32)/from;
+ */
+	return (to<<32) / from;
 }

+ 1 - 1
sys/src/cmd/9nfs/server.c

@@ -328,7 +328,7 @@ getendpoint(char *dir, char *file, uchar *addr, uchar *port)
 	hnputs(port, n);
 }
 
-/* set Udhphdr values from protocol dir local & remote files */
+/* set Udphdr values from protocol dir local & remote files */
 static void
 getendpoints(Udphdr *ep, char *dir)
 {

+ 11 - 13
sys/src/cmd/aquarela/client.c

@@ -96,39 +96,37 @@ listen137(void *)
 void
 usage(void)
 {
-	print("usage: client [-u ipaddr] name\n");
+	fprint(2, "usage: %s [-u ipaddr] name\n", argv0);
+	exits("usage");
 }
 
 void
 threadmain(int argc, char **argv)
 {
-	int i;
+	int broadcast = 1, i, listen137thread, rv;
+	char *ip;
+	uchar ipaddr[IPaddrlen], serveripaddr[IPaddrlen];
 	NbName nbname;
-	int listen137thread;
-	uchar ipaddr[IPaddrlen];
-	int rv;
-	int broadcast = 1;
-	uchar serveripaddr[IPaddrlen];
 
 	ARGBEGIN {
 	case 'u':
 		broadcast = 0;
-		parseip(serveripaddr, ARGF());
+		ip = EARGF(usage());
+		if (parseip(serveripaddr, ip) == -1)
+			sysfatal("bad ip address %s", ip);
 		break;
 	default:
 		usage();
 	} ARGEND;
 
 	if (argc == 0)
-		exits("");
+		usage();
 
 	nbmknamefromstring(nbname, argv[0]);
 
 	ipifc = readipifc("/net", nil, 0);
-	if (ipifc == nil || ipifc->lifc == nil) {
-		print("no network interface");
-		exits("");
-	}
+	if (ipifc == nil || ipifc->lifc == nil)
+		sysfatal("no network interface");
 	fmtinstall('I', eipfmt);
 	ipmove(bcastaddr, ipifc->lifc->ip);
 	for (i = 0; i < IPaddrlen; i++)

+ 7 - 9
sys/src/cmd/aquarela/nbresolve.c

@@ -5,11 +5,12 @@
 int
 nbnameresolve(NbName nbname, uchar *ipaddr)
 {
-	/* for now, just use dns */
-	Ndbtuple *t;
-	NbName copy;
+	ulong r, ttl;
 	char name[NETPATHLEN];
-	ulong ttl;
+	NbName copy;
+	Ndbtuple *t;
+
+	/* for now, just use dns */
 	if (nbremotenametablefind(nbname, ipaddr)) {
 //print("%B found in cache\n", nbname);
 		return 1;
@@ -24,10 +25,7 @@ nbnameresolve(NbName nbname, uchar *ipaddr)
 	t = dnsquery("/net", name, "ip");
 	if (t == nil)
 		return 0;
-	if (parseip(ipaddr, t->line->val) == 0) {
-		ndbfree(t);
-		return 0;
-	}
+	r = parseip(ipaddr, t->line->val);
 	ndbfree(t);
-	return 1;
+	return r != -1;
 }

+ 39 - 3
sys/src/cmd/fossil/9fsys.c

@@ -42,6 +42,42 @@ static char EFsysNoCurrent[] = "fsys: no current fsys";
 static char EFsysNotFound[] = "fsys: '%s' not found";
 static char EFsysNotOpen[] = "fsys: '%s' not open";
 
+static char *
+ventihost(char *host)
+{
+	if(host != nil)
+		return strdup(host);
+	host = getenv("venti");
+	if(host == nil)
+		host = strdup("$venti");
+	return host;
+}
+
+static void
+prventihost(char *host)
+{
+	char *vh;
+
+	vh = ventihost(host);
+	fprint(2, "%s: dialing venti at %s\n",
+		argv0, netmkaddr(vh, 0, "venti"));
+	free(vh);
+}
+
+static VtSession *
+myDial(char *host, int canfail)
+{
+	prventihost(host);
+	return vtDial(host, canfail);
+}
+
+static int
+myRedial(VtSession *z, char *host)
+{
+	prventihost(host);
+	return vtRedial(z, host);
+}
+
 static Fsys*
 _fsysGet(char* name)
 {
@@ -1441,7 +1477,7 @@ fsysVenti(char* name, int argc, char* argv[])
 			goto out;
 		}
 		r = 1;
-		if(!vtRedial(fsys->session, host)
+		if(!myRedial(fsys->session, host)
 		|| !vtConnect(fsys->session, 0))
 			r = 0;
 		goto out;
@@ -1451,7 +1487,7 @@ fsysVenti(char* name, int argc, char* argv[])
 	if(fsys->session)
 		vtClose(fsys->session);
 	r = 1;
-	if((fsys->session = vtDial(host, 0)) == nil
+	if((fsys->session = myDial(host, 0)) == nil
 	|| !vtConnect(fsys->session, 0))
 		r = 0;
 out:
@@ -1525,7 +1561,7 @@ fsysOpen(char* name, int argc, char* argv[])
 			host = fsys->venti;
 		else
 			host = nil;
-		fsys->session = vtDial(host, 1);
+		fsys->session = myDial(host, 1);
 		if(!vtConnect(fsys->session, nil) && !noventi)
 			fprint(2, "warning: connecting to venti: %R\n");
 	}

+ 6 - 3
sys/src/cmd/ip/6in4.c

@@ -92,7 +92,8 @@ procargs(int argc, char **argv)
 		parseipmask(localmask, p);
 		*p = 0;
 	}
-	parseip(local6, loc6);
+	if (parseip(local6, loc6) == -1)
+		sysfatal("bad local v6 address %s", loc6);
 	if (isv4(local6))
 		usage();
 	if (argc >= 1 && argv[0][0] == '/') {
@@ -104,7 +105,8 @@ procargs(int argc, char **argv)
 
 	/* remote v4 address (defaults to anycast 6to4) */
 	if (argc >= 1) {
-		parseip(remote4, *argv++);
+		if (parseip(remote4, *argv++) == -1)
+			sysfatal("bad remote v4 address %s", argv[-1]);
 		argc--;
 		if (!isv4(remote4))
 			usage();
@@ -117,7 +119,8 @@ procargs(int argc, char **argv)
 
 	/* remote v6 address (defaults to link-local w/ v4 as interface part) */
 	if (argc >= 1) {
-		parseip(remote6, *argv++);
+		if (parseip(remote6, *argv++) == -1)
+			sysfatal("bad remote v6 address %s", argv[-1]);
 		argc--;
 	} else {
 		remote6[0] = 0xFE;		/* link local */

+ 2 - 1
sys/src/cmd/ip/dhcpd/dhcpd.c

@@ -303,7 +303,8 @@ main(int argc, char **argv)
 		exits(0);
 	}
 
-	chdir(TFTP);
+	if (chdir(TFTP) < 0)
+		warning(1, "can't change directory to %s", TFTP);
 	fd = openlisten(net);
 
 	for(;;){

+ 9 - 7
sys/src/cmd/ip/dhcpd/dhcpleases.c

@@ -6,9 +6,10 @@
 #include <dat.h>
 
 extern	char *binddir;
-	long now;
-	char *blog = "ipboot";
-	int minlease = MinLease;
+
+long now;
+char *blog = "ipboot";
+int minlease = MinLease;
 
 void
 main(void)
@@ -34,10 +35,11 @@ main(void)
 	b.lease = b.offer = 0;
 	now = time(0);
 	for(i = 0; i < nall; i++){
-		parseip(b.ip, all[i].name);
-		if(syncbinding(&b, 0) < 0)
+		if(parseip(b.ip, all[i].name) == -1 || syncbinding(&b, 0) < 0)
 			continue;
 		if(b.lease > now)
-			print("%I leased by %s until %s", b.ip, b.boundto, ctime(b.lease));
-	}		
+			print("%I leased by %s until %s", b.ip, b.boundto,
+				ctime(b.lease));
+	}
+	exits(0);
 }

+ 20 - 12
sys/src/cmd/ip/ipconfig/main.c

@@ -299,7 +299,8 @@ parse6pref(int argc, char **argv)
 		conf.prefixlen = atoi(argv[1]);
 		/* fall through */
 	case 1:
-		parseip(conf.v6pref, argv[0]);
+		if (parseip(conf.v6pref, argv[0]) == -1)
+			sysfatal("bad address %s", argv[0]);
 		break;
 	}
 	DEBUG("parse6pref: pref %I len %d", conf.v6pref, conf.prefixlen);
@@ -1507,7 +1508,8 @@ optgetp9addrs(uchar *ap, int op, uchar *ip, int n)
 	addrs = *p++;			/* first byte is address count */
 	for (i = 0; i < n  && i < addrs && len > 0; i++) {
 		slen = strlen(p) + 1;
-		parseip(&ip[i*IPaddrlen], p);
+		if (parseip(&ip[i*IPaddrlen], p) == -1)
+			fprint(2, "%s: bad address %s\n", argv0, p);
 		DEBUG("got plan 9 option %d addr %I (%s)",
 			op, &ip[i*IPaddrlen], p);
 		p += slen;
@@ -1719,7 +1721,8 @@ getndb(void)
 	p = strstr(buf, "ip=");
 	if(p == nil)
 		return -1;
-	parseip(conf.laddr, p+3);
+	if (parseip(conf.laddr, p+3) == -1)
+		fprint(2, "%s: bad address %s\n", argv0, p+3);
 	return 0;
 }
 
@@ -1796,7 +1799,7 @@ parseverb(char *name)
 void
 ndbconfig(void)
 {
-	int nattr, nauth = 0, ndns = 0, nfs = 0;
+	int nattr, nauth = 0, ndns = 0, nfs = 0, ok;
 	char etheraddr[32];
 	char *attrs[10];
 	Ndb *db;
@@ -1820,21 +1823,26 @@ ndbconfig(void)
 	attrs[nattr++] = "@auth";
 	attrs[nattr] = nil;
 	t = ndbipinfo(db, "ether", etheraddr, attrs, nattr);
-	for(nt = t; nt != nil; nt = nt->entry)
+	for(nt = t; nt != nil; nt = nt->entry) {
+		ok = 1;
 		if(strcmp(nt->attr, "ip") == 0)
-			parseip(conf.laddr, nt->val);
+			ok = parseip(conf.laddr, nt->val);
 		else if(strcmp(nt->attr, "ipmask") == 0)
-			parseipmask(conf.mask, nt->val);
+			parseipmask(conf.mask, nt->val);  /* could be -1 */
 		else if(strcmp(nt->attr, "ipgw") == 0)
-			parseip(conf.gaddr, nt->val);
+			ok = parseip(conf.gaddr, nt->val);
 		else if(ndns < 2 && strcmp(nt->attr, "dns") == 0)
-			parseip(conf.dns+IPaddrlen*ndns, nt->val);
+			ok = parseip(conf.dns+IPaddrlen*ndns, nt->val);
 		else if(strcmp(nt->attr, "ntp") == 0)
-			parseip(conf.ntp, nt->val);
+			ok = parseip(conf.ntp, nt->val);
 		else if(nfs < 2 && strcmp(nt->attr, "fs") == 0)
-			parseip(conf.fs+IPaddrlen*nfs, nt->val);
+			ok = parseip(conf.fs+IPaddrlen*nfs, nt->val);
 		else if(nauth < 2 && strcmp(nt->attr, "auth") == 0)
-			parseip(conf.auth+IPaddrlen*nauth, nt->val);
+			ok = parseip(conf.auth+IPaddrlen*nauth, nt->val);
+		if (!ok)
+			fprint(2, "%s: bad %s address in ndb: %s\n", argv0,
+				nt->attr, nt->val);
+	}
 	ndbfree(t);
 	if(!validip(conf.laddr))
 		sysfatal("address not found in ndb");

+ 4 - 2
sys/src/cmd/ip/ppp/ppp.c

@@ -2749,9 +2749,11 @@ main(int argc, char **argv)
 
 	switch(argc){
 	case 2:
-		parseip(remip, argv[1]);
+		if (parseip(remip, argv[1]) == -1)
+			sysfatal("bad remote ip %s", argv[1]);
 	case 1:
-		parseip(ipaddr, argv[0]);
+		if (parseip(ipaddr, argv[0]) == -1)
+			sysfatal("bad ip %s", argv[0]);
 	case 0:
 		break;
 	default:

+ 5 - 6
sys/src/cmd/ip/pptpd.c

@@ -187,17 +187,16 @@ void	greack(Call *c);
 
 void	timeoutthread(void*);
 
-ulong	parseip(uchar *ato, char *from);
 int	argatoi(char *p);
 void	usage(void);
 int	ipaddralloc(Call *c);
 
-void esignal(Event *e);
-void ewait(Event *e);
+void	*emallocz(int size);
+void	esignal(Event *e);
+void	ewait(Event *e);
+int	proc(char **argv, int fd0, int fd1, int fd2);
+double	realtime(void);
 ulong	thread(void(*f)(void*), void *a);
-double realtime(void);
-void *emallocz(int size);
-int proc(char **argv, int fd0, int fd1, int fd2);
 
 void
 main(int argc, char *argv[])

+ 4 - 3
sys/src/cmd/ndb/dnnotify.c

@@ -60,9 +60,10 @@ send_notify(char *slave, RR *soa, Request *req)
 	n = mkreq(soa->owner, Cin, obuf, Fauth | Onotify, reqno);
 
 	/* get an address */
-	if(strcmp(ipattr(slave), "ip") == 0)
-		parseip(up->raddr, slave);
-	else {
+	if(strcmp(ipattr(slave), "ip") == 0) {
+		if (parseip(up->raddr, slave) == -1)
+			dnslog("bad address %s to notify", slave);
+	} else {
 		rp = dnresolve(slave, Cin, Ta, req, nil, 0, 1, 1, &status);
 		if(rp == nil)
 			return;

+ 2 - 1
sys/src/cmd/upas/smtp/smtpd.c

@@ -177,7 +177,8 @@ main(int argc, char **argv)
 	getconf();
 	Binit(&bin, 0, OREAD);
 
-	chdir(UPASLOG);
+	if (chdir(UPASLOG) < 0)
+		syslog(0, "smtpd", "no %s: %r", UPASLOG);
 	me = sysname_read();
 	if(dom == 0 || dom[0] == 0)
 		dom = domainname_read();

+ 63 - 2
sys/src/libip/classmask.c

@@ -2,17 +2,78 @@
 #include <libc.h>
 #include <ip.h>
 
-uchar classmask[4][16] = {
+static uchar classmask[4][16] = {
 	0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0x00,0x00,0x00,
 	0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0x00,0x00,0x00,
 	0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0xff,0x00,0x00,
 	0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0xff,  0xff,0xff,0xff,0x00,
 };
 
+static uchar v6loopback[IPaddrlen] = {
+	0, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0x01
+};
+
+static uchar v6linklocal[IPaddrlen] = {
+	0xfe, 0x80, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0
+};
+static uchar v6linklocalmask[IPaddrlen] = {
+	0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff,
+	0, 0, 0, 0,
+	0, 0, 0, 0
+};
+static int v6llpreflen = 8;	/* link-local prefix length in bytes */
+
+static uchar v6multicast[IPaddrlen] = {
+	0xff, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0
+};
+static uchar v6multicastmask[IPaddrlen] = {
+	0xff, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0
+};
+static int v6mcpreflen = 1;	/* multicast prefix length */
+
+static uchar v6solicitednode[IPaddrlen] = {
+	0xff, 0x02, 0, 0,
+	0, 0, 0, 0,
+	0, 0, 0, 0x01,
+	0xff, 0, 0, 0
+};
+static uchar v6solicitednodemask[IPaddrlen] = {
+	0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff,
+	0xff, 0x0, 0x0, 0x0
+};
+static int v6snpreflen = 13;
+
 uchar*
 defmask(uchar *ip)
 {
-	return classmask[ip[IPv4off]>>6];
+	if(isv4(ip))
+		return classmask[ip[IPv4off]>>6];
+	else {
+		if(ipcmp(ip, v6loopback) == 0)
+			return IPallbits;
+		else if(memcmp(ip, v6linklocal, v6llpreflen) == 0)
+			return v6linklocalmask;
+		else if(memcmp(ip, v6solicitednode, v6snpreflen) == 0)
+			return v6solicitednodemask;
+		else if(memcmp(ip, v6multicast, v6mcpreflen) == 0)
+			return v6multicastmask;
+		return IPallbits;
+	}
 }
 
 void

+ 0 - 77
sys/src/libip/ip.h

@@ -1,77 +0,0 @@
-#pragma	src	"/sys/src/libip"
-#pragma	lib	"libip.a"
-
-enum 
-{
-	IPaddrlen=	16,
-	IPv4addrlen=	4,
-	IPv4off=	12,
-	IPllen=		4,
-};
-
-/*
- *  for reading /net/ipifc
- */
-typedef struct Ipifc Ipifc;
-typedef struct Ipifcs Ipifcs;
-
-struct Ipifc
-{
-	char	dev[64];
-	uchar	ip[IPaddrlen];
-	uchar	mask[IPaddrlen];
-	uchar	net[IPaddrlen];		/* ip & mask */
-	Ipifc	*next;
-};
-
-struct Ipifcs
-{
-	Ipifc *first;
-	Ipifc *last;
-};
-
-/*
- *  user level udp headers
- */
-enum 
-{
-	Udphdrsize=	36,	/* size of a Udphdr */
-};
-
-typedef struct Udphdr Udphdr;
-struct Udphdr
-{
-	uchar	raddr[IPaddrlen];	/* remote address and port */
-	uchar	laddr[IPaddrlen];	/* local address and port */
-	uchar	rport[2];
-	uchar	lport[2];
-};
-
-uchar*	defmask(uchar*);
-void	maskip(uchar*, uchar*, uchar*);
-int	eipconv(va_list*, Fconv*);
-ulong	parseip(uchar*, char*);
-ulong	parseipmask(uchar*, char*);
-int	parseether(uchar*, char*);
-int	myipaddr(uchar*, char*);
-int	myetheraddr(uchar*, char*);
-
-void	readipifc(char*, Ipifcs*);
-
-void	hnputl(void*, uint);
-void	hnputs(void*, ushort);
-uint	nhgetl(void*);
-ushort	nhgets(void*);
-
-#define	ipcmp(x, y) memcmp(x, y, IPaddrlen)
-#define	ipmove(x, y) memmove(x, y, IPaddrlen)
-
-extern uchar IPv4bcast[IPaddrlen];
-extern uchar IPv4bcastobs[IPaddrlen];
-extern uchar IPv4allsys[IPaddrlen];
-extern uchar IPv4allrouter[IPaddrlen];
-extern uchar IPnoaddr[IPaddrlen];
-extern uchar v4prefix[IPaddrlen];
-extern uchar IPallbits[IPaddrlen];
-
-#define CLASS(p) ((*(uchar*)(p))>>6)

+ 1 - 1
sys/src/libip/mkfile

@@ -15,7 +15,7 @@ OFILES=\
 	ptclbsum.$O\
 
 HFILES=\
-	ip.h
+	/sys/include/ip.h
 
 UPDATE=\
 	mkfile\

+ 55 - 15
sys/src/libip/parseip.c

@@ -1,5 +1,6 @@
 #include <u.h>
 #include <libc.h>
+#include <ctype.h>
 #include <ip.h>
 
 char*
@@ -36,7 +37,31 @@ v4parseip(uchar *to, char *from)
 	return p;
 }
 
-ulong
+static int
+ipcharok(int c)
+{
+	return c == '.' || c == ':' || isascii(c) && isxdigit(c);
+}
+
+static int
+delimchar(int c)
+{
+	if(c == '\0')
+		return 1;
+	if(c == '.' || c == ':' || isascii(c) && isalnum(c))
+		return 0;
+	return 1;
+}
+
+/*
+ * `from' may contain an address followed by other characters,
+ * at least in /boot, so we permit whitespace (and more) after the address.
+ * we do ensure that "delete" cannot be parsed as "de::".
+ *
+ * some callers don't check the return value for errors, so
+ * set `to' to something distinctive in the case of a parse error.
+ */
+vlong
 parseip(uchar *to, char *from)
 {
 	int i, elipsis = 0, v4 = 1;
@@ -45,31 +70,45 @@ parseip(uchar *to, char *from)
 
 	memset(to, 0, IPaddrlen);
 	p = from;
-	for(i = 0; i < 16 && *p; i+=2){
+	for(i = 0; i < IPaddrlen && ipcharok(*p); i+=2){
 		op = p;
 		x = strtoul(p, &p, 16);
-		if(*p == '.' || (*p == 0 && i == 0)){
+		if(*p == '.' || (*p == 0 && i == 0)){	/* ends with v4? */
 			p = v4parseip(to+i, op);
 			i += 4;
 			break;
 		}
+		/* v6: at most 4 hex digits, followed by colon or delim */
+		if(x != (ushort)x || *p != ':' && !delimchar(*p)) {
+			memset(to, 0, IPaddrlen);
+			return -1;			/* parse error */
+		}
 		to[i] = x>>8;
 		to[i+1] = x;
 		if(*p == ':'){
 			v4 = 0;
-			if(*++p == ':'){
+			if(*++p == ':'){	/* :: is elided zero short(s) */
+				if (elipsis) {
+					memset(to, 0, IPaddrlen);
+					return -1;	/* second :: */
+				}
 				elipsis = i+2;
 				p++;
 			}
-		}
+		} else if (p == op)		/* strtoul made no progress? */
+			break;
 	}
-	if(i < 16){
-		memmove(&to[elipsis+16-i], &to[elipsis], i-elipsis);
-		memset(&to[elipsis], 0, 16-i);
+	if (p == from || !delimchar(*p)) {
+		memset(to, 0, IPaddrlen);
+		return -1;				/* parse error */
+	}
+	if(i < IPaddrlen){
+		memmove(&to[elipsis+IPaddrlen-i], &to[elipsis], i-elipsis);
+		memset(&to[elipsis], 0, IPaddrlen-i);
 	}
 	if(v4){
 		to[10] = to[11] = 0xff;
-		return nhgetl(to+12);
+		return nhgetl(to + IPv4off);
 	} else
 		return 6;
 }
@@ -78,11 +117,11 @@ parseip(uchar *to, char *from)
  *  hack to allow ip v4 masks to be entered in the old
  *  style
  */
-ulong
+vlong
 parseipmask(uchar *to, char *from)
 {
-	ulong x;
 	int i, w;
+	vlong x;
 	uchar *p;
 
 	if(*from == '/'){
@@ -101,15 +140,16 @@ parseipmask(uchar *to, char *from)
 		x = nhgetl(to+IPv4off);
 		/*
 		 * identify as ipv6 if the mask is inexpressible as a v4 mask
-		 * (because it has too few mask bits) or indistinguishable
-		 * from the error value (all ones, -1)?  Arguably, we could
+		 * (because it has too few mask bits).  Arguably, we could
 		 * always return 6 here.
 		 */
-		if (w < 8*(IPaddrlen-IPv4addrlen) || w == 128)
+		if (w < 8*(IPaddrlen-IPv4addrlen))
 			return 6;
 	} else {
-		/* as a straight bit mask */
+		/* as a straight v4 bit mask */
 		x = parseip(to, from);
+		if (x != -1)
+			x = (ulong)nhgetl(to + IPv4off);
 		if(memcmp(to, v4prefix, IPv4off) == 0)
 			memset(to, 0xff, IPv4off);
 	}

+ 5 - 1
sys/src/libndb/dnsquery.c

@@ -22,7 +22,7 @@ dnsquery(char *net, char *val, char *type)
 	Ndbtuple *t;
 	int fd;
 
-	/* if the address is V4 or V6 null address, give up early vwhoi*/
+	/* if the address is V4 or V6 null address, give up early */
 	if(strcmp(val, "::") == 0 || strcmp(val, "0.0.0.0") == 0)
 		return nil;
 
@@ -62,6 +62,10 @@ dnsquery(char *net, char *val, char *type)
 	} else
 		t = doquery(fd, val, type);
 
+	/*
+	 * TODO: make fd static and keep it open to reduce 9P traffic
+	 * walking to /net*^/dns.
+	 */
 	close(fd);
 	ndbsetmalloctag(t, getcallerpc(&net));
 	return t;