summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-07 10:51:23 +1100
committerDamien Miller <djm@mindrot.org>2003-01-07 10:51:23 +1100
commit5e4471e45a9ba9a4ecafa91e15142feaa682bf02 (patch)
treee72e83e50899fb10634e6ab7992875d5310fa6b5
parentdfedbf8e5a1f6719a9e91f79900d8cc0d055c453 (diff)
- (djm) Bug #401: Work around Linux breakage with IPv6 mapped addresses.
Based on fix from yoshfuji@linux-ipv6.org
-rw-r--r--ChangeLog6
-rw-r--r--canohost.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 28e6ac4a2..0c6e463f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120030107
2 - (djm) Bug #401: Work around Linux breakage with IPv6 mapped addresses.
3 Based on fix from yoshfuji@linux-ipv6.org
4
120030103 520030103
2 - (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from 6 - (djm) Bug #461: ssh-copy-id fails with no arguments. Patch from
3 cjwatson@debian.org 7 cjwatson@debian.org
@@ -925,4 +929,4 @@
925 save auth method before monitor_reset_key_state(); bugzilla bug #284; 929 save auth method before monitor_reset_key_state(); bugzilla bug #284;
926 ok provos@ 930 ok provos@
927 931
928$Id: ChangeLog,v 1.2540 2003/01/03 03:52:53 djm Exp $ 932$Id: ChangeLog,v 1.2541 2003/01/06 23:51:23 djm Exp $
diff --git a/canohost.c b/canohost.c
index 9aa942a9f..941db23b6 100644
--- a/canohost.c
+++ b/canohost.c
@@ -59,11 +59,14 @@ get_remote_hostname(int socket, int verify_reverse_mapping)
59 memset(&from, 0, sizeof(from)); 59 memset(&from, 0, sizeof(from));
60 60
61 from4->sin_family = AF_INET; 61 from4->sin_family = AF_INET;
62 fromlen = sizeof(*from4);
62 memcpy(&from4->sin_addr, &addr, sizeof(addr)); 63 memcpy(&from4->sin_addr, &addr, sizeof(addr));
63 from4->sin_port = port; 64 from4->sin_port = port;
64 } 65 }
65 } 66 }
66#endif 67#endif
68 if (from.ss_family == AF_INET6)
69 fromlen = sizeof(struct sockaddr_in6);
67 70
68 if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop), 71 if (getnameinfo((struct sockaddr *)&from, fromlen, ntop, sizeof(ntop),
69 NULL, 0, NI_NUMERICHOST) != 0) 72 NULL, 0, NI_NUMERICHOST) != 0)
@@ -225,6 +228,11 @@ get_socket_address(int socket, int remote, int flags)
225 < 0) 228 < 0)
226 return NULL; 229 return NULL;
227 } 230 }
231
232 /* Work around Linux IPv6 weirdness */
233 if (addr.ss_family == AF_INET6)
234 addrlen = sizeof(struct sockaddr_in6);
235
228 /* Get the address in ascii. */ 236 /* Get the address in ascii. */
229 if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop), 237 if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop),
230 NULL, 0, flags) != 0) { 238 NULL, 0, flags) != 0) {
@@ -319,6 +327,11 @@ get_sock_port(int sock, int local)
319 fatal_cleanup(); 327 fatal_cleanup();
320 } 328 }
321 } 329 }
330
331 /* Work around Linux IPv6 weirdness */
332 if (from.ss_family == AF_INET6)
333 fromlen = sizeof(struct sockaddr_in6);
334
322 /* Return port number. */ 335 /* Return port number. */
323 if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0, 336 if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,
324 strport, sizeof(strport), NI_NUMERICSERV) != 0) 337 strport, sizeof(strport), NI_NUMERICSERV) != 0)