Skip to content

Commit

Permalink
Fallback to SO_TIMESTAMP if SO_TIMESTAMPNS is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnw-sebast authored and schweikert committed Aug 27, 2023
1 parent 8dc0b7f commit e866063
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/fping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e866063

Please sign in to comment.