From: Miroslav Lichvar Date: Mon, 21 May 2018 14:49:26 +0000 (+0200) Subject: ntp: check PHC index before opening device X-Git-Tag: 3.4-pre1~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2962fc62862c7c0d888d83a7b76e05bbc6416eb1;p=thirdparty%2Fchrony.git ntp: check PHC index before opening device Apparently, it is possible for an interface to report all necessary flags for HW timestamping without having a PHC. Check the PHC index to avoid an error message in the system log saying that /dev/ptp-1 cannot be opened. --- diff --git a/ntp_io_linux.c b/ntp_io_linux.c index 6f794c7a..da39c950 100644 --- a/ntp_io_linux.c +++ b/ntp_io_linux.c @@ -171,6 +171,12 @@ add_interface(CNF_HwTsInterface *conf_iface) return 0; } + if (ts_info.phc_index < 0) { + DEBUG_LOG("PHC missing on %s", req.ifr_name); + close(sock_fd); + return 0; + } + ts_config.flags = 0; ts_config.tx_type = HWTSTAMP_TX_ON;