[901] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

Issue with zephyr on linux: unconnected sockets and spurious errors

daemon@ATHENA.MIT.EDU (Greg Stark)
Sun Feb 8 14:50:33 1998

To: linux-dev@MIT.EDU, zephyr-bugs@MIT.EDU
From: Greg Stark <gsstark@MIT.EDU>
Date: 08 Feb 1998 14:48:58 -0500


The Linux network people have a new and interesting interpretation of the TCP
RFC that they think requires them to return any network errors to user space,
even for unconnected sockets where the errors are nigh useless and impossible
to associate with the action that caused it.

Zephyr uses unconnected sockets and doesn't really deal well with spurious
errors from other network connections interrupting it. The result is that zwgc
randomly exits with a return value of 3. Below is an entirely untested patch
that may help.


$ diff -u Zinternal.c.~1~ Zinternal.c
--- Zinternal.c.~1~	Tue Jul 18 16:28:17 1995
+++ Zinternal.c	Fri Jan 30 23:53:33 1998
@@ -254,7 +254,7 @@
     ZNotice_t notice;
     ZPacket_t packet;
     struct sockaddr_in olddest, from;
-    int from_len, packet_len, part, partof;
+    int from_len, packet_len=-1, part, partof;
     char *slash;
     Code_t retval;
     register int i;
@@ -264,9 +264,13 @@
 	
     from_len = sizeof(struct sockaddr_in);
 
-    packet_len = recvfrom(ZGetFD(), packet, sizeof(packet), 0, 
-			  (struct sockaddr *)&from, &from_len);
-
+    /* Linux returns spurious errors on unconnected sockets
+       Alan Cox thinks the RFC requires that behaviour
+       We had better ignore them or we will randomly exit */
+    while (packet_len<0)
+      packet_len = recvfrom(ZGetFD(), packet, sizeof(packet), 0, 
+			    (struct sockaddr *)&from, &from_len);
+    
     if (packet_len < 0)
 	return (errno);


home help back first fref pref prev next nref lref last post