From 5f55f7d76ad3a01aed2424298ed7a45ba63532f6 Mon Sep 17 00:00:00 2001 From: Yves Rutschle Date: Sun, 8 Dec 2024 21:49:04 +0100 Subject: [PATCH] SOL_IP is Linux-specific, replace with portable IPPROTO_IP (fix #481) --- common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.c b/common.c index 2eebda2..9ea1516 100644 --- a/common.c +++ b/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);