Browse Source

Plan 9 from Bell Labs 2007-08-22

David du Colombier 16 years ago
parent
commit
9607fb6491

+ 15 - 14
dist/replica/_plan9.db

@@ -6626,7 +6626,7 @@ sys/lib/lp/process/generic - 775 sys sys 1174846328 4108
 sys/lib/lp/process/gifpost - 775 sys sys 1015012079 2317
 sys/lib/lp/process/gspipe - 775 sys sys 1015012079 434
 sys/lib/lp/process/gspipeijs - 775 sys sys 1077670465 949
-sys/lib/lp/process/hpost - 775 sys sys 1057868801 3247
+sys/lib/lp/process/hpost - 775 sys sys 1187741307 3386
 sys/lib/lp/process/jpgpost - 775 sys sys 1015012079 2313
 sys/lib/lp/process/noproc - 775 sys sys 954037459 62
 sys/lib/lp/process/p9bitpost - 775 sys sys 954037459 2436
@@ -6644,6 +6644,7 @@ sys/lib/lp/sched/FIFO - 775 sys sys 954037459 65
 sys/lib/lp/spooler - 20000000775 sys sys 1039727406 0
 sys/lib/lp/spooler/generic - 775 sys sys 954037459 1490
 sys/lib/lp/spooler/lpdspool - 775 sys sys 954037459 317
+sys/lib/lp/spooler/lpdspool+fonts - 775 sys sys 1187741096 383
 sys/lib/lp/spooler/mhcc - 775 sys sys 954037459 1748
 sys/lib/lp/spooler/nospool - 775 sys sys 1015012193 537
 sys/lib/lp/spooler/nt - 775 sys sys 954037459 313
@@ -7684,7 +7685,7 @@ sys/man/4/dossrv - 664 sys sys 1168307403 4334
 sys/man/4/execnet - 664 sys sys 1019866708 1069
 sys/man/4/exportfs - 664 sys sys 1145881912 4655
 sys/man/4/ext2srv - 664 sys sys 1055692986 2409
-sys/man/4/factotum - 664 sys sys 1185680600 14842
+sys/man/4/factotum - 664 sys sys 1187721636 14843
 sys/man/4/fossil - 664 sys sys 1186820346 9592
 sys/man/4/fs - 664 sys sys 1019058716 3387
 sys/man/4/ftpfs - 664 sys sys 1112563349 4410
@@ -7830,7 +7831,7 @@ sys/man/8/scuzz - 664 sys sys 1171566796 8701
 sys/man/8/secstore - 664 sys sys 1105016705 1954
 sys/man/8/securenet - 664 sys sys 954305552 3160
 sys/man/8/send - 664 sys sys 1045501634 2168
-sys/man/8/smtp - 664 sys sys 1184276342 4963
+sys/man/8/smtp - 664 sys sys 1187720119 5236
 sys/man/8/snoopy - 664 sys sys 1169851832 4442
 sys/man/8/stats - 664 sys sys 1161483511 4336
 sys/man/8/statusbar - 664 sys sys 1159419702 1254
@@ -7954,7 +7955,7 @@ sys/src/9/boot/bootmkfile - 664 sys sys 1091732792 404
 sys/src/9/boot/doauthenticate.c - 664 sys sys 1015012529 2300
 sys/src/9/boot/embed.c - 664 sys sys 1039763720 1191
 sys/src/9/boot/getpasswd.c - 664 sys sys 957373373 654
-sys/src/9/boot/local.c - 664 sys sys 1107436091 5619
+sys/src/9/boot/local.c - 664 sys sys 1187735779 5648
 sys/src/9/boot/mkboot - 775 sys sys 1171608307 1935
 sys/src/9/boot/nopsession.c - 664 sys sys 957373374 843
 sys/src/9/boot/paq.c - 664 sys sys 1067722601 1099
@@ -7968,31 +7969,31 @@ 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/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 1184244252 15419
+sys/src/9/ip/ethermedium.c - 664 sys sys 1187735942 15427
 sys/src/9/ip/gre.c - 664 sys sys 1187045851 5103
 sys/src/9/ip/icmp.c - 664 sys sys 1184946959 9498
 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/il.c - 664 sys sys 1184946959 27225
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
-sys/src/9/ip/ip.c - 664 sys sys 1187037311 14785
-sys/src/9/ip/ip.h - 664 sys sys 1187037311 16477
+sys/src/9/ip/ip.c - 664 sys sys 1187735970 14553
+sys/src/9/ip/ip.h - 664 sys sys 1187735964 16671
 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/ipmux.c - 664 sys sys 1187047550 14991
 sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
-sys/src/9/ip/ipv6.c - 664 sys sys 1187036522 14427
-sys/src/9/ip/ipv6.h - 664 sys sys 1187036522 4321
+sys/src/9/ip/ipv6.c - 664 sys sys 1187735957 14226
+sys/src/9/ip/ipv6.h - 664 sys sys 1187735924 4301
 sys/src/9/ip/loopbackmedium.c - 664 sys sys 1055701769 1671
 sys/src/9/ip/netdevmedium.c - 664 sys sys 1045063517 2675
 sys/src/9/ip/netlog.c - 664 sys sys 1184794933 4004
 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 1187631835 21591
+sys/src/9/ip/rudp.c - 664 sys sys 1187735906 21590
 sys/src/9/ip/tcp.c - 664 sys sys 1186406232 65963
 sys/src/9/ip/tripmedium.c - 664 sys sys 1045063515 7136
-sys/src/9/ip/udp.c - 664 sys sys 1184946959 13316
+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
@@ -8129,7 +8130,7 @@ sys/src/9/pc/trap.c - 664 sys sys 1186361997 21898
 sys/src/9/pc/uartaxp.c - 664 sys sys 1166247784 18879
 sys/src/9/pc/uarti8250.c - 664 sys sys 1177676872 13957
 sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
-sys/src/9/pc/uartpci.c - 664 sys sys 1162859151 3617
+sys/src/9/pc/uartpci.c - 664 sys sys 1187668457 4534
 sys/src/9/pc/usb.h - 664 sys sys 1165555430 4257
 sys/src/9/pc/usbuhci.c - 664 sys sys 1184466791 31205
 sys/src/9/pc/vga.c - 664 sys sys 1131290595 5148
@@ -8172,7 +8173,7 @@ 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 1187282168 41343
 sys/src/9/port/devaudio.c - 664 sys sys 1170456648 21199
-sys/src/9/port/devbridge.c - 664 sys sys 1185994684 24171
+sys/src/9/port/devbridge.c - 664 sys sys 1187735844 24076
 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/devdraw.c - 664 sys sys 1147023550 44447
@@ -8222,7 +8223,7 @@ sys/src/9/port/mkrootc - 775 sys sys 1055954695 717
 sys/src/9/port/mksystab - 664 sys sys 1014931176 783
 sys/src/9/port/mul64fract.c - 664 sys sys 1071671674 867
 sys/src/9/port/netif.c - 664 sys sys 1178831077 13474
-sys/src/9/port/netif.h - 664 sys sys 1066514947 2975
+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

+ 15 - 14
dist/replica/plan9.db

@@ -6626,7 +6626,7 @@ sys/lib/lp/process/generic - 775 sys sys 1174846328 4108
 sys/lib/lp/process/gifpost - 775 sys sys 1015012079 2317
 sys/lib/lp/process/gspipe - 775 sys sys 1015012079 434
 sys/lib/lp/process/gspipeijs - 775 sys sys 1077670465 949
-sys/lib/lp/process/hpost - 775 sys sys 1057868801 3247
+sys/lib/lp/process/hpost - 775 sys sys 1187741307 3386
 sys/lib/lp/process/jpgpost - 775 sys sys 1015012079 2313
 sys/lib/lp/process/noproc - 775 sys sys 954037459 62
 sys/lib/lp/process/p9bitpost - 775 sys sys 954037459 2436
@@ -6644,6 +6644,7 @@ sys/lib/lp/sched/FIFO - 775 sys sys 954037459 65
 sys/lib/lp/spooler - 20000000775 sys sys 1039727406 0
 sys/lib/lp/spooler/generic - 775 sys sys 954037459 1490
 sys/lib/lp/spooler/lpdspool - 775 sys sys 954037459 317
+sys/lib/lp/spooler/lpdspool+fonts - 775 sys sys 1187741096 383
 sys/lib/lp/spooler/mhcc - 775 sys sys 954037459 1748
 sys/lib/lp/spooler/nospool - 775 sys sys 1015012193 537
 sys/lib/lp/spooler/nt - 775 sys sys 954037459 313
@@ -7684,7 +7685,7 @@ sys/man/4/dossrv - 664 sys sys 1168307403 4334
 sys/man/4/execnet - 664 sys sys 1019866708 1069
 sys/man/4/exportfs - 664 sys sys 1145881912 4655
 sys/man/4/ext2srv - 664 sys sys 1055692986 2409
-sys/man/4/factotum - 664 sys sys 1185680600 14842
+sys/man/4/factotum - 664 sys sys 1187721636 14843
 sys/man/4/fossil - 664 sys sys 1186820346 9592
 sys/man/4/fs - 664 sys sys 1019058716 3387
 sys/man/4/ftpfs - 664 sys sys 1112563349 4410
@@ -7830,7 +7831,7 @@ sys/man/8/scuzz - 664 sys sys 1171566796 8701
 sys/man/8/secstore - 664 sys sys 1105016705 1954
 sys/man/8/securenet - 664 sys sys 954305552 3160
 sys/man/8/send - 664 sys sys 1045501634 2168
-sys/man/8/smtp - 664 sys sys 1184276342 4963
+sys/man/8/smtp - 664 sys sys 1187720119 5236
 sys/man/8/snoopy - 664 sys sys 1169851832 4442
 sys/man/8/stats - 664 sys sys 1161483511 4336
 sys/man/8/statusbar - 664 sys sys 1159419702 1254
@@ -7954,7 +7955,7 @@ sys/src/9/boot/bootmkfile - 664 sys sys 1091732792 404
 sys/src/9/boot/doauthenticate.c - 664 sys sys 1015012529 2300
 sys/src/9/boot/embed.c - 664 sys sys 1039763720 1191
 sys/src/9/boot/getpasswd.c - 664 sys sys 957373373 654
-sys/src/9/boot/local.c - 664 sys sys 1107436091 5619
+sys/src/9/boot/local.c - 664 sys sys 1187735779 5648
 sys/src/9/boot/mkboot - 775 sys sys 1171608307 1935
 sys/src/9/boot/nopsession.c - 664 sys sys 957373374 843
 sys/src/9/boot/paq.c - 664 sys sys 1067722601 1099
@@ -7968,31 +7969,31 @@ 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/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 1184244252 15419
+sys/src/9/ip/ethermedium.c - 664 sys sys 1187735942 15427
 sys/src/9/ip/gre.c - 664 sys sys 1187045851 5103
 sys/src/9/ip/icmp.c - 664 sys sys 1184946959 9498
 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/il.c - 664 sys sys 1184946959 27225
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
-sys/src/9/ip/ip.c - 664 sys sys 1187037311 14785
-sys/src/9/ip/ip.h - 664 sys sys 1187037311 16477
+sys/src/9/ip/ip.c - 664 sys sys 1187735970 14553
+sys/src/9/ip/ip.h - 664 sys sys 1187735964 16671
 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/ipmux.c - 664 sys sys 1187047550 14991
 sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
-sys/src/9/ip/ipv6.c - 664 sys sys 1187036522 14427
-sys/src/9/ip/ipv6.h - 664 sys sys 1187036522 4321
+sys/src/9/ip/ipv6.c - 664 sys sys 1187735957 14226
+sys/src/9/ip/ipv6.h - 664 sys sys 1187735924 4301
 sys/src/9/ip/loopbackmedium.c - 664 sys sys 1055701769 1671
 sys/src/9/ip/netdevmedium.c - 664 sys sys 1045063517 2675
 sys/src/9/ip/netlog.c - 664 sys sys 1184794933 4004
 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 1187631835 21591
+sys/src/9/ip/rudp.c - 664 sys sys 1187735906 21590
 sys/src/9/ip/tcp.c - 664 sys sys 1186406232 65963
 sys/src/9/ip/tripmedium.c - 664 sys sys 1045063515 7136
-sys/src/9/ip/udp.c - 664 sys sys 1184946959 13316
+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
@@ -8129,7 +8130,7 @@ sys/src/9/pc/trap.c - 664 sys sys 1186361997 21898
 sys/src/9/pc/uartaxp.c - 664 sys sys 1166247784 18879
 sys/src/9/pc/uarti8250.c - 664 sys sys 1177676872 13957
 sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
-sys/src/9/pc/uartpci.c - 664 sys sys 1162859151 3617
+sys/src/9/pc/uartpci.c - 664 sys sys 1187668457 4534
 sys/src/9/pc/usb.h - 664 sys sys 1165555430 4257
 sys/src/9/pc/usbuhci.c - 664 sys sys 1184466791 31205
 sys/src/9/pc/vga.c - 664 sys sys 1131290595 5148
@@ -8172,7 +8173,7 @@ 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 1187282168 41343
 sys/src/9/port/devaudio.c - 664 sys sys 1170456648 21199
-sys/src/9/port/devbridge.c - 664 sys sys 1185994684 24171
+sys/src/9/port/devbridge.c - 664 sys sys 1187735844 24076
 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/devdraw.c - 664 sys sys 1147023550 44447
@@ -8222,7 +8223,7 @@ sys/src/9/port/mkrootc - 775 sys sys 1055954695 717
 sys/src/9/port/mksystab - 664 sys sys 1014931176 783
 sys/src/9/port/mul64fract.c - 664 sys sys 1071671674 867
 sys/src/9/port/netif.c - 664 sys sys 1178831077 13474
-sys/src/9/port/netif.h - 664 sys sys 1066514947 2975
+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

+ 15 - 0
dist/replica/plan9.log

@@ -50011,3 +50011,18 @@
 1187643603 0 c sys/man/2/auth - 664 sys sys 1187643286 7538
 1187645404 0 c sys/man/2/lock - 664 sys sys 1187644134 5705
 1187647203 0 c sys/man/2/thread - 664 sys sys 1187645645 11918
+1187668804 0 c sys/src/9/pc/uartpci.c - 664 sys sys 1187668457 4534
+1187721004 0 c sys/man/8/smtp - 664 sys sys 1187720119 5236
+1187722804 0 c sys/man/4/factotum - 664 sys sys 1187721636 14843
+1187737204 0 c sys/src/9/boot/local.c - 664 sys sys 1187735779 5648
+1187737204 1 c sys/src/9/ip/ethermedium.c - 664 sys sys 1187735942 15427
+1187737204 2 c sys/src/9/ip/ip.c - 664 sys sys 1187735970 14553
+1187737204 3 c sys/src/9/ip/ip.h - 664 sys sys 1187735964 16671
+1187737204 4 c sys/src/9/ip/ipv6.c - 664 sys sys 1187735957 14226
+1187737204 5 c sys/src/9/ip/ipv6.h - 664 sys sys 1187735924 4301
+1187737204 6 c sys/src/9/ip/rudp.c - 664 sys sys 1187735906 21590
+1187737204 7 c sys/src/9/ip/udp.c - 664 sys sys 1187735914 13315
+1187737204 8 c sys/src/9/port/devbridge.c - 664 sys sys 1187735844 24076
+1187737204 9 c sys/src/9/port/netif.h - 664 sys sys 1187735815 3059
+1187742603 0 c sys/lib/lp/process/hpost - 775 sys sys 1187741307 3386
+1187742603 1 a sys/lib/lp/spooler/lpdspool+fonts - 775 sys sys 1187741096 383

+ 8 - 3
sys/lib/lp/process/hpost

@@ -35,9 +35,13 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
 	facedom=`{awk '{ if(match("'$LPMACHID'", $1)) {print $2; exit}}' /lib/face/.machinelist}
 	if (~ $#facedom 0) facedom=$LPMACHID
 
-	facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x4/.dict}
-	facedepth=4
+	facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x8/.dict}
+	facedepth=8
 
+	if (~ $#facefile 0) {
+		facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x4/.dict}
+		facedepth=4
+	}
 	if (~ $#facefile 0) {
 		facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x2/.dict}
 		facedepth=2
@@ -61,10 +65,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
 			face=`{cat $facefile |
 				sed -e 's/0x//g' -e 's/, *//g' |
 				tr 0123456789abcdef fedcba9876543210 };
-		case 4
+		case 4 8
 			face=`{iconv -u -c k4 $facefile |
 				dd -bs 60 -skip 1 >[2]/dev/null |
 				xd -b | sed 's/^[^ ]+ //;s/ //g'  }
+			facedepth=8
 		}
 	}
 }

+ 16 - 0
sys/lib/lp/spooler/lpdspool+fonts

@@ -0,0 +1,16 @@
+#!/bin/rc
+
+if (! ~ $DEBUG '') flag x +
+
+if (~ $#* 0) *='/fd/0'
+
+for (j in $*) {
+	if (~ $j '/fd/0' || test -f $j) {
+		@{bind -b $LPLIB/process /bin; $LPPROC} < $j | 
+		aux/download -f -H/sys/lib/postscript/font -mfontmap -plw+ |
+		/$cputype/bin/aux/lpdsend -d$OUTDEV -tf -H$LPMACHID -P$LPUSERID $DEST_HOST >[2]$LPLOGDIR/$LPDEST^.st
+	}
+	if not {
+		echo $j cannot be opened >[1=2]
+	}
+}

+ 1 - 1
sys/man/4/factotum

@@ -349,7 +349,7 @@ For example, the TLS and SSH host keys on a server
 often have an attribute
 .B owner=*
 to allow any user (and in particular,
-.L none )
+.LR none )
 to run the TLS or SSH server-side protocol.
 .PP
 Any key may have a

+ 26 - 1
sys/man/8/smtp

@@ -22,7 +22,10 @@ smtp, smtpd \-  mail transport
 .I destaddr
 .I sender
 .I rcpt-list
+.in -0.5i
 .PP
+.in +0.5i
+.ti -0.5i
 .B upas/smtpd
 [
 .B -adDfrg
@@ -36,6 +39,9 @@ smtp, smtpd \-  mail transport
 .B -k
 .I evilipaddr
 ] [
+.B -m
+.I mailer
+] [
 .B -n
 .I netdir
 ]
@@ -49,6 +55,8 @@ on the host at network address
 .I address 
 using the Simple Mail Transfer Protocol.
 The options are:
+.TF -
+.PD
 .TP
 .B -a
 if the server supports PLAIN or LOGIN authentication,
@@ -110,6 +118,7 @@ Finally if
 .I .domain
 is given, it is appended to the end of any unqualified system names
 in the envelope or header.
+.
 .PP
 .I Smtpd
 receives a message using the Simple Mail Transfer Protocol.
@@ -121,6 +130,8 @@ and
 protocols is supported; authenticated connections are permitted to relay.
 .PP
 The options are:
+.TF -
+.PD
 .TP
 .B -a
 requires that all clients authenticate to be able to send mail.
@@ -153,7 +164,12 @@ itself.
 Whenever a message is received and the sender's address isn't on the whitelist,
 .I smtpd
 first looks for the file
-.BI /mail/grey/tmp/\| local-ipaddr /\| remote-ipaddr /\| recipient.
+.BI /mail\%/grey\%/tmp\%/\| local\% /\| remote\% /\| recipient\fP,
+where
+.I local
+and
+.I remote
+are IP addresses of the local and remote systems, respectively.
 If it exists, the remote address is added to the whitelist.  If
 not, the file is created and the mail is rejected with a `try again'
 code.  The expectation is that spammers will not retry and that others will.
@@ -175,6 +191,15 @@ service attacks or broken mailers which continually
 connect.  The connections are not logged and the
 remote system is not notified via the protocol.
 .TP
+.B -m
+set the
+.I mailer
+to which
+.I smtpd
+passes a received message.
+The default is
+.BR /bin/upas/send .
+.TP
 .B -n
 specifies the name of the network directory assigned to the incoming connection.
 This is used to determine the peer IP address.  If this flag is not

+ 2 - 2
sys/src/9/boot/local.c

@@ -187,8 +187,6 @@ connectlocalfossil(void)
 	if(stat("/boot/fossil", statbuf, sizeof statbuf) < 0)
 		return -1;
 
-	bind("#k", "/dev", MAFTER);
-
 	/* look for fossil partition */
 	dev = disk ? disk : bootdisk;
 	snprint(partition, sizeof partition, "%sfossil", dev);
@@ -273,6 +271,8 @@ connectlocal(void)
 	if(bind("#p", "/proc", MREPL) < 0)
 		fatal("bind #p");
 	bind("#S", "/dev", MAFTER);
+	bind("#k", "/dev", MAFTER);
+	bind("#æ", "/dev", MAFTER);
 
 	if((fd = connectlocalfossil()) < 0)
 	if((fd = connectlocalkfs()) < 0)

+ 5 - 7
sys/src/9/ip/ethermedium.c

@@ -5,6 +5,7 @@
 #include "fns.h"
 #include "../port/error.h"
 
+#include "../port/netif.h"
 #include "ip.h"
 #include "ipv6.h"
 
@@ -93,9 +94,6 @@ struct Etherrock
  */
 enum
 {
-	ETARP		= 0x0806,
-	ETIP4		= 0x0800,
-	ETIP6		= 0x86DD,
 	ARPREQUEST	= 1,
 	ARPREPLY	= 2,
 };
@@ -156,12 +154,12 @@ etherbind(Ipifc *ifc, int argc, char **argv)
 	}
 
 	/*
-	 *  open ipv4 converstation
+	 *  open ipv4 conversation
 	 *
 	 *  the dial will fail if the type is already open on
 	 *  this device.
 	 */
-	snprint(addr, sizeof(addr), "%s!0x800", argv[2]);
+	snprint(addr, sizeof(addr), "%s!0x800", argv[2]);	/* ETIP4 */
 	mchan4 = chandial(addr, nil, dir, &cchan4);
 
 	/*
@@ -200,7 +198,7 @@ etherbind(Ipifc *ifc, int argc, char **argv)
 	/*
  	 *  open arp conversation
 	 */
-	snprint(addr, sizeof(addr), "%s!0x806", argv[2]);
+	snprint(addr, sizeof(addr), "%s!0x806", argv[2]);	/* ETARP */
 	achan = chandial(addr, nil, nil, nil);
 
 	/*
@@ -209,7 +207,7 @@ etherbind(Ipifc *ifc, int argc, char **argv)
 	 *  the dial will fail if the type is already open on
 	 *  this device.
 	 */
-	snprint(addr, sizeof(addr), "%s!0x86DD", argv[2]);
+	snprint(addr, sizeof(addr), "%s!0x86DD", argv[2]);	/* ETIP6 */
 	mchan6 = chandial(addr, nil, dir, &cchan6);
 
 	/*

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

@@ -12,15 +12,6 @@ typedef struct Fragment4	Fragment4;
 typedef struct Fragment6	Fragment6;
 typedef struct Ipfrag		Ipfrag;
 
-enum
-{
-	IP_HLEN4	= 0x05,		/* Header length in words */
-	IP_DF		= 0x4000,	/* Don't fragment */
-	IP_MF		= 0x2000,	/* More fragments */
-	IP6FHDR		= 8, 		/* sizeof(Fraghdr6) */
-	IP_MAX		= 64*1024,	/* Maximum Internet packet size */
-};
-
 #define BLKIPVER(xp)	(((Ip4hdr*)((xp)->rp))->vihl&0xF0)
 
 /* MIB II counters */

+ 4 - 0
sys/src/9/ip/ip.h

@@ -51,7 +51,11 @@ enum
 	V6=		6,
 	IP_VER4= 	0x40,
 	IP_VER6=	0x60,
+	IP_HLEN4=	5,		/* v4: Header length in words */
+	IP_DF=		0x4000,		/* v4: Don't fragment */
+	IP_MF=		0x2000,		/* v4: More fragments */
 	IP4HDR=		20,		/* sizeof(Ip4hdr) */
+	IP_MAX=		64*1024,	/* Max. Internet packet size, v4 & v6 */
 
 	/* 2^Lroot trees in the root table */
 	Lroot=		10,

+ 2 - 6
sys/src/9/ip/ipv6.c

@@ -10,11 +10,7 @@
 
 enum
 {
-	IP_HLEN4	= 0x05,		/* Header length in words */
-	IP_DF		= 0x4000,	/* Don't fragment */
-	IP_MF		= 0x2000,	/* More fragments */
 	IP6FHDR		= 8, 		/* sizeof(Fraghdr6) */
-	IP_MAX		= 32*1024,	/* Maximum Internet packet size */
 };
 
 #define IPV6CLASS(hdr)	(((hdr)->vcf[0]&0x0F)<<2 | ((hdr)->vcf[1]&0xF0)>>2)
@@ -154,7 +150,8 @@ ipoput6(Fs *f, Block *bp, int gating, int ttl, int tos, Conv *c)
 
 	tentative = iptentative(f, eh->src);
 	if(tentative){
-		netlog(f, Logip, "reject tx of packet with tentative src address\n");
+		netlog(f, Logip, "reject tx of packet with tentative src address %I\n",
+			eh->src);
 		goto free;
 	}
 
@@ -170,7 +167,6 @@ ipoput6(Fs *f, Block *bp, int gating, int ttl, int tos, Conv *c)
 	}
 
 	if(len >= IP_MAX){
-//		print("len > IP_MAX, free\n");
 		ip->stats[OutDiscards]++;
 		netlog(f, Logip, "exceeded ip max size %I\n", eh->dst);
 		goto free;

+ 0 - 1
sys/src/9/ip/ipv6.h

@@ -78,7 +78,6 @@ enum {
 	/* various flags & constants */
 	v6MINTU		= 1280,
 	HOP_LIMIT	= 255,
-	ETHERHDR_LEN	= 14,
 	IP6HDR		= 20,		/* sizeof(Ip6hdr) */
 
 	/* option types */

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

@@ -530,7 +530,7 @@ rudpiput(Proto *rudp, Ipifc *ifc, Block *bp)
 
 	c = iphtlook(&upriv->ht, raddr, rport, laddr, lport);
 	if(c == nil){
-		/* no converstation found */
+		/* no conversation found */
 		upriv->ustats.rudpNoPorts++;
 		qunlock(rudp);
 		netlog(f, Logudp, "udp: no conv %I!%d -> %I!%d\n", raddr, rport,

+ 1 - 1
sys/src/9/ip/udp.c

@@ -421,7 +421,7 @@ udpiput(Proto *udp, Ipifc *ifc, Block *bp)
 
 	c = iphtlook(&upriv->ht, raddr, rport, laddr, lport);
 	if(c == nil){
-		/* no converstation found */
+		/* no conversation found */
 		upriv->ustats.udpNoPorts++;
 		qunlock(udp);
 		netlog(f, Logudp, "udp: no conv %I!%d -> %I!%d\n", raddr, rport,

+ 69 - 72
sys/src/9/port/devbridge.c

@@ -1,8 +1,12 @@
+/*
+ * IPv4 Ethernet bridge
+ */
 #include "u.h"
 #include "../port/lib.h"
 #include "mem.h"
 #include "dat.h"
 #include "fns.h"
+#include "../ip/ip.h"
 #include "../port/netif.h"
 #include "../port/error.h"
 
@@ -36,7 +40,7 @@ enum
 	CacheSize=	(CacheHash+CacheLook-1),
 	CacheTimeout=	5*60,		// timeout for cache entry in seconds
 
-	TcpMssMax = 1300,			// max desirable Tcp MSS value
+	TcpMssMax = 1300,		// max desirable Tcp MSS value
 	TunnelMtu = 1400,
 };
 
@@ -82,7 +86,7 @@ struct Centry
 {
 	uchar	d[Eaddrlen];
 	int	port;
-	long	expire;		// entry expires this number of seconds after bootime
+	long	expire;		// entry expires this many seconds after bootime
 	long	src;
 	long	dst;
 };
@@ -98,7 +102,7 @@ struct Bridge
 	ulong	copy;
 	long	delay0;		// constant microsecond delay per packet
 	long	delayn;		// microsecond delay per byte
-	int tcpmss;		// modify tcpmss value
+	int	tcpmss;		// modify tcpmss value
 
 	Log;
 };
@@ -128,17 +132,12 @@ struct Port
 	int	out;		// number of packets read
 	int	outmulti;	// multicast or broadcast
 	int	outunknown;	// unknown address
-	int outfrag;	// fragmented the packet
+	int	outfrag;	// fragmented the packet
 	int	nentry;		// number of cache entries for this port
 };
 
 enum {
-	IP_VER		= 0x40,		/* Using IP version 4 */
-	IP_HLEN		= 0x05,		/* Header length in characters */
-	IP_DF		= 0x4000,	/* Don't fragment */
-	IP_MF		= 0x2000,	/* More fragments */
-	IP_MAX		= (32*1024),	/* Maximum Internet packet size */
-	IP_TCPPROTO = 6,
+	IP_TCPPROTO	= 6,
 	EOLOPT		= 0,
 	NOOPOPT		= 1,
 	MSSOPT		= 2,
@@ -198,6 +197,7 @@ bridgeinit(void)
 {
 	int i;
 	Dirtab *dt;
+
 	// setup dirtab with non directory entries
 	for(i=0; i<nelem(bridgedirtab); i++) {
 		dt = bridgedirtab + i;
@@ -222,7 +222,6 @@ bridgeattach(char* spec)
 	c = devattach('B', spec);
 	mkqid(&c->qid, QID(0, Qtopdir), 0, QTDIR);
 	c->dev = dev;
-
 	return c;
 }
 
@@ -310,7 +309,9 @@ bridgeread(Chan *c, void *a, long n, vlong off)
 		else {
 			i = 0;
 			switch(port->type) {
-			default: panic("bridgeread: unknown port type: %d", port->type);
+			default:
+				panic("bridgeread: unknown port type: %d",
+					port->type);
 			case Tether:
 				i += snprint(buf+i, sizeof(buf)-i, "ether %s: ", port->name);
 				break;
@@ -318,11 +319,13 @@ bridgeread(Chan *c, void *a, long n, vlong off)
 				i += snprint(buf+i, sizeof(buf)-i, "tunnel %s: ", port->name);
 				break;
 			}
-			ingood = port->in-port->inmulti-port->inunknown;
-			outgood = port->out-port->outmulti-port->outunknown;
-			i += snprint(buf+i, sizeof(buf)-i, "in=%d(%d:%d:%d) out=%d(%d:%d:%d:%d)\n",
+			ingood = port->in - port->inmulti - port->inunknown;
+			outgood = port->out - port->outmulti - port->outunknown;
+			i += snprint(buf+i, sizeof(buf)-i,
+				"in=%d(%d:%d:%d) out=%d(%d:%d:%d:%d)\n",
 				port->in, ingood, port->inmulti, port->inunknown,
-				port->out, outgood, port->outmulti, port->outunknown, port->outfrag);
+				port->out, outgood, port->outmulti,
+				port->outunknown, port->outfrag);
 			USED(i);
 		}
 		n = readstr(off, a, n, buf);
@@ -359,8 +362,7 @@ bridgewrite(Chan *c, void *a, long n, vlong off)
 {
 	Bridge *b = bridgetab + c->dev;
 	Cmdbuf *cb;
-	char *arg0;
-	char *p;
+	char *arg0, *p;
 	
 	USED(off);
 	switch(TYPE(c->qid)) {
@@ -442,7 +444,7 @@ bridgegen(Chan *c, char *, Dirtab*, int, int s, Dir *dp)
 
 	switch(type) {
 	default:
-		// non directory entries end up here
+		/* non-directory entries end up here */
 		if(c->qid.type & QTDIR)
 			panic("bridgegen: unexpected directory");	
 		if(s != 0)
@@ -482,7 +484,7 @@ bridgegen(Chan *c, char *, Dirtab*, int, int s, Dir *dp)
 	}
 }
 
-// also in netif.c
+// parse mac address; also in netif.c
 static int
 parseaddr(uchar *to, char *from, int alen)
 {
@@ -511,14 +513,12 @@ static void
 portbind(Bridge *b, int argc, char *argv[])
 {
 	Port *port;
-	char path[8*KNAMELEN];
-	char buf[100];
-	char *dev, *dev2=nil, *p;
 	Chan *ctl;
-	int type=0, i, n;
-	char *usage = "usage: bind ether|tunnel name ownhash dev [dev2]";
-	char name[KNAMELEN];
+	int type = 0, i, n;
 	ulong ownhash;
+	char *dev, *dev2 = nil, *p;
+	char buf[100], name[KNAMELEN], path[8*KNAMELEN];
+	static char usage[] = "usage: bind ether|tunnel name ownhash dev [dev2]";
 
 	memset(name, 0, KNAMELEN);
 	if(argc < 4)
@@ -544,9 +544,8 @@ portbind(Bridge *b, int argc, char *argv[])
 	dev = argv[3];
 	for(i=0; i<b->nport; i++) {
 		port = b->port[i];
-		if(port != nil)
-		if(port->type == type)
-		if(memcmp(port->name, name, KNAMELEN) == 0)
+		if(port != nil && port->type == type &&
+		    memcmp(port->name, name, KNAMELEN) == 0)
 			error("port in use");
 	}
 	for(i=0; i<Maxport; i++)
@@ -566,7 +565,8 @@ portbind(Bridge *b, int argc, char *argv[])
 	port->type = type;
 	memmove(port->name, name, KNAMELEN);
 	switch(port->type) {
-	default: panic("portbind: unknown port type: %d", type);
+	default:
+		panic("portbind: unknown port type: %d", type);
 	case Tether:
 		snprint(path, sizeof(path), "%s/clone", dev);
 		ctl = namec(path, Aopen, ORDWR, 0);
@@ -609,7 +609,7 @@ portbind(Bridge *b, int argc, char *argv[])
 
 	poperror();
 
-	// commited to binding port
+	/* committed to binding port */
 	b->port[port->id] = port;
 	port->bridge = b;
 	if(b->nport <= port->id)
@@ -624,11 +624,11 @@ portbind(Bridge *b, int argc, char *argv[])
 static void
 portunbind(Bridge *b, int argc, char *argv[])
 {
-	Port *port=nil;
-	int type=0, i;
-	char *usage = "usage: unbind ether|tunnel addr [ownhash]";
+	int type = 0, i;
 	char name[KNAMELEN];
 	ulong ownhash;
+	Port *port = nil;
+	static char usage[] = "usage: unbind ether|tunnel addr [ownhash]";
 
 	memset(name, 0, KNAMELEN);
 	if(argc < 2 || argc > 3)
@@ -651,9 +651,8 @@ portunbind(Bridge *b, int argc, char *argv[])
 		ownhash = 0;
 	for(i=0; i<b->nport; i++) {
 		port = b->port[i];
-		if(port != nil)
-		if(port->type == type)
-		if(memcmp(port->name, name, KNAMELEN) == 0)
+		if(port != nil && port->type == type &&
+		    memcmp(port->name, name, KNAMELEN) == 0)
 			break;
 	}
 	if(i == b->nport)
@@ -877,31 +876,29 @@ ethermultiwrite(Bridge *b, Block *bp, Port *port)
 static void
 tcpmsshack(Etherpkt *epkt, int n)
 {
-	int hl;
+	int hl, optlen;
 	Iphdr *iphdr;
 	Tcphdr *tcphdr;
-	ulong mss;
-	ulong cksum;
-	int optlen;
+	ulong mss, cksum;
 	uchar *optr;
 
-	// check it is an ip packet
-	if(nhgets(epkt->type) != 0x800)
+	/* ignore non-ipv4 packets */
+	if(nhgets(epkt->type) != ETIP4)
 		return;
 	iphdr = (Iphdr*)(epkt->data);
 	n -= ETHERHDRSIZE;
 	if(n < IPHDR)
 		return;
 
-	// check it is ok IP packet
-	if(iphdr->vihl != (IP_VER|IP_HLEN)) {
+	/* ignore bad packets */
+	if(iphdr->vihl != (IP_VER4|IP_HLEN4)) {
 		hl = (iphdr->vihl&0xF)<<2;
-		if((iphdr->vihl&0xF0) != IP_VER || hl < (IP_HLEN<<2))
+		if((iphdr->vihl&0xF0) != IP_VER4 || hl < (IP_HLEN4<<2))
 			return;
 	} else
-		hl = IP_HLEN<<2;
+		hl = IP_HLEN4<<2;
 
-	// check TCP
+	/* ignore non-tcp packets */
 	if(iphdr->proto != IP_TCPPROTO)
 		return;
 	n -= hl;
@@ -916,7 +913,7 @@ tcpmsshack(Etherpkt *epkt, int n)
 		return;
 
 	// check for MSS option
-	optr = (uchar*)(tcphdr) + sizeof(Tcphdr);
+	optr = (uchar*)tcphdr + sizeof(Tcphdr);
 	n = hl - sizeof(Tcphdr);
 	for(;;) {
 		if(n <= 0 || *optr == EOLOPT)
@@ -979,19 +976,23 @@ etherread(void *a)
 		// release lock to read - error means it is time to quit
 		qunlock(b);
 		if(waserror()) {
-print("etherread read error: %s\n", up->errstr);
+			print("etherread read error: %s\n", up->errstr);
 			qlock(b);
 			break;
 		}
-if(0)print("devbridge: etherread: reading\n");
-		bp = devtab[port->data[0]->type]->bread(port->data[0], ETHERMAXTU, 0);
-if(0)print("devbridge: etherread: blocklen = %d\n", blocklen(bp));
+		if(0)
+			print("devbridge: etherread: reading\n");
+		bp = devtab[port->data[0]->type]->bread(port->data[0],
+			ETHERMAXTU, 0);
+		if(0)
+			print("devbridge: etherread: blocklen = %d\n",
+				blocklen(bp));
 		poperror();
 		qlock(b);
 		if(bp == nil || port->closed)
 			break;
 		if(waserror()) {
-//print("etherread bridge error\n");
+//			print("etherread bridge error\n");
 			if(bp)
 				freeb(bp);
 			continue;
@@ -1038,7 +1039,7 @@ if(0)print("devbridge: etherread: blocklen = %d\n", blocklen(bp));
 		if(bp)
 			freeb(bp);
 	}
-//print("etherread: trying to exit\n");
+//	print("etherread: trying to exit\n");
 	port->readp = nil;
 	portfree(port);
 	qunlock(b);
@@ -1053,24 +1054,18 @@ fragment(Etherpkt *epkt, int n)
 	if(n <= TunnelMtu)
 		return 0;
 
-	// check it is an ip packet
-	if(nhgets(epkt->type) != 0x800)
+	/* ignore non-ipv4 packets */
+	if(nhgets(epkt->type) != ETIP4)
 		return 0;
 	iphdr = (Iphdr*)(epkt->data);
 	n -= ETHERHDRSIZE;
-	if(n < IPHDR)
-		return 0;
-
-	// check it is ok IP packet - I don't handle IP options for the momment
-	if(iphdr->vihl != (IP_VER|IP_HLEN))
-		return 0;
-
-	// check for don't fragment
-	if(iphdr->frag[0] & (IP_DF>>8))
-		return 0;
-
-	// check for short block
-	if(nhgets(iphdr->length) > n)
+	/*
+	 * ignore: IP runt packets, bad packets (I don't handle IP
+	 * options for the moment), packets with don't-fragment set,
+	 * and short blocks.
+	 */
+	if(n < IPHDR || iphdr->vihl != (IP_VER4|IP_HLEN4) ||
+	    iphdr->frag[0] & (IP_DF>>8) || nhgets(iphdr->length) > n)
 		return 0;
 
 	return 1;
@@ -1115,7 +1110,9 @@ etherwrite(Port *port, Block *bp)
 	}
 	xp->rp += offset;
 	
-if(0) print("seglen=%d, dlen=%d, mf=%x, frag=%d\n", seglen, dlen, mf, frag);
+	if(0)
+		print("seglen=%d, dlen=%d, mf=%x, frag=%d\n",
+			seglen, dlen, mf, frag);
 	for(fragoff = 0; fragoff < dlen; fragoff += seglen) {
 		nb = allocb(ETHERHDRSIZE+IPHDR+seglen);
 		
@@ -1152,7 +1149,7 @@ if(0) print("seglen=%d, dlen=%d, mf=%x, frag=%d\n", seglen, dlen, mf, frag);
 		feh->cksum[1] = 0;
 		hnputs(feh->cksum, ipcsum(&feh->vihl));
 	
-		// don't generate small packets
+		/* don't generate small packets */
 		if(BLEN(nb) < ETHERMINTU)
 			nb->wp = nb->rp + ETHERMINTU;
 		devtab[port->data[1]->type]->bwrite(port->data[1], nb, 0);

+ 5 - 0
sys/src/9/port/netif.h

@@ -123,6 +123,11 @@ enum
 	ETHERMINTU =	60,		/* minimum transmit size */
 	ETHERMAXTU =	1514,		/* maximum transmit size */
 	ETHERHDRSIZE =	14,		/* size of an ethernet header */
+
+	/* ethernet packet types */
+	ETARP		= 0x0806,
+	ETIP4		= 0x0800,
+	ETIP6		= 0x86DD,
 };
 
 struct Etherpkt