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
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))) {