Skip to content

Commit

Permalink
selftests/net: timestamping: Fix bind_phc check
Browse files Browse the repository at this point in the history
timestamping checks socket options during initialisation. For the field
bind_phc of the socket option SO_TIMESTAMPING it expects the value -1 if
PHC is not bound. Actually the value of bind_phc is 0 if PHC is not
bound. This results in the following output:

SIOCSHWTSTAMP: tx_type 0 requested, got 0; rx_filter 0 requested, got 0
SO_TIMESTAMP 0
SO_TIMESTAMPNS 0
SO_TIMESTAMPING flags 0, bind phc 0
   not expected, flags 0, bind phc -1

This is fixed by setting default value and expected value of bind_phc to
0.

Fixes: 2214d70 ("selftests/net: timestamping: support binding PHC")
Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gerhard Engleder authored and David S. Miller committed Jan 31, 2022
1 parent 116ea68 commit 678dfd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/net/timestamping.c
Original file line number Diff line number Diff line change
@@ -325,8 +325,8 @@ int main(int argc, char **argv)
struct ifreq device;
struct ifreq hwtstamp;
struct hwtstamp_config hwconfig, hwconfig_requested;
struct so_timestamping so_timestamping_get = { 0, -1 };
struct so_timestamping so_timestamping = { 0, -1 };
struct so_timestamping so_timestamping_get = { 0, 0 };
struct so_timestamping so_timestamping = { 0, 0 };
struct sockaddr_in addr;
struct ip_mreq imr;
struct in_addr iaddr;

0 comments on commit 678dfd5

Please sign in to comment.