Browse Source

Plan 9 from Bell Labs 2007-01-24

David du Colombier 17 years ago
parent
commit
1f5c5889b9
5 changed files with 263 additions and 121 deletions
  1. 31 2
      dist/replica/_plan9.db
  2. 31 31
      dist/replica/plan9.db
  3. 32 0
      dist/replica/plan9.log
  4. 159 87
      sys/man/3/ip
  5. 10 1
      sys/src/libip/parseip.c

+ 31 - 2
dist/replica/_plan9.db

@@ -7582,7 +7582,7 @@ sys/man/3/ether - 664 sys sys 984709635 2563
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1165622643 2702
 sys/man/3/i82365 - 664 sys sys 954378906 884
-sys/man/3/ip - 664 sys sys 1169494390 21816
+sys/man/3/ip - 664 sys sys 1169599032 22614
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
 sys/man/3/kprof - 664 sys sys 1018029972 1377
 sys/man/3/loopback - 664 sys sys 964662153 1995
@@ -15233,7 +15233,7 @@ sys/src/libip/mkfile - 664 sys sys 1065576347 320
 sys/src/libip/myetheraddr.c - 664 sys sys 1066515138 837
 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 950104689 2130
+sys/src/libip/parseip.c - 664 sys sys 1169595542 2429
 sys/src/libip/ptclbsum.c - 664 sys sys 1132452948 1160
 sys/src/libip/readipifc.c - 664 sys sys 1161442538 4247
 sys/src/libip/testreadipifc.c - 664 sys sys 1021580003 400
@@ -15678,3 +15678,32 @@ 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
+386/bin/hget - 775 sys sys 1169612024 233943
+386/bin/ftpfs - 775 sys sys 1169612023 273246
+386/bin/netstat - 775 sys sys 1169612032 85184
+386/bin/snoopy - 775 sys sys 1169612032 183527
+386/bin/aquarela - 775 sys sys 1169612017 332788
+386/bin/auth/authsrv - 775 sys sys 1169612018 166651
+386/bin/auth/guard.srv - 775 sys sys 1169612018 143828
+386/bin/auth/secstored - 775 sys sys 1169612019 198002
+386/bin/aux/nfsserver - 775 sys sys 1169612019 185943
+386/bin/aux/pcnfsd - 775 sys sys 1169612020 129843
+386/bin/aux/portmapper - 775 sys sys 1169612021 128924
+386/bin/aux/timesync - 775 sys sys 1169612021 128694
+386/bin/cifscmd - 775 sys sys 1169612022 343611
+386/bin/ip/dhcpd - 775 sys sys 1169612024 151139
+386/bin/ip/dhcpleases - 775 sys sys 1169612024 86533
+386/bin/ip/ftpd - 775 sys sys 1169612025 170706
+386/bin/ip/ipconfig - 775 sys sys 1169612025 139550
+386/bin/ip/ppp - 775 sys sys 1169612026 220423
+386/bin/ip/pptp - 775 sys sys 1169612026 127215
+386/bin/ip/pptpd - 775 sys sys 1169612027 126140
+386/bin/ip/rarpd - 775 sys sys 1169612027 113077
+386/bin/ip/rip - 775 sys sys 1169612027 91489
+386/bin/ip/tftpd - 775 sys sys 1169612028 132083
+386/bin/ndb/cs - 775 sys sys 1169612028 150911
+386/bin/ndb/dns - 775 sys sys 1169612029 247301
+386/bin/ndb/dnsdebug - 775 sys sys 1169612030 221780
+386/bin/ndb/dnstcp - 775 sys sys 1169612031 220748
+386/bin/ndb/ipquery - 775 sys sys 1169612031 96994
+386/lib/libip.a - 664 sys sys 1169612032 35672

+ 31 - 31
dist/replica/plan9.db

@@ -37,7 +37,7 @@
 386/bin/ape/stty - 775 sys sys 1148500571 41080
 386/bin/ape/tar - 775 sys sys 1168402264 62184
 386/bin/ape/uname - 775 sys sys 1143741925 134338
-386/bin/aquarela - 775 sys sys 1168402264 332748
+386/bin/aquarela - 775 sys sys 1169612017 332788
 386/bin/ar - 775 sys sys 1168402265 113774
 386/bin/archfs - 775 sys sys 1168402265 147070
 386/bin/ascii - 775 sys sys 1168402265 64884
@@ -45,7 +45,7 @@
 386/bin/auth - 20000000775 sys sys 1016920815 0
 386/bin/auth/aescbc - 775 sys sys 1168402266 140919
 386/bin/auth/asn12rsa - 775 sys sys 1168402266 120828
-386/bin/auth/authsrv - 775 sys sys 1168402266 166611
+386/bin/auth/authsrv - 775 sys sys 1169612018 166651
 386/bin/auth/changeuser - 775 sys sys 1168402267 97488
 386/bin/auth/convkeys - 775 sys sys 1168402267 88057
 386/bin/auth/convkeys2 - 775 sys sys 1168402267 88116
@@ -55,7 +55,7 @@
 386/bin/auth/enable - 775 sys sys 1020319057 134
 386/bin/auth/factotum - 775 sys sys 1168402269 322131
 386/bin/auth/fgui - 775 sys sys 1168402269 218990
-386/bin/auth/guard.srv - 775 sys sys 1168402269 143788
+386/bin/auth/guard.srv - 775 sys sys 1169612018 143828
 386/bin/auth/iam - 775 sys sys 1085076981 50791
 386/bin/auth/keyfs - 775 sys sys 1168402270 116158
 386/bin/auth/login - 775 sys sys 1168402270 104747
@@ -72,7 +72,7 @@
 386/bin/auth/rsagen - 775 sys sys 1168402273 153528
 386/bin/auth/secretpem - 775 sys sys 1045537944 118526
 386/bin/auth/secstore - 775 sys sys 1168402274 196045
-386/bin/auth/secstored - 775 sys sys 1168402274 197962
+386/bin/auth/secstored - 775 sys sys 1169612019 198002
 386/bin/auth/secuser - 775 sys sys 1168402275 153231
 386/bin/auth/status - 775 sys sys 1020319060 738
 386/bin/auth/uniq - 775 sys sys 1168402275 63314
@@ -123,13 +123,13 @@
 386/bin/aux/mswordstrings - 775 sys sys 1168402283 65541
 386/bin/aux/na - 775 sys sys 1168402284 154423
 386/bin/aux/nfsmount - 775 sys sys 1168402284 234691
-386/bin/aux/nfsserver - 775 sys sys 1168402284 185903
+386/bin/aux/nfsserver - 775 sys sys 1169612019 185943
 386/bin/aux/olefs - 775 sys sys 1168402285 149519
 386/bin/aux/p9bitpost - 775 sys sys 1104121982 127974
 386/bin/aux/pcmcia - 775 sys sys 1148500601 46940
-386/bin/aux/pcnfsd - 775 sys sys 1168402285 129803
+386/bin/aux/pcnfsd - 775 sys sys 1169612020 129843
 386/bin/aux/portmap - 775 sys sys 1168402286 144211
-386/bin/aux/portmapper - 775 sys sys 1168402286 128884
+386/bin/aux/portmapper - 775 sys sys 1169612021 128924
 386/bin/aux/postgif - 775 sys sys 1087442507 175380
 386/bin/aux/postprint - 775 sys sys 1087442507 160041
 386/bin/aux/postreverse - 775 sys sys 1087442508 164726
@@ -145,7 +145,7 @@
 386/bin/aux/stub - 775 sys sys 1168402287 141090
 386/bin/aux/tcpostio - 775 sys sys 1094040084 200808
 386/bin/aux/text2post - 775 sys sys 1104121986 78336
-386/bin/aux/timesync - 775 sys sys 1168402288 128654
+386/bin/aux/timesync - 775 sys sys 1169612021 128694
 386/bin/aux/tr2post - 775 sys sys 1104121987 176578
 386/bin/aux/trampoline - 775 sys sys 1168402288 84145
 386/bin/aux/typepasswd - 775 sys sys 1168402288 69738
@@ -179,7 +179,7 @@
 386/bin/cfs - 775 sys sys 1168402294 128271
 386/bin/chgrp - 775 sys sys 1168402294 59522
 386/bin/chmod - 775 sys sys 1168402294 62518
-386/bin/cifscmd - 775 sys sys 1168402295 343571
+386/bin/cifscmd - 775 sys sys 1169612022 343611
 386/bin/cleanname - 775 sys sys 1168402295 58541
 386/bin/clock - 775 sys sys 1168402296 158688
 386/bin/cmp - 775 sys sys 1157597609 40658
@@ -248,7 +248,7 @@
 386/bin/fs/v10fs - 775 sys sys 1134389867 94594
 386/bin/fs/v6fs - 775 sys sys 1134389867 94512
 386/bin/fs/zipfs - 775 sys sys 1134389867 109110
-386/bin/ftpfs - 775 sys sys 1168402311 273206
+386/bin/ftpfs - 775 sys sys 1169612023 273246
 386/bin/games - 20000000775 sys sys 1096298711 0
 386/bin/games/4s - 775 sys sys 1132506854 178226
 386/bin/games/5s - 775 sys sys 1132506855 180514
@@ -271,7 +271,7 @@
 386/bin/gview - 775 sys sys 1168402313 238983
 386/bin/gzip - 775 sys sys 1168402313 84984
 386/bin/hayes - 775 sys sys 1168402314 64793
-386/bin/hget - 775 sys sys 1168402314 233903
+386/bin/hget - 775 sys sys 1169612024 233943
 386/bin/history - 775 sys sys 1168402314 75705
 386/bin/hoc - 775 sys sys 1168402314 100096
 386/bin/html2ms - 775 sys sys 1168402315 66321
@@ -284,9 +284,9 @@
 386/bin/iostats - 775 sys sys 1168402317 100378
 386/bin/ip - 20000000775 sys sys 1016920851 0
 386/bin/ip/dhcpclient - 775 sys sys 1168402317 94377
-386/bin/ip/dhcpd - 775 sys sys 1168402318 151055
-386/bin/ip/dhcpleases - 775 sys sys 1168402318 86449
-386/bin/ip/ftpd - 775 sys sys 1168402318 170666
+386/bin/ip/dhcpd - 775 sys sys 1169612024 151139
+386/bin/ip/dhcpleases - 775 sys sys 1169612024 86533
+386/bin/ip/ftpd - 775 sys sys 1169612025 170706
 386/bin/ip/gizzard - 775 sys sys 1081480408 101521
 386/bin/ip/gping - 775 sys sys 1168402319 183451
 386/bin/ip/hogports - 775 sys sys 1148500655 42914
@@ -301,18 +301,18 @@
 386/bin/ip/httpd/wikipost - 775 sys sys 1168402323 114908
 386/bin/ip/httpfile - 775 sys sys 1168402324 284262
 386/bin/ip/imap4d - 775 sys sys 1169265834 238152
-386/bin/ip/ipconfig - 775 sys sys 1168402325 139510
+386/bin/ip/ipconfig - 775 sys sys 1169612025 139550
 386/bin/ip/ping - 775 sys sys 1169151814 84622
-386/bin/ip/ppp - 775 sys sys 1168402326 220383
+386/bin/ip/ppp - 775 sys sys 1169612026 220423
 386/bin/ip/pppoe - 775 sys sys 1168402326 77787
-386/bin/ip/pptp - 775 sys sys 1168402326 127175
-386/bin/ip/pptpd - 775 sys sys 1168402327 126100
-386/bin/ip/rarpd - 775 sys sys 1168402327 113037
+386/bin/ip/pptp - 775 sys sys 1169612026 127215
+386/bin/ip/pptpd - 775 sys sys 1169612027 126140
+386/bin/ip/rarpd - 775 sys sys 1169612027 113077
 386/bin/ip/rexexec - 775 sys sys 1168402327 90215
-386/bin/ip/rip - 775 sys sys 1168402328 91449
+386/bin/ip/rip - 775 sys sys 1169612027 91489
 386/bin/ip/rlogind - 775 sys sys 1168402328 67654
 386/bin/ip/telnetd - 775 sys sys 1168402329 123319
-386/bin/ip/tftpd - 775 sys sys 1168402329 132043
+386/bin/ip/tftpd - 775 sys sys 1169612028 132083
 386/bin/ip/traceroute - 775 sys sys 1169179342 74185
 386/bin/ip/udpecho - 775 sys sys 1148500666 43190
 386/bin/join - 775 sys sys 1168402330 114382
@@ -337,19 +337,19 @@
 386/bin/mug - 775 sys sys 1168402336 176379
 386/bin/mv - 775 sys sys 1168402336 66629
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1168402337 150871
+386/bin/ndb/cs - 775 sys sys 1169612028 150911
 386/bin/ndb/csquery - 775 sys sys 1168402337 61702
-386/bin/ndb/dns - 775 sys sys 1168402338 247261
-386/bin/ndb/dnsdebug - 775 sys sys 1168402338 221740
+386/bin/ndb/dns - 775 sys sys 1169612029 247301
+386/bin/ndb/dnsdebug - 775 sys sys 1169612030 221780
 386/bin/ndb/dnsquery - 775 sys sys 1168402339 63870
-386/bin/ndb/dnstcp - 775 sys sys 1168402339 220708
-386/bin/ndb/ipquery - 775 sys sys 1168402340 96954
+386/bin/ndb/dnstcp - 775 sys sys 1169612031 220748
+386/bin/ndb/ipquery - 775 sys sys 1169612031 96994
 386/bin/ndb/mkdb - 775 sys sys 1168402340 64211
 386/bin/ndb/mkhash - 775 sys sys 1168402340 84780
 386/bin/ndb/mkhosts - 775 sys sys 1168402340 85823
 386/bin/ndb/query - 775 sys sys 1168402340 83962
 386/bin/netkey - 775 sys sys 1168402341 72717
-386/bin/netstat - 775 sys sys 1168402341 85144
+386/bin/netstat - 775 sys sys 1169612032 85184
 386/bin/news - 775 sys sys 1168402341 71956
 386/bin/nfs - 775 sys sys 1168402342 321573
 386/bin/nm - 775 sys sys 1168402342 127013
@@ -404,7 +404,7 @@
 386/bin/snap - 775 sys sys 1136346852 313627
 386/bin/snapfs - 775 sys sys 1134389876 388292
 386/bin/sniffer - 775 sys sys 1038443185 99028
-386/bin/snoopy - 775 sys sys 1168402349 183487
+386/bin/snoopy - 775 sys sys 1169612032 183527
 386/bin/sort - 775 sys sys 1168402349 82523
 386/bin/spin - 775 sys sys 1134151359 758520
 386/bin/split - 775 sys sys 1168402349 75886
@@ -558,7 +558,7 @@
 386/lib/libgeometry.a - 664 sys sys 1168402366 50470
 386/lib/libhtml.a - 664 sys sys 1168402366 229152
 386/lib/libhttpd.a - 664 sys sys 1168402367 99458
-386/lib/libip.a - 664 sys sys 1168402367 35552
+386/lib/libip.a - 664 sys sys 1169612032 35672
 386/lib/libl.a - 664 sys sys 1168402367 5372
 386/lib/libmach.a - 664 sys sys 1168402369 785352
 386/lib/libmemdraw.a - 664 sys sys 1168402369 284092
@@ -7582,7 +7582,7 @@ sys/man/3/ether - 664 sys sys 984709635 2563
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1165622643 2702
 sys/man/3/i82365 - 664 sys sys 954378906 884
-sys/man/3/ip - 664 sys sys 1169494390 21816
+sys/man/3/ip - 664 sys sys 1169599032 22614
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
 sys/man/3/kprof - 664 sys sys 1018029972 1377
 sys/man/3/loopback - 664 sys sys 964662153 1995
@@ -15233,7 +15233,7 @@ sys/src/libip/mkfile - 664 sys sys 1065576347 320
 sys/src/libip/myetheraddr.c - 664 sys sys 1066515138 837
 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 950104689 2130
+sys/src/libip/parseip.c - 664 sys sys 1169595542 2429
 sys/src/libip/ptclbsum.c - 664 sys sys 1132452948 1160
 sys/src/libip/readipifc.c - 664 sys sys 1161442538 4247
 sys/src/libip/testreadipifc.c - 664 sys sys 1021580003 400

+ 32 - 0
dist/replica/plan9.log

@@ -47412,3 +47412,35 @@
 1169494207 1 c sys/src/9/pc/l.s - 664 sys sys 1169492952 28736
 1169496007 0 c sys/man/3/ip - 664 sys sys 1169494390 21816
 1169499607 0 c sys/src/9/port/devenv.c - 664 sys sys 1169498893 7015
+1169595005 0 c sys/man/3/ip - 664 sys sys 1169593571 22613
+1169596807 0 c sys/src/libip/parseip.c - 664 sys sys 1169595542 2429
+1169600407 0 c sys/man/3/ip - 664 sys sys 1169599032 22614
+1169613006 0 c 386/bin/hget - 775 sys sys 1169612024 233943
+1169613006 1 c 386/bin/ftpfs - 775 sys sys 1169612023 273246
+1169613006 2 c 386/bin/netstat - 775 sys sys 1169612032 85184
+1169613006 3 c 386/bin/snoopy - 775 sys sys 1169612032 183527
+1169613006 4 c 386/bin/aquarela - 775 sys sys 1169612017 332788
+1169613006 5 c 386/bin/auth/authsrv - 775 sys sys 1169612018 166651
+1169613006 6 c 386/bin/auth/guard.srv - 775 sys sys 1169612018 143828
+1169613006 7 c 386/bin/auth/secstored - 775 sys sys 1169612019 198002
+1169613006 8 c 386/bin/aux/nfsserver - 775 sys sys 1169612019 185943
+1169613006 9 c 386/bin/aux/pcnfsd - 775 sys sys 1169612020 129843
+1169613006 10 c 386/bin/aux/portmapper - 775 sys sys 1169612021 128924
+1169613006 11 c 386/bin/aux/timesync - 775 sys sys 1169612021 128694
+1169613006 12 c 386/bin/cifscmd - 775 sys sys 1169612022 343611
+1169613006 13 c 386/bin/ip/dhcpd - 775 sys sys 1169612024 151139
+1169613006 14 c 386/bin/ip/dhcpleases - 775 sys sys 1169612024 86533
+1169613006 15 c 386/bin/ip/ftpd - 775 sys sys 1169612025 170706
+1169613006 16 c 386/bin/ip/ipconfig - 775 sys sys 1169612025 139550
+1169613006 17 c 386/bin/ip/ppp - 775 sys sys 1169612026 220423
+1169613006 18 c 386/bin/ip/pptp - 775 sys sys 1169612026 127215
+1169613006 19 c 386/bin/ip/pptpd - 775 sys sys 1169612027 126140
+1169613006 20 c 386/bin/ip/rarpd - 775 sys sys 1169612027 113077
+1169613006 21 c 386/bin/ip/rip - 775 sys sys 1169612027 91489
+1169613006 22 c 386/bin/ip/tftpd - 775 sys sys 1169612028 132083
+1169613006 23 c 386/bin/ndb/cs - 775 sys sys 1169612028 150911
+1169613006 24 c 386/bin/ndb/dns - 775 sys sys 1169612029 247301
+1169613006 25 c 386/bin/ndb/dnsdebug - 775 sys sys 1169612030 221780
+1169613006 26 c 386/bin/ndb/dnstcp - 775 sys sys 1169612031 220748
+1169613006 27 c 386/bin/ndb/ipquery - 775 sys sys 1169612031 96994
+1169613006 28 c 386/lib/libip.a - 664 sys sys 1169612032 35672

+ 159 - 87
sys/man/3/ip

@@ -1,27 +1,30 @@
-.TH IP 3 
+.TH IP 3
 .SH NAME
 ip \- network protocols over IP
 .SH SYNOPSIS
 .nf
+.2C
 .B bind -a #I\fIspec\fP /net
 
 .B /net/ipifc
 .B /net/ipifc/clone
 .B /net/ipifc/stats
-.BI /net/ipifc/ n 
+.BI /net/ipifc/ n
 .BI /net/ipifc/ n /status
 .BI /net/ipifc/ n /ctl
 \&...
 
 .B /net/arp
-.B /net/log
-.B /net/ndb
+.B /net/bootp
 .B /net/iproute
 .B /net/ipselftab
+.B /net/log
+.B /net/ndb
 
 .B /net/esp
 .B /net/gre
 .B /net/icmp
+.B /net/icmpv6
 .B /net/il
 .B /net/ipmux
 .B /net/rudp
@@ -30,7 +33,7 @@ ip \- network protocols over IP
 
 .B /net/tcp/clone
 .B /net/tcp/stats
-.BI /net/tcp/ n 
+.BI /net/tcp/ n
 .BI /net/tcp/ n /data
 .BI /net/tcp/ n /ctl
 .BI /net/tcp/ n /local
@@ -38,12 +41,13 @@ ip \- network protocols over IP
 .BI /net/tcp/ n /status
 .BI /net/tcp/ n /listen
 \&...
+.1C
 .fi
 .SH DESCRIPTION
 The IP device provides the interface to Internet protocol stacks.
 .I Spec
 is an integer from 0 to 15 identifying a stack.
-Each stack is physically independent of all others:
+Each stack is independent of all others:
 the only information transfer between them is via programs that
 mount multiple stacks.
 Normally a system uses only one stack.
@@ -55,11 +59,11 @@ All addresses used are 16-byte IPv6 addresses.
 We implement IPv4 and IPv6.
 IPv4 addresses are a subset of the IPv6 addresses and both standard
 .SM ASCII
-formats
-are accepted.  In binary, all v4 addresses start with the
-12 bytes:
+formats are accepted.
+In binary representation, all v4 addresses start with the 12 bytes, in hex:
+.IP
 .EX
-	00 00 00 00 00 00 00 00 00 00 ff ff
+00 00 00 00 00 00 00 00 00 00 ff ff
 .EE
 .SS "Configuring interfaces
 .PP
@@ -90,6 +94,8 @@ alters aspects of the interface.
 The possible
 .I ctl
 messages are:
+.TF "bind loopback"
+.PD
 .TP
 .BI "bind ether " path
 Treat the device mounted at
@@ -350,6 +356,8 @@ three white-space-separated fields: IP address, usage count,
 and flags.  The usage count is the number of interfaces to which
 the address applies.  The flags are the same as for routing
 entries.
+.br
+.ne 3
 .SS "Protocol directories
 .PP
 The
@@ -416,6 +424,8 @@ file (see
 to receive incoming calls.
 .PP
 The following control messages are supported:
+.TF "bind X"
+.PD
 .TP
 .BI connect\  ipaddress ! port "!r " local
 Establish a connection to the remote address
@@ -431,7 +441,7 @@ is not specified but
 .B !r
 is, the system will allocate
 a restricted port number (less than 1024) for the connection to allow communication
-with Unix  
+with Unix
 .B login
 and
 .B exec
@@ -529,7 +539,7 @@ TCP connections are reliable point-to-point byte streams; there are no
 message delimiters.
 A connection is determined by the address and port numbers of the two
 ends.
-TCP 
+TCP
 .B ctl
 files support the following additional messages:
 .TP
@@ -565,20 +575,34 @@ one of the following messages is written to
 .BR ctl ,
 then all messages sent to the announced port
 are received on the announced connection prefixed with the given structure.
+.TP
 .B headers
 .EX
 typedef struct Udphdr Udphdr;
 struct Udphdr
 {
-	uchar	raddr[16];	/* v6 remote address and port */
-	uchar	laddr[16];	/* v6 local address and port */
-	uchar	ifcaddr[16];	/* interface address (receive only) */
-	uchar	rport[2];
-	uchar	lport[2];
+	uchar	raddr[16];	/* V6 remote address and port */
+	uchar	laddr[16];	/* V6 local address and port */
+	uchar	ifcaddr[16];	/* V6 interface address (receive only) */
+	uchar	rport[2];	/* remote port */
+	uchar	lport[2];	/* local port */
+};
+.TP
+.B oldheaders
+.EX
+typedef struct OUdphdr OUdphdr;
+struct OUdphdr
+{
+	uchar	raddr[16];	/* V6 remote address and port */
+	uchar	laddr[16];	/* V6 local address and port */
+	uchar	rport[2];	/* remote port */
+	uchar	lport[2];	/* local port */
 };
 .EE
 .PP
-The only difference in the two is the type of address, IPv4 or IPv6.
+.L oldheaders
+is now considered obsolete and should not be used in new programs.
+.PP
 Before a write, a user must prefix a similar structure to each message.
 The system overrides the user specified local port with the announced
 one.  If the user specifies an address that isn't a unicast address in
@@ -587,7 +611,28 @@ that too is overridden.
 Since the prefixed structure is the same in read and write, it is relatively
 easy to write a server that responds to client requests by just copying new
 data into the message body and then writing back the same buffer that was
-written.
+read.
+.PP
+In this case (writing
+.L headers
+or
+.L noheaders
+to the
+.I ctl
+file),
+no
+.I listen
+nor
+.I accept
+is needed;
+otherwise,
+the usual sequence of
+.IR announce ,
+.IR listen ,
+.I accept
+must be executed before performing I/O on the corresponding
+.I data
+file.
 .SS RUDP
 .PP
 RUDP is a reliable datagram protocol based on UDP.
@@ -599,7 +644,7 @@ One must use either
 or
 .B announce
 followed immediately by
-.B headers .
+.BR headers .
 .PP
 Unlike IL or TCP, the reboot of one end of a connection does
 not force a closing of the connection.  Communications will
@@ -678,6 +723,8 @@ Received packets are checked against their MAC's,
 decrypted, and queued for reading from
 .BR data .
 The control messages are:
+.TF "alg secret"
+.PD
 .TP
 .BI esp\  "alg secret
 Encrypt with the algorithm,
@@ -731,6 +778,8 @@ file are routed to an interface and transmitted.
 A filter is a semicolon-separated list of
 relations.  Each relation describes a portion
 of a packet to match.  The possible relations are:
+.TF "ifc=expr"
+.PD
 .TP
 .BI proto= n
 the IP protocol number must be
@@ -808,25 +857,30 @@ Reading
 returns a list of 19 tagged and new line separated fields representing:
 .EX
 .ft 1
-	forwarding status (0 and 2 mean forwarding off, 1 means on)
-	default TTL
-	input packets
-	input header errors
-	input address errors
-	packets forwarded
-	input packets for unknown protocols
-	input packets discarded
-	input packets delivered to higher level protocols
-	output packets
-	output packets discarded
-	output packets with no route
-	timed out fragments in reassembly queue
-	requested reassemblies
-	successful reassemblies
-	failed reassemblies
-	successful fragmentations
-	unsuccessful fragmentations
-	fragments created
+.2C
+.in +0.25i
+forwarding status (0 and 2 mean forwarding off,
+	1 means on)
+default TTL
+input packets
+input header errors
+input address errors
+packets forwarded
+input packets for unknown protocols
+input packets discarded
+input packets delivered to higher level protocols
+output packets
+output packets discarded
+output packets with no route
+timed out fragments in reassembly queue
+requested reassemblies
+successful reassemblies
+failed reassemblies
+successful fragmentations
+unsuccessful fragmentations
+fragments created
+.in -0.25i
+.1C
 .ft
 .EE
 .PP
@@ -835,32 +889,36 @@ Reading
 returns a list of 25 tagged and new line separated fields representing:
 .EX
 .ft 1
-	messages received 
-	bad received messages
-	unreachables received
-	time exceededs received
-	input parameter problems received
-	source quenches received
-	redirects received
-	echo requests received
-	echo replies received
-	timestamps received
-	timestamp replies received
-	address mask requests received
-	address mask replies received
-	messages sent
-	transmission errors
-	unreachables sent
-	time exceededs sent
-	input parameter problems sent
-	source quenches sent
-	redirects sent
-	echo requests sent
-	echo replies sent
-	timestamps sent
-	timestamp replies sent
-	address mask requests sent
-	address mask replies sent
+.2C
+.in +0.25i
+messages received
+bad received messages
+unreachables received
+time exceededs received
+input parameter problems received
+source quenches received
+redirects received
+echo requests received
+echo replies received
+timestamps received
+timestamp replies received
+address mask requests received
+address mask replies received
+messages sent
+transmission errors
+unreachables sent
+time exceededs sent
+input parameter problems sent
+source quenches sent
+redirects sent
+echo requests sent
+echo replies sent
+timestamps sent
+timestamp replies sent
+address mask requests sent
+address mask replies sent
+.in -0.25i
+.1C
 .EE
 .PP
 Reading
@@ -868,17 +926,21 @@ Reading
 returns a list of 11 tagged and new line separated fields representing:
 .EX
 .ft 1
-	maximum number of connections
-	total outgoing calls
-	total incoming calls
-	number of established connections to be reset
-	number of currently established connections
-	segments received
-	segments sent
-	segments retransmitted
-	retransmit timeouts
-	bad received segments
-	transmission failures
+.2C
+.in +0.25i
+maximum number of connections
+total outgoing calls
+total incoming calls
+number of established connections to be reset
+number of currently established connections
+segments received
+segments sent
+segments retransmitted
+retransmit timeouts
+bad received segments
+transmission failures
+.in -0.25i
+.1C
 .EE
 .PP
 Reading
@@ -886,10 +948,14 @@ Reading
 returns a list of 4 tagged and new line separated fields representing:
 .EX
 .ft 1
-	datagrams received
-	datagrams received for bad ports
-	malformed datagrams received
-	datagrams sent
+.2C
+.in +0.25i
+datagrams received
+datagrams received for bad ports
+malformed datagrams received
+datagrams sent
+.in -0.25i
+.1C
 .EE
 .PP
 Reading
@@ -897,12 +963,16 @@ Reading
 returns a list of 7 tagged and new line separated fields representing:
 .EX
 .ft 1
-	checksum errors
-	header length errors
-	out of order messages
-	retransmitted messages
-	duplicate messages
-	duplicate bytes
+.2C
+.in +0.25i
+checksum errors
+header length errors
+out of order messages
+retransmitted messages
+duplicate messages
+duplicate bytes
+.in -0.25i
+.1C
 .EE
 .PP
 Reading
@@ -910,7 +980,9 @@ Reading
 returns a list of 1 tagged number representing:
 .EX
 .ft 1
-	header length errors
+.in +0.25i
+header length errors
+.in -0.25i
 .EE
 .SH "SEE ALSO"
 .IR listen (8),

+ 10 - 1
sys/src/libip/parseip.c

@@ -82,7 +82,7 @@ ulong
 parseipmask(uchar *to, char *from)
 {
 	ulong x;
-	int i;
+	int i, w;
 	uchar *p;
 
 	if(*from == '/'){
@@ -92,12 +92,21 @@ parseipmask(uchar *to, char *from)
 			i = 0;
 		if(i > 128)
 			i = 128;
+		w = i;
 		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);
+		/*
+		 * 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
+		 * always return 6 here.
+		 */
+		if (w < 8*(IPaddrlen-IPv4addrlen) || w == 128)
+			return 6;
 	} else {
 		/* as a straight bit mask */
 		x = parseip(to, from);