]> andersk Git - openssh.git/blobdiff - canohost.c
- (dtucker) [Makefile.in] Add a install-nosysconf target for installing the
[openssh.git] / canohost.c
index 057f061b6aa51b5d31108974fedcfecd63cbfc04..e5a6b6be31b192900e849669722bd3b31d25f301 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: canohost.c,v 1.40 2004/06/21 17:36:31 avsm Exp $");
+RCSID("$OpenBSD: canohost.c,v 1.41 2004/07/21 11:51:29 djm Exp $");
 
 #include "packet.h"
 #include "xmalloc.h"
@@ -20,7 +20,6 @@ RCSID("$OpenBSD: canohost.c,v 1.40 2004/06/21 17:36:31 avsm Exp $");
 #include "canohost.h"
 
 static void check_ip_options(int, char *);
-static void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *);
 
 /*
  * Return the canonical name of the host at the other end of the socket. The
@@ -166,7 +165,7 @@ check_ip_options(int sock, char *ipaddr)
 #endif /* IP_OPTIONS */
 }
 
-static void
+void
 ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len)
 {
        struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)addr;
@@ -382,7 +381,13 @@ get_peer_port(int sock)
 int
 get_remote_port(void)
 {
-       return get_port(0);
+       static int port = -1;
+
+       /* Cache to avoid getpeername() on a dead connection */
+       if (port == -1)
+               port = get_port(0);
+
+       return port;
 }
 
 int
This page took 0.062301 seconds and 4 git commands to generate.