mirror of
https://github.com/clearml/dropbear
synced 2025-06-15 10:48:20 +00:00
Put better #if guards around IPv6 socket options for IPV6_TCLASS and
IPV6_V6ONLY. From Gustavo Zacarias.
This commit is contained in:
parent
88278dee74
commit
c894ea4ea2
4
dbutil.c
4
dbutil.c
@ -164,7 +164,7 @@ static void set_sock_priority(int sock) {
|
|||||||
/* set the TOS bit for either ipv4 or ipv6 */
|
/* set the TOS bit for either ipv4 or ipv6 */
|
||||||
#ifdef IPTOS_LOWDELAY
|
#ifdef IPTOS_LOWDELAY
|
||||||
val = IPTOS_LOWDELAY;
|
val = IPTOS_LOWDELAY;
|
||||||
#ifdef IPPROTO_IPV6
|
#if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS)
|
||||||
setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
|
setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
|
||||||
#endif
|
#endif
|
||||||
setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
|
setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
|
||||||
@ -256,7 +256,7 @@ int dropbear_listen(const char* address, const char* port,
|
|||||||
linger.l_linger = 5;
|
linger.l_linger = 5;
|
||||||
setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
|
setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
|
||||||
|
|
||||||
#ifdef IPV6_V6ONLY
|
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
||||||
if (res->ai_family == AF_INET6) {
|
if (res->ai_family == AF_INET6) {
|
||||||
int on = 1;
|
int on = 1;
|
||||||
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||||
|
Loading…
Reference in New Issue
Block a user