diff options
author | Damien Miller <djm@mindrot.org> | 2009-11-18 17:48:30 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2009-11-18 17:48:30 +1100 |
commit | 04ee0f8f12ff3a1227439c5f67623547d7a5bd11 (patch) | |
tree | c434c075dc85b9eead1e2e8ac2a1046cf7c42417 /misc.c | |
parent | df6578bb4df17210f792c3bc98a72bed473e7e11 (diff) |
- (djm) [channels.c misc.c misc.h sshd.c] add missing setsockopt() to
set IPV6_V6ONLY for local forwarding with GatwayPorts=yes. Unify
setting IPV6_V6ONLY behind a new function misc.c:sock_set_v6only()
report and fix from jan.kratochvil AT redhat.com
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -849,3 +849,14 @@ ms_to_timeval(struct timeval *tv, int ms) | |||
849 | tv->tv_usec = (ms % 1000) * 1000; | 849 | tv->tv_usec = (ms % 1000) * 1000; |
850 | } | 850 | } |
851 | 851 | ||
852 | void | ||
853 | sock_set_v6only(int s) | ||
854 | { | ||
855 | #ifdef IPV6_V6ONLY | ||
856 | int on = 1; | ||
857 | |||
858 | debug3("%s: set socket %d IPV6_V6ONLY", __func__, s); | ||
859 | if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1) | ||
860 | error("setsockopt IPV6_V6ONLY: %s", strerror(errno)); | ||
861 | #endif | ||
862 | } | ||