Browse Source

Fix ftbfs for Hurd since there is no IPV6_TCLASS defined

pull/2788/head
Roger Shimizu 3 years ago
committed by Max Lv
parent
commit
cfe0c2cba0
2 changed files with 12 additions and 0 deletions
  1. 2
      src/redir.c
  2. 10
      src/udprelay.c

2
src/redir.c

@ -800,10 +800,12 @@ accept_cb(EV_P_ ev_io *w, int revents)
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
#ifdef IPV6_TCLASS
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &listener->tos, sizeof(listener->tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
#endif
}
// Enable MPTCP

10
src/udprelay.c

@ -508,11 +508,13 @@ create_server_socket(const char *host, const char *port)
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
#ifdef IPV6_TCLASS
rc = setsockopt(server_sock, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
#endif
#endif
#ifdef MODULE_REDIR
int sol = rp->ai_family == AF_INET ? SOL_IP : SOL_IPV6;
@ -675,11 +677,13 @@ resolv_cb(struct sockaddr *addr, void *data)
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
#ifdef IPV6_TCLASS
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
#endif
#endif
#ifdef SET_INTERFACE
if (query_ctx->server_ctx->iface) {
if (setinterface(remotefd, query_ctx->server_ctx->iface) == -1)
@ -872,10 +876,12 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
#ifdef IPV6_TCLASS
rc = setsockopt(src_fd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
#endif
#endif
if (bind(src_fd, (struct sockaddr *)&dst_addr, remote_dst_addr_len) != 0) {
ERROR("[udp] remote_recv_bind");
@ -1213,11 +1219,13 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
#ifdef IPV6_TCLASS
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
#endif
#endif
#ifdef SET_INTERFACE
if (server_ctx->iface) {
if (setinterface(remotefd, server_ctx->iface) == -1)
@ -1309,11 +1317,13 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv4 dscp failed: %d", errno);
}
#ifdef IPV6_TCLASS
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos));
if (rc < 0 && errno != ENOPROTOOPT) {
LOGE("setting ipv6 dscp failed: %d", errno);
}
#endif
#endif
#ifdef SET_INTERFACE
if (server_ctx->iface) {
if (setinterface(remotefd, server_ctx->iface) == -1)

Loading…
Cancel
Save