mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-12 15:17:14 +03:00
SOL_IP is Linux-specific, replace with portable IPPROTO_IP (fix #481)
This commit is contained in:
parent
9243a6e369
commit
5f55f7d76a
4
common.c
4
common.c
@ -269,7 +269,7 @@ int bind_peer(int fd, int fd_from)
|
||||
return 0;
|
||||
|
||||
#ifndef IP_BINDANY /* use IP_TRANSPARENT */
|
||||
res = setsockopt(fd, SOL_IP, IP_TRANSPARENT, &enable, sizeof(enable));
|
||||
res = setsockopt(fd, IPPROTO_IP, IP_TRANSPARENT, &enable, sizeof(enable));
|
||||
CHECK_RES_DIE(res, "setsockopt IP_TRANSPARENT");
|
||||
res = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
|
||||
CHECK_RES_DIE(res, "setsockopt SO_REUSEADDR");
|
||||
@ -293,7 +293,7 @@ int bind_peer(int fd, int fd_from)
|
||||
}
|
||||
res = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &disable, sizeof(disable));
|
||||
CHECK_RES_DIE(res, "setsockopt SO_REUSEADDR");
|
||||
res = setsockopt(fd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &enable, sizeof(enable));
|
||||
res = setsockopt(fd, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, &enable, sizeof(enable));
|
||||
CHECK_RES_RETURN(res, "setsockopt IP_BIND_ADDRESS_NO_PORT", res);
|
||||
((struct sockaddr_in *)from.ai_addr)->sin_port = 0;
|
||||
res = bind(fd, from.ai_addr, from.ai_addrlen);
|
||||
|
Loading…
x
Reference in New Issue
Block a user