projects
/
BearSSL
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c1d1306
)
Small patch to allow compilation on old systems that predate the IPV6_V6ONLY option...
author
Thomas Pornin
<pornin@bolet.org>
Sat, 1 Apr 2017 18:17:09 +0000
(20:17 +0200)
committer
Thomas Pornin
<pornin@bolet.org>
Sat, 1 Apr 2017 18:17:09 +0000
(20:17 +0200)
tools/server.c
patch
|
blob
|
history
diff --git
a/tools/server.c
b/tools/server.c
index
363028f
..
cb04711
100644
(file)
--- a/
tools/server.c
+++ b/
tools/server.c
@@
-119,9
+119,16
@@
host_bind(const char *host, const char *port, int verbose)
opt = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
(void *)&opt, sizeof opt);
opt = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
(void *)&opt, sizeof opt);
+#ifdef IPV6_V6ONLY
+ /*
+ * We want to make sure that the server socket works for
+ * both IPv4 and IPv6. But IPV6_V6ONLY is not defined on
+ * some very old systems.
+ */
opt = 0;
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&opt, sizeof opt);
opt = 0;
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&opt, sizeof opt);
+#endif
if (bind(fd, sa, sa_len) < 0) {
if (verbose) {
perror("bind()");
if (bind(fd, sa, sa_len) < 0) {
if (verbose) {
perror("bind()");