[cvslog] (2005-12-01 18:03:17 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Thu Dec 1 12:03:17 CST 2005


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2005-12-01 18:03:17 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/socket.c

Log message:

* Fix formatting of ipv4-in-ipv6 mapped addresses

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/socket.c
diff -u eggdrop1.9/lib/eggdrop/socket.c:1.8 eggdrop1.9/lib/eggdrop/socket.c:1.9
--- eggdrop1.9/lib/eggdrop/socket.c:1.8	Sat Aug 27 20:39:48 2005
+++ eggdrop1.9/lib/eggdrop/socket.c	Thu Dec  1 12:03:07 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: socket.c,v 1.8 2005/08/28 01:39:48 lordares Exp $";
+static const char rcsid[] = "$Id: socket.c,v 1.9 2005/12/01 18:03:07 stdarg Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -110,8 +110,12 @@
 	if (!getsockname(sock, &name.u.addr, &namelen) && namelen == sizeof(name.u.ipv6)) {
 		if (ip) {
 			*ip = malloc(128);
-			inet_ntop(AF_INET6, &name.u.ipv6.sin6_addr, *ip, 128);
-			if (IN6_IS_ADDR_V4MAPPED((&name.u.ipv6.sin6_addr))) memmove(*ip, *ip+7, strlen(*ip)-7);
+			if (IN6_IS_ADDR_V4MAPPED((&name.u.ipv6.sin6_addr))) {
+				inet_ntop(AF_INET, &name.u.ipv6.sin6_addr.s6_addr32[3], *ip, 128);
+			}
+			else {
+				inet_ntop(AF_INET6, &name.u.ipv6.sin6_addr, *ip, 128);
+			}
 		}
 		if (port) *port = ntohs(name.u.ipv6.sin6_port);
 		return(0);
----------------------- End of diff -----------------------



More information about the Changes mailing list