|
|
@ -665,8 +665,14 @@ resolv_cb(struct sockaddr *addr, void *data) |
|
|
|
#ifdef IP_TOS |
|
|
|
// Set QoS flag |
|
|
|
int tos = 46 << 2; |
|
|
|
int proto = addr->sa_family == AF_INET6 ? IPPROTO_IP : IPPROTO_IPV6; |
|
|
|
setsockopt(remotefd, proto, IP_TOS, &tos, sizeof(tos)); |
|
|
|
int rc = setsockopt(remotefd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv4 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv6 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef SET_INTERFACE |
|
|
|
if (query_ctx->server_ctx->iface) { |
|
|
@ -853,8 +859,14 @@ remote_recv_cb(EV_P_ ev_io *w, int revents) |
|
|
|
#ifdef IP_TOS |
|
|
|
// Set QoS flag |
|
|
|
int tos = 46 << 2; |
|
|
|
int proto = remote_ctx->src_addr.ss_family == AF_INET6 ? IPPROTO_IP : IPPROTO_IPV6; |
|
|
|
setsockopt(src_fd, proto, IP_TOS, &tos, sizeof(tos)); |
|
|
|
int rc = setsockopt(src_fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv4 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
rc = setsockopt(src_fd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv6 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
#endif |
|
|
|
if (bind(src_fd, (struct sockaddr *)&dst_addr, remote_dst_addr_len) != 0) { |
|
|
|
ERROR("[udp] remote_recv_bind"); |
|
|
@ -1186,7 +1198,14 @@ server_recv_cb(EV_P_ ev_io *w, int revents) |
|
|
|
#ifdef IP_TOS |
|
|
|
// Set QoS flag |
|
|
|
int tos = 46 << 2; |
|
|
|
setsockopt(remotefd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
|
|
|
int rc = setsockopt(remotefd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv4 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv6 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef SET_INTERFACE |
|
|
|
if (server_ctx->iface) { |
|
|
@ -1275,8 +1294,14 @@ server_recv_cb(EV_P_ ev_io *w, int revents) |
|
|
|
#ifdef IP_TOS |
|
|
|
// Set QoS flag |
|
|
|
int tos = 46 << 2; |
|
|
|
int proto = dst_addr.ss_family == AF_INET6 ? IPPROTO_IP : IPPROTO_IPV6; |
|
|
|
setsockopt(remotefd, proto, IP_TOS, &tos, sizeof(tos)); |
|
|
|
int rc = setsockopt(remotefd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv4 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
rc = setsockopt(remotefd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)); |
|
|
|
if (rc < 0 && errno != ENOPROTOOPT) { |
|
|
|
LOGE("setting ipv6 dscp failed: %d", errno); |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef SET_INTERFACE |
|
|
|
if (server_ctx->iface) { |
|
|
|