summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2005-04-06 09:43:59 +0000
committerdjm <djm@openbsd.org>2005-04-06 09:43:59 +0000
commit6151cdea24728698337b0cb1ce80883a73dddc53 (patch)
tree7b4508aa6d42ed8feae0c0ad80e4dc9473033faa
parentWhen deleting LSA because they hit max age (IMSG_LS_MAXAGE) check if the (diff)
downloadwireguard-openbsd-6151cdea24728698337b0cb1ce80883a73dddc53.tar.xz
wireguard-openbsd-6151cdea24728698337b0cb1ce80883a73dddc53.zip
avoid harmless logspam by not performing setsockopt() on non-socket; ok markus@
-rw-r--r--usr.bin/ssh/sshd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 5e51d02417b..229666409f2 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -42,7 +42,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.308 2005/02/08 22:24:57 dtucker Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.309 2005/04/06 09:43:59 djm Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@@ -1545,18 +1545,17 @@ main(int ac, char **av)
signal(SIGQUIT, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
- /* Set SO_KEEPALIVE if requested. */
- if (options.tcp_keep_alive &&
- setsockopt(sock_in, SOL_SOCKET, SO_KEEPALIVE, &on,
- sizeof(on)) < 0)
- error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno));
-
/*
* Register our connection. This turns encryption off because we do
* not have a key.
*/
packet_set_connection(sock_in, sock_out);
+ /* Set SO_KEEPALIVE if requested. */
+ if (options.tcp_keep_alive && packet_connection_is_on_socket() &&
+ setsockopt(sock_in, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0)
+ error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno));
+
remote_port = get_remote_port();
remote_ip = get_remote_ipaddr();