Unmap v4mapped sockaddrs.

This commit is contained in:
Guus Sliepen 2002-03-17 15:59:29 +00:00
parent 07e37f8da0
commit 8b84c44175
4 changed files with 18 additions and 4 deletions

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "config.h"
@ -393,6 +393,8 @@ cp
return; return;
} }
sockaddrunmap(&from); /* Some braindead IPv6 implementations do stupid things. */
n = lookup_node_udp(&from); n = lookup_node_udp(&from);
if(!n) if(!n)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "config.h"
@ -438,6 +438,8 @@ cp
return -1; return -1;
} }
sockaddrunmap(&sa);
c = new_connection(); c = new_connection();
c->outcipher = myself->connection->outcipher; c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest; c->outdigest = myself->connection->outdigest;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "config.h"
@ -171,6 +171,15 @@ cp
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 */ /* Subnet mask handling */
int maskcmp(char *a, char *b, int masklen, int len) int maskcmp(char *a, char *b, int masklen, int len)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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__ #ifndef __TINC_NETUTL_H__
@ -37,6 +37,7 @@ extern sockaddr_t str2sockaddr(char *, char *);
extern void sockaddr2str(sockaddr_t *, char **, char **); extern void sockaddr2str(sockaddr_t *, char **, char **);
extern char *sockaddr2hostname(sockaddr_t *); extern char *sockaddr2hostname(sockaddr_t *);
extern int sockaddrcmp(sockaddr_t *, sockaddr_t *); extern int sockaddrcmp(sockaddr_t *, sockaddr_t *);
extern void sockaddrunmap(sockaddr_t *);
extern int maskcmp(char *, char *, int, int); extern int maskcmp(char *, char *, int, int);
extern void maskcpy(char *, char *, int, int); extern void maskcpy(char *, char *, int, int);
extern void mask(char *, int, int); extern void mask(char *, int, int);