|
Lines 971-982
Link Here
|
| 971 |
} |
971 |
} |
| 972 |
/* |
972 |
/* |
| 973 |
* Set socket options. |
973 |
* Set socket options. |
|
|
974 |
*/ |
| 975 |
|
| 976 |
/* |
| 974 |
* Allow local port reuse in TIME_WAIT. |
977 |
* Allow local port reuse in TIME_WAIT. |
| 975 |
*/ |
978 |
*/ |
| 976 |
if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, |
979 |
if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, |
| 977 |
&on, sizeof(on)) == -1) |
980 |
&on, sizeof(on)) == -1) |
| 978 |
error("setsockopt SO_REUSEADDR: %s", strerror(errno)); |
981 |
error("setsockopt SO_REUSEADDR: %s", strerror(errno)); |
| 979 |
|
982 |
|
|
|
983 |
#ifdef IPV6_V6ONLY |
| 984 |
if (ai->ai_family == AF_INET6) { |
| 985 |
/* |
| 986 |
* Only communicate in IPv6 over AF_INET6 sockets. |
| 987 |
*/ |
| 988 |
if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY, |
| 989 |
&on, sizeof(on)) == -1) |
| 990 |
error("setsockopt IPV6_V6ONLY: %s", |
| 991 |
strerror(errno)); |
| 992 |
} |
| 993 |
#endif |
| 994 |
|
| 980 |
debug("Bind to port %s on %s.", strport, ntop); |
995 |
debug("Bind to port %s on %s.", strport, ntop); |
| 981 |
|
996 |
|
| 982 |
/* Bind the socket to the desired port. */ |
997 |
/* Bind the socket to the desired port. */ |