From e8660637ccc3bf2aae163fa7c26216843ae98180 Mon Sep 17 00:00:00 2001 From: German Service Network Date: Sat, 19 Aug 2023 22:12:26 +0200 Subject: [PATCH] Fallback to SO_TIMESTAMP if SO_TIMESTAMPNS is not available --- src/fping.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fping.c b/src/fping.c index 9bda407..5d23f46 100644 --- a/src/fping.c +++ b/src/fping.c @@ -1007,13 +1007,17 @@ int main(int argc, char **argv) int opt = 1; if (socket4 >= 0) { if (setsockopt(socket4, SOL_SOCKET, SO_TIMESTAMPNS, &opt, sizeof(opt))) { - perror("setting SO_TIMESTAMPNS option"); + if (setsockopt(socket4, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt))) { + perror("setting SO_TIMESTAMPNS and SO_TIMESTAMP option"); + } } } #ifdef IPV6 if (socket6 >= 0) { if (setsockopt(socket6, SOL_SOCKET, SO_TIMESTAMPNS, &opt, sizeof(opt))) { - perror("setting SO_TIMESTAMPNS option (IPv6)"); + if (setsockopt(socket6, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt))) { + perror("setting SO_TIMESTAMPNS and SO_TIMESTAMP option (IPv6)"); + } } } #endif