summaryrefslogtreecommitdiffstats
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-01-19 22:56:00 +0100
committerDamien Miller <djm@mindrot.org>2008-01-19 22:56:00 +0100
commit49d2a2826aec4c0aba41ea76b1bb7fa446d6fd55 (patch)
tree4dc9693dddcce2345a56fa36b993f84bbda5545a /sshd.c
parent - (djm) Silence noice from expr in ssh-copy-id; patch from (diff)
downloadopenssh-49d2a2826aec4c0aba41ea76b1bb7fa446d6fd55.tar.xz
openssh-49d2a2826aec4c0aba41ea76b1bb7fa446d6fd55.zip
- (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)
&on, sizeof(on)) == -1)
error("setsockopt SO_REUSEADDR: %s", strerror(errno));
+#ifdef IPV6_V6ONLY
+ /* Only communicate in IPv6 over AF_INET6 sockets. */
+ if (ai->ai_family == AF_INET6) {
+ if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ &on, sizeof(on)) == -1)
+ error("setsockopt IPV6_V6ONLY: %s",
+ strerror(errno));
+ }
+#endif
+
debug("Bind to port %s on %s.", strport, ntop);
/* Bind the socket to the desired port. */