History

selftests/net: timestamping: Fix bind_phc check

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.

Gerhard Engleder committed 4 years ago

Commit 678dfd51 parent 116ea681 file · +2 −2Browse files

Unified · Split

tools/testing/selftests/net/timestamping.c+2−2
@@ -325,8 +325,8 @@ int main(int argc, char **argv) · 324 unmodified lines
325325 struct ifreq device;
326326 struct ifreq hwtstamp;
327327 struct hwtstamp_config hwconfig, hwconfig_requested;
328− struct so_timestamping so_timestamping_get = { 0, -1 };
329− struct so_timestamping so_timestamping = { 0, -1 };
328+ struct so_timestamping so_timestamping_get = { 0, 0 };
329+ struct so_timestamping so_timestamping = { 0, 0 };
330330 struct sockaddr_in addr;
331331 struct ip_mreq imr;
332332 struct in_addr iaddr;