summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 143dbf0e2..4dc152310 100644
--- a/misc.c
+++ b/misc.c
@@ -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
852void
853sock_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}