From: Erik Auerswald Date: Wed, 7 Jan 2026 00:04:13 +0000 (+0100) Subject: work around NetBSD's lack of IP_RECVTOS X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=656759684f1b43321334a746a8b0a5376d058c23;p=fping.git work around NetBSD's lack of IP_RECVTOS NetBSD does not know the IP_RECVTOS socket option. Thus conditionally compile setting this option only when it is defined. This is the same change as used in the NetBSD package[1], with thanks to "adam". [1] https://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/fping/patches/patch-src_fping.c?rev=1.5;content-type=text%2Fplain --- diff --git a/src/fping.c b/src/fping.c index ada5255..6147d40 100644 --- a/src/fping.c +++ b/src/fping.c @@ -712,11 +712,13 @@ int main(int argc, char **argv) ping_data_size = ICMP_TIMESTAMP_DATA_SIZE; } else if (strstr(optparse_state.optlongname, "print-tos") != NULL) { print_tos_flag = 1; +#if defined(IP_RECVTOS) if (socket4 >= 0 && (socktype4 == SOCK_DGRAM)) { if (setsockopt(socket4, IPPROTO_IP, IP_RECVTOS, &sock_opt_on, sizeof(sock_opt_on))) { perror("setsockopt IP_RECVTOS"); } } +#endif #if defined(IPV6) && defined(IPV6_RECVTCLASS) if (socket6 >= 0) { if (setsockopt(socket6, IPPROTO_IPV6, IPV6_RECVTCLASS, &sock_opt_on, sizeof(sock_opt_on))) {