summaryrefslogtreecommitdiff
path: root/minecproxy/server-proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'minecproxy/server-proxy.c')
-rw-r--r--minecproxy/server-proxy.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/minecproxy/server-proxy.c b/minecproxy/server-proxy.c
index e486a73..ac41594 100644
--- a/minecproxy/server-proxy.c
+++ b/minecproxy/server-proxy.c
@@ -487,6 +487,14 @@ bool local_open(struct server_local *local)
goto error;
}
+ /* IPv4 and IPv6 sockets are handled separately */
+ if (local->local.st.ss_family == AF_INET6) {
+ option = true;
+ if (setsockopt(sfd, IPPROTO_IPV6, IPV6_V6ONLY, &option,
+ sizeof(option)) < 0)
+ error("setsockopt: %m");
+ }
+
/* The MC protocol expects the client to send data first */
if (cfg->socket_defer) {
option = true;
@@ -509,16 +517,18 @@ bool local_open(struct server_local *local)
socket_set_low_latency(sfd, cfg->socket_keepalive, cfg->socket_iptos,
cfg->socket_nodelay);
+ verbose("%s: attempting to bind to %s", local->server->scfg.name,
+ local->local.addrstr);
r = bind(sfd, (struct sockaddr *)&local->local.st,
local->local.addrlen);
if (r < 0) {
- error("bind: %m");
+ error("bind(%s): %m", local->local.addrstr);
goto error;
}
r = listen(sfd, 100);
if (r < 0) {
- error("listen: %m");
+ error("listen(%s): %m", local->local.addrstr);
goto error;
}