diff options
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 | } | ||