function declarations to a separate file (#454, thanks @gsnw-sebast)
- Avoid crash with option `-0` (#457, thanks @auerswal)
- Move option parsing to a separate file fping.c and fping.h (#458, thanks @gsnw-sebast)
+- Add IBM i PASE detection (#466, thanks @acerbis and @gsnw-sebast)
- ci: Update autoconf to version 2.73 (#467, thanks @gsnw-sebast)
fping 5.5 (2025-12-31)
;;
esac
+dnl Detect IBM i PASE environment
+AC_MSG_CHECKING([for IBM i PASE environment])
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[
+#if !defined(__PASE__)
+#error not PASE
+#endif
+ ]])],
+ [
+ AC_MSG_RESULT([yes])
+ AC_MSG_NOTICE([IBM i PASE detected: applying required CPPFLAGS and library paths])
+ CPPFLAGS="-I/QOpenSys/pkgs/include -D_SIGSET_T -DHAVE_STDLIB_H $CPPFLAGS"
+ LDFLAGS="-L/QOpenSys/pkgs/lib $LDFLAGS"
+ ],
+ [AC_MSG_RESULT([no])]
+)
+
+dnl Check for IP_RECVTOS (missing on PASE/IBM i and some BSDs).
+AC_CHECK_DECL([IP_RECVTOS],
+ [AC_DEFINE([HAVE_IP_RECVTOS], [1], [IP_RECVTOS socket option is available])],
+ [],
+ [#include <sys/types.h>
+#include <netinet/in.h>
+#include <sys/socket.h>])
+
dnl --disable-ipv4
AC_ARG_ENABLE([ipv4],
AS_HELP_STRING([--disable-ipv4], [Disable support for pinging IPv4 hosts]))
opt_ping_data_size = ICMP_TIMESTAMP_DATA_SIZE;
} else if (strstr(optparse_state.optlongname, "print-tos") != NULL) {
opt_print_tos_on = 1;
-#if defined(IP_RECVTOS)
+#if defined(HAVE_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");
*reply_timestamp = timeval_ns(&reply_timestamp_tv);
}
#endif
+#if defined(HAVE_IP_RECVTOS)
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_TOS) {
memcpy(ip_header_tos, CMSG_DATA(cmsg), sizeof(*ip_header_tos));
}
+#endif
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_TTL) {
memcpy(ip_header_ttl, CMSG_DATA(cmsg), sizeof(*ip_header_ttl));
}
+#include "config.h"
#include "output.h"
#include "fping.h"
#include "flags.h"
ms_since_midnight_utc(recv_time));
}
+#if defined(HAVE_IP_RECVTOS)
if(opt_print_tos_on) {
if(ip_header_res->tos != -1) {
printf(" (TOS %d)", ip_header_res->tos);
printf(" (TOS unknown)");
}
}
+#endif
if (opt_print_ttl_on) {
if(ip_header_res->ttl != -1) {
printf("\"localreceive\": %u}", ms_since_midnight_utc(recv_time));
}
+#if defined(HAVE_IP_RECVTOS)
if(opt_print_tos_on) {
if(ip_header_res->tos != -1) {
printf(", \"tos\": %d", ip_header_res->tos);
printf(", \"tos\": -1");
}
}
+#endif
if (opt_print_ttl_on) {
if(ip_header_res->ttl != -1) {