summaryrefslogtreecommitdiff
path: root/canohost.c
diff options
context:
space:
mode:
Diffstat (limited to 'canohost.c')
-rw-r--r--canohost.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/canohost.c b/canohost.c
index 1c22d4770..c27086bfd 100644
--- a/canohost.c
+++ b/canohost.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: canohost.c,v 1.42 2005/02/18 03:05:53 djm Exp $"); 15RCSID("$OpenBSD: canohost.c,v 1.44 2005/06/17 02:44:32 djm Exp $");
16 16
17#include "packet.h" 17#include "packet.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -143,7 +143,8 @@ check_ip_options(int sock, char *ipaddr)
143 u_char options[200]; 143 u_char options[200];
144 char text[sizeof(options) * 3 + 1]; 144 char text[sizeof(options) * 3 + 1];
145 socklen_t option_size; 145 socklen_t option_size;
146 int i, ipproto; 146 u_int i;
147 int ipproto;
147 struct protoent *ip; 148 struct protoent *ip;
148 149
149 if ((ip = getprotobyname("ip")) != NULL) 150 if ((ip = getprotobyname("ip")) != NULL)
@@ -173,7 +174,7 @@ ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len)
173 struct in_addr inaddr; 174 struct in_addr inaddr;
174 u_int16_t port; 175 u_int16_t port;
175 176
176 if (addr->ss_family != AF_INET6 || 177 if (addr->ss_family != AF_INET6 ||
177 !IN6_IS_ADDR_V4MAPPED(&a6->sin6_addr)) 178 !IN6_IS_ADDR_V4MAPPED(&a6->sin6_addr))
178 return; 179 return;
179 180
@@ -251,6 +252,8 @@ get_socket_address(int sock, int remote, int flags)
251 if (addr.ss_family == AF_INET6) 252 if (addr.ss_family == AF_INET6)
252 addrlen = sizeof(struct sockaddr_in6); 253 addrlen = sizeof(struct sockaddr_in6);
253 254
255 ipv64_normalise_mapped(&addr, &addrlen);
256
254 /* Get the address in ascii. */ 257 /* Get the address in ascii. */
255 if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop, 258 if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
256 sizeof(ntop), NULL, 0, flags)) != 0) { 259 sizeof(ntop), NULL, 0, flags)) != 0) {
@@ -344,7 +347,7 @@ get_sock_port(int sock, int local)
344 } else { 347 } else {
345 if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) { 348 if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) {
346 debug("getpeername failed: %.100s", strerror(errno)); 349 debug("getpeername failed: %.100s", strerror(errno));
347 cleanup_exit(255); 350 return -1;
348 } 351 }
349 } 352 }
350 353