Rev 73 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 79 | magnus | 1 | Author: Magnus Holmgren <holmgren@debian.org> |
| 2 | Description: Set the IPV6_V6ONLY socket option on AF_INET6 sockets |
||
| 3 | Since lshd by default enumerates available address families and calls |
||
| 4 | bind() once for each, conflicts will occur otherwise. |
||
| 73 | magnus | 5 | |
| 6 | diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' trunk~/src/io.c trunk/src/io.c |
||
| 7 | --- trunk~/src/io.c 2006-01-23 18:49:58.000000000 +0100 |
||
| 8 | +++ trunk/src/io.c 2010-07-27 02:17:04.000000000 +0200 |
||
| 9 | @@ -1690,6 +1690,13 @@ |
||
| 10 | { |
||
| 11 | int yes = 1; |
||
| 12 | setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof yes); |
||
| 13 | +#if WITH_IPV6 && defined (IPV6_V6ONLY) |
||
| 14 | + if (local->sa_family == AF_INET6) |
||
| 15 | + { |
||
| 16 | + if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0) |
||
| 17 | + werror("setsockopt IPV6_V6ONLY failed: %e.\n", errno); |
||
| 18 | + } |
||
| 19 | +#endif |
||
| 20 | } |
||
| 21 | |||
| 22 | if (bind(s, local, length) < 0) |