Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: tcp socket handling

Found a bug when trying to get IPv6 to work.  There could be more, since
although I can connect to the server it's giving odd responses which it
doesn't when I use IPv4.

The other change is simply a change of logic, since peer.in and peer.a are
alternative members of a union.  Actually, the family is (has to be) in
the same place in all forms of sockaddr, but I like the look of it the
new way.

Index: Src/Modules/tcp.c
RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v
retrieving revision 1.22
diff -u -r1.22 tcp.c
--- Src/Modules/tcp.c	18 Apr 2002 11:39:15 -0000	1.22
+++ Src/Modules/tcp.c	25 Apr 2002 13:12:28 -0000
@@ -322,13 +322,14 @@
 	sess->peer.in6.sin6_scope_id = 0;
 # endif
+	sess->peer.in6.sin6_family = zhost->h_addrtype;
 	salen = sizeof(struct sockaddr_in6);
     } else
 #endif /* SUPPORT_IPV6 */
 	memcpy(&(sess->peer.in.sin_addr), addrp, zhost->h_length);
 	sess->peer.in.sin_port = d_port;
-	sess->peer.a.sa_family = zhost->h_addrtype;
+	sess->peer.in.sin_family = zhost->h_addrtype;
 	salen = sizeof(struct sockaddr_in);

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

Messages sorted by: Reverse Date, Date, Thread, Author