From: Guus Sliepen Date: Sun, 17 Mar 2002 15:59:29 +0000 (+0000) Subject: Unmap v4mapped sockaddrs. X-Git-Tag: release-1.0pre6~39 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8b84c44175fedb81ca38107e0067ddea750add00;p=oweals%2Ftinc.git Unmap v4mapped sockaddrs. --- diff --git a/src/net_packet.c b/src/net_packet.c index 981ad18..61ec204 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_packet.c,v 1.1.2.9 2002/03/12 14:19:51 guus Exp $ + $Id: net_packet.c,v 1.1.2.10 2002/03/17 15:59:29 guus Exp $ */ #include "config.h" @@ -393,6 +393,8 @@ cp return; } + sockaddrunmap(&from); /* Some braindead IPv6 implementations do stupid things. */ + n = lookup_node_udp(&from); if(!n) diff --git a/src/net_socket.c b/src/net_socket.c index cc79926..277b9b0 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_socket.c,v 1.1.2.8 2002/03/01 15:14:29 guus Exp $ + $Id: net_socket.c,v 1.1.2.9 2002/03/17 15:59:29 guus Exp $ */ #include "config.h" @@ -438,6 +438,8 @@ cp return -1; } + sockaddrunmap(&sa); + c = new_connection(); c->outcipher = myself->connection->outcipher; c->outdigest = myself->connection->outdigest; diff --git a/src/netutl.c b/src/netutl.c index a5886fc..95a168c 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.12.4.28 2002/02/26 22:47:51 guus Exp $ + $Id: netutl.c,v 1.12.4.29 2002/03/17 15:59:29 guus Exp $ */ #include "config.h" @@ -171,6 +171,15 @@ cp cp } +void sockaddrunmap(sockaddr_t *sa) +{ + if(IN6_IS_ADDR_V4MAPPED(&sa->in6.sin6_addr)) + { + sa->in.sin_addr.s_addr = sa->in6.sin6_addr.s6_addr32[3]; + sa->in.sin_family = AF_INET; + } +} + /* Subnet mask handling */ int maskcmp(char *a, char *b, int masklen, int len) diff --git a/src/netutl.h b/src/netutl.h index 6207fd1..654d7ad 100644 --- a/src/netutl.h +++ b/src/netutl.h @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.h,v 1.2.4.10 2002/02/18 16:25:16 guus Exp $ + $Id: netutl.h,v 1.2.4.11 2002/03/17 15:59:29 guus Exp $ */ #ifndef __TINC_NETUTL_H__ @@ -37,6 +37,7 @@ extern sockaddr_t str2sockaddr(char *, char *); extern void sockaddr2str(sockaddr_t *, char **, char **); extern char *sockaddr2hostname(sockaddr_t *); extern int sockaddrcmp(sockaddr_t *, sockaddr_t *); +extern void sockaddrunmap(sockaddr_t *); extern int maskcmp(char *, char *, int, int); extern void maskcpy(char *, char *, int, int); extern void mask(char *, int, int);