From: Miroslav Lichvar Date: Wed, 14 Mar 2018 12:25:18 +0000 (+0100) Subject: ntp: add debug message to update of link speed X-Git-Tag: 3.3-pre1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b827475378cdc890629971c32d4bbb962bbd4e83;p=thirdparty%2Fchrony.git ntp: add debug message to update of link speed --- diff --git a/ntp_io_linux.c b/ntp_io_linux.c index c44a13be..df944d76 100644 --- a/ntp_io_linux.c +++ b/ntp_io_linux.c @@ -273,7 +273,7 @@ update_interface_speed(struct Interface *iface) { struct ethtool_cmd cmd; struct ifreq req; - int sock_fd; + int sock_fd, link_speed; sock_fd = socket(AF_INET, SOCK_DGRAM, 0); if (sock_fd < 0) @@ -294,7 +294,12 @@ update_interface_speed(struct Interface *iface) close(sock_fd); - iface->link_speed = ethtool_cmd_speed(&cmd); + link_speed = ethtool_cmd_speed(&cmd); + + if (iface->link_speed != link_speed) { + iface->link_speed = link_speed; + DEBUG_LOG("Updated speed of %s to %d Mb/s", iface->name, link_speed); + } } /* ================================================== */