Browse Source

Plan 9 from Bell Labs 2007-07-28

David du Colombier 13 years ago
parent
commit
bdc15c5a01

+ 7 - 7
dist/replica/_plan9.db

@@ -472,7 +472,7 @@
 386/bin/upas/runq - 775 sys sys 1178568314 112842
 386/bin/upas/scanmail - 775 sys sys 1181507271 128207
 386/bin/upas/send - 775 sys sys 1181507272 192174
-386/bin/upas/smtp - 775 sys sys 1184529906 275100
+386/bin/upas/smtp - 775 sys sys 1185566684 275107
 386/bin/upas/smtpd - 775 sys sys 1181540422 331887
 386/bin/upas/spam - 775 sys sys 1064598366 36
 386/bin/upas/testscan - 775 sys sys 1181507272 83858
@@ -7642,7 +7642,7 @@ sys/man/3/ether - 664 sys sys 1178597986 2890
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/i82365 - 664 sys sys 954378906 884
-sys/man/3/ip - 664 sys sys 1185396805 25985
+sys/man/3/ip - 664 sys sys 1185565401 26009
 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
@@ -8044,10 +8044,10 @@ sys/src/9/pc/ether2114x.c - 664 sys sys 1184468570 41707
 sys/src/9/pc/ether589.c - 664 sys sys 1015014516 4644
 sys/src/9/pc/ether79c970.c - 664 sys sys 1160070602 14088
 sys/src/9/pc/ether8003.c - 664 sys sys 1015014516 6665
-sys/src/9/pc/ether8139.c - 664 sys sys 1185490762 18594
-sys/src/9/pc/ether8169.c - 664 sys sys 1185490910 25476
+sys/src/9/pc/ether8139.c - 664 sys sys 1185509068 18584
+sys/src/9/pc/ether8169.c - 664 sys sys 1185509068 25466
 sys/src/9/pc/ether82543gc.c - 664 sys sys 1131290377 32294
-sys/src/9/pc/ether82557.c - 664 sys sys 1153082663 30197
+sys/src/9/pc/ether82557.c - 664 sys sys 1185509068 30197
 sys/src/9/pc/ether82563.c - 664 sys sys 1178932992 32729
 sys/src/9/pc/ether83815.c - 664 sys sys 1172259521 26346
 sys/src/9/pc/ether8390.c - 664 sys sys 1131290377 17702
@@ -12462,7 +12462,7 @@ 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 1184878450 7455
+sys/src/cmd/ip/6in4.c - 664 sys sys 1185564832 7472
 sys/src/cmd/ip/arp.h - 664 sys sys 944961005 751
 sys/src/cmd/ip/dhcp.h - 664 sys sys 1184880651 3419
 sys/src/cmd/ip/dhcpclient.c - 664 sys sys 1178482836 11969
@@ -14242,7 +14242,7 @@ sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1108910002 801
 sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1176837561 6567
 sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1015013150 1069
-sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1184276287 20431
+sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1185515675 20528
 sys/src/cmd/upas/smtp/smtp.h - 664 sys sys 1108827986 1270
 sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1181513473 32835
 sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111

+ 7 - 7
dist/replica/plan9.db

@@ -472,7 +472,7 @@
 386/bin/upas/runq - 775 sys sys 1178568314 112842
 386/bin/upas/scanmail - 775 sys sys 1181507271 128207
 386/bin/upas/send - 775 sys sys 1181507272 192174
-386/bin/upas/smtp - 775 sys sys 1184529906 275100
+386/bin/upas/smtp - 775 sys sys 1185566684 275107
 386/bin/upas/smtpd - 775 sys sys 1181540422 331887
 386/bin/upas/spam - 775 sys sys 1064598366 36
 386/bin/upas/testscan - 775 sys sys 1181507272 83858
@@ -7642,7 +7642,7 @@ sys/man/3/ether - 664 sys sys 1178597986 2890
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/i82365 - 664 sys sys 954378906 884
-sys/man/3/ip - 664 sys sys 1185396805 25985
+sys/man/3/ip - 664 sys sys 1185565401 26009
 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
@@ -8044,10 +8044,10 @@ sys/src/9/pc/ether2114x.c - 664 sys sys 1184468570 41707
 sys/src/9/pc/ether589.c - 664 sys sys 1015014516 4644
 sys/src/9/pc/ether79c970.c - 664 sys sys 1160070602 14088
 sys/src/9/pc/ether8003.c - 664 sys sys 1015014516 6665
-sys/src/9/pc/ether8139.c - 664 sys sys 1185490762 18594
-sys/src/9/pc/ether8169.c - 664 sys sys 1185490910 25476
+sys/src/9/pc/ether8139.c - 664 sys sys 1185509068 18584
+sys/src/9/pc/ether8169.c - 664 sys sys 1185509068 25466
 sys/src/9/pc/ether82543gc.c - 664 sys sys 1131290377 32294
-sys/src/9/pc/ether82557.c - 664 sys sys 1153082663 30197
+sys/src/9/pc/ether82557.c - 664 sys sys 1185509068 30197
 sys/src/9/pc/ether82563.c - 664 sys sys 1178932992 32729
 sys/src/9/pc/ether83815.c - 664 sys sys 1172259521 26346
 sys/src/9/pc/ether8390.c - 664 sys sys 1131290377 17702
@@ -12462,7 +12462,7 @@ 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 1184878450 7455
+sys/src/cmd/ip/6in4.c - 664 sys sys 1185564832 7472
 sys/src/cmd/ip/arp.h - 664 sys sys 944961005 751
 sys/src/cmd/ip/dhcp.h - 664 sys sys 1184880651 3419
 sys/src/cmd/ip/dhcpclient.c - 664 sys sys 1178482836 11969
@@ -14242,7 +14242,7 @@ sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1108910002 801
 sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1176837561 6567
 sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1015013150 1069
-sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1184276287 20431
+sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1185515675 20528
 sys/src/cmd/upas/smtp/smtp.h - 664 sys sys 1108827986 1270
 sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1181513473 32835
 sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111

+ 7 - 0
dist/replica/plan9.log

@@ -49689,3 +49689,10 @@
 1185487205 1 c sys/src/9/ip/ipv6.h - 664 sys sys 1185486283 4322
 1185490807 0 c sys/src/9/pc/ether8139.c - 664 sys sys 1185490762 18594
 1185492604 0 c sys/src/9/pc/ether8169.c - 664 sys sys 1185490910 25476
+1185510604 0 c sys/src/9/pc/ether8139.c - 664 sys sys 1185509068 18584
+1185510604 1 c sys/src/9/pc/ether82557.c - 664 sys sys 1185509068 30197
+1185510604 2 c sys/src/9/pc/ether8169.c - 664 sys sys 1185509068 25466
+1185516004 0 c sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1185515675 20528
+1185566405 0 c sys/man/3/ip - 664 sys sys 1185565401 26009
+1185566405 1 c sys/src/cmd/ip/6in4.c - 664 sys sys 1185564832 7472
+1185568204 0 c 386/bin/upas/smtp - 775 sys sys 1185566684 275107

+ 4 - 4
sys/man/3/ip

@@ -168,14 +168,14 @@ to be connected to the local Ethernet.
 .BI remove\  "local mask"
 Remove a local IP address from an interface.
 .TP
-.BI addmulti\  addr
+.BI addmulti\  Media-addr
 Treat the multicast
-.I addr
+.I Media-addr
 on this interface as a local address.
 .TP
-.BI remmulti\  addr
+.BI remmulti\  Media-addr
 Remove the multicast address
-.I addr
+.I Media-addr
 from this interface.
 .TP
 .BI mtu\  n

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

@@ -235,9 +235,9 @@ rtl8139promiscuous(void* arg, int on)
 }
 
 static void
-rtl8139multicast(void* ether, uchar *addr, int add)
+rtl8139multicast(void* arg, uchar*, int)
 {
-	USED(ether, addr, add);
+	rtl8139promiscuous(arg, 1);
 }
 
 static long
@@ -345,7 +345,7 @@ rtl8139init(Ether* edev)
 	alloc += ctlr->rblen+16;
 	memset(ctlr->rbstart, 0, ctlr->rblen+16);
 	csr32w(ctlr, Rbstart, PCIWADDR(ctlr->rbstart));
-	ctlr->rcr = Rxfth256|Rblen|Mrxdmaunlimited|Ab|Am|Apm;
+	ctlr->rcr = Rxfth256|Rblen|Mrxdmaunlimited|Ab|Apm;
 
 	/*
 	 * Transmitter.

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

@@ -415,9 +415,9 @@ rtl8169promiscuous(void* arg, int on)
 }
 
 static void
-rtl8169multicast(void* ether, uchar *addr, int add)
+rtl8169multicast(void* arg, uchar*, int)
 {
-	USED(ether, addr, add);
+	rtl8169promiscuous(arg, 1);
 }
 
 static long
@@ -621,7 +621,7 @@ rtl8169init(Ether* edev)
 		}
 	}
 	rtl8169replenish(ctlr);
-	ctlr->rcr = Rxfthnone|Mrxdmaunlimited|Ab|Am|Apm;
+	ctlr->rcr = Rxfthnone|Mrxdmaunlimited|Ab|Apm;
 
 	/*
 	 * Mtps is in units of 128 except for the RTL8169

+ 11 - 10
sys/src/cmd/ip/6in4.c

@@ -8,6 +8,7 @@
 
 enum {
 	IP_IPV6PROTO	= 41,
+	V6to4pfx	= 0x2002,
 };
 
 int anysender;
@@ -67,7 +68,8 @@ main(int argc, char **argv)
 		sysfatal("can't find my ipv4 address on %s", net);
 
 	if (argc < 1)
-		loc6 = smprint("2002:%2.2x%2.2x:%2.2x%2.2x::1/48",
+		loc6 = smprint("%ux:%2.2x%2.2x:%2.2x%2.2x::1/48",
+			V6to4pfx,
 			myip[IPaddrlen - IPv4addrlen],
 			myip[IPaddrlen - IPv4addrlen + 1],
 			myip[IPaddrlen - IPv4addrlen + 2],
@@ -240,8 +242,8 @@ ip2tunnel(int in, int out)
 			continue;
 		}
 
-		/* send 6to4 packets (2002::) directly to ipv4 target */
-		if (ip->dst[0] == 0x20 && ip->dst[1] == 0x02)
+		/* send 6to4 packets directly to ipv4 target */
+		if ((ip->dst[0]<<8 | ip->dst[1]) == V6to4pfx)
 			memcpy(op->dst, ip->dst+2, sizeof op->dst);
 		else
 			memcpy(op->dst, remote4+IPv4off, sizeof op->dst);
@@ -321,16 +323,15 @@ badipv4(uchar *a)
 	return a[0] >= 240;
 }
 
+/*
+ * 0x0000/16 prefix = v4 compatible, v4 mapped, loopback, unspecified...
+ * site-local is now deprecated, rfc3879
+ */
 static int
 badipv6(uchar *a)
 {
 	int h = a[0]<<8 | a[1];
 
-	if (h == 0 ||		/* compatible, mapped, loopback, unspecified ... */
-	    h >= 0xFE80)	/* multicast, link-local or site-local */
-		return 1;
-	if (h == 0x2002 &&	/* 6to4 address */
-	    badipv4(a+2))
-		return 1;
-	return 0;
+	return h == 0 || ISIPV6MCAST(a) || ISIPV6LINKLOCAL(a) ||
+	    h == V6to4pfx && badipv4(a+2);
 }

+ 4 - 2
sys/src/cmd/upas/smtp/smtp.c

@@ -453,9 +453,11 @@ hello(char *me, int encrypted)
 		 * answers a call.  Send a no-op in the hope of making it
 		 * talk.
 		 */
-		if (autistic)
+		if (autistic) {
 			dBprint("NOOP\r\n");
-
+			getreply();	/* consume the smtp greeting */
+			/* next reply will be response to noop */
+		}
 		switch(getreply()){
 		case 2:
 			break;