summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-01-20 08:56:00 +1100
committerDamien Miller <djm@mindrot.org>2008-01-20 08:56:00 +1100
commit49d2a2826aec4c0aba41ea76b1bb7fa446d6fd55 (patch)
tree4dc9693dddcce2345a56fa36b993f84bbda5545a /sshd.c
parente27220eb5b55974278dd364e8485de56a45662ed (diff)
- (djm) Only listen for IPv6 connections on AF_INET6 sockets; patch from
tsr2600 AT gmail.com
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sshd.c b/sshd.c
index 9019411ac..27c38ba53 100644
--- a/sshd.c
+++ b/sshd.c
@@ -976,6 +976,16 @@ server_listen(void)
976 &on, sizeof(on)) == -1) 976 &on, sizeof(on)) == -1)
977 error("setsockopt SO_REUSEADDR: %s", strerror(errno)); 977 error("setsockopt SO_REUSEADDR: %s", strerror(errno));
978 978
979#ifdef IPV6_V6ONLY
980 /* Only communicate in IPv6 over AF_INET6 sockets. */
981 if (ai->ai_family == AF_INET6) {
982 if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY,
983 &on, sizeof(on)) == -1)
984 error("setsockopt IPV6_V6ONLY: %s",
985 strerror(errno));
986 }
987#endif
988
979 debug("Bind to port %s on %s.", strport, ntop); 989 debug("Bind to port %s on %s.", strport, ntop);
980 990
981 /* Bind the socket to the desired port. */ 991 /* Bind the socket to the desired port. */