Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Next
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)
Expand Down
25 changes: 25 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ case "${target}" in
;;
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]))
Expand Down
4 changes: 3 additions & 1 deletion src/fping.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ int main(int argc, char **argv)
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");
Expand Down Expand Up @@ -2114,9 +2114,11 @@ int receive_packet(int64_t wait_time,
*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));
}
Expand Down
5 changes: 5 additions & 0 deletions src/output.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
#include "output.h"
#include "fping.h"
#include "flags.h"
Expand Down Expand Up @@ -232,6 +233,7 @@ void print_recv_ext(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int64_t
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);
Expand All @@ -240,6 +242,7 @@ void print_recv_ext(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int64_t
printf(" (TOS unknown)");
}
}
#endif

if (opt_print_ttl_on) {
if(ip_header_res->ttl != -1) {
Expand Down Expand Up @@ -278,6 +281,7 @@ void print_recv_ext_json(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int
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);
Expand All @@ -286,6 +290,7 @@ void print_recv_ext_json(IP_HEADER_RESULT *ip_header_res, int64_t recv_time, int
printf(", \"tos\": -1");
}
}
#endif

if (opt_print_ttl_on) {
if(ip_header_res->ttl != -1) {
Expand Down
Loading