Bug 960716 - Don't use rdate to test whether NTP servers work
Summary: Don't use rdate to test whether NTP servers work
Keywords:
Status: CLOSED DUPLICATE of bug 950267
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: 19
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Vratislav Podzimek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-07 18:22 UTC by Adam Williamson
Modified: 2013-05-07 18:24 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-05-07 18:23:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Adam Williamson 2013-05-07 18:22:27 UTC
pyanaconda/ntp.py has this little function:

def ntp_server_working(server):
    """
    Runs rdate to try to connect to the $server (timeout may take some time).

    :return: True if the given server is reachable and working, False otherwise

    """

    #FIXME: It would be nice to use execWithRedirect here, but it is not
    #       thread-safe and hangs if this function is called from threads.
    #       By using tee (and block-buffered pipes) it is also much slower.
    #we just need to know the exit status
    retc = os.system("rdate -p %s &>/dev/null" % server)

    return retc == 0

Small problem: rdate is not the right thing to use to see if an NTP server is working. They do not actually use the same protocol. rdate is a very old utility that uses the old, busted "Time Protocol" - RFC 868. Apparently many NTP servers used to support the old protocol too, so this likely worked some time back and may still work on a few servers, but these days many/most NTP servers no longer bother to be backward compatible with the ancient protocol rdate uses.

So we should use something else to check NTP server functionality. It's not entirely clear what, though. 'ntpdate' is supposed to be obsolescent; its man page says its functionality was merged into ntpd a long time ago and one should use that instead. But we don't use ntpd any more anyway, we use chronyd. So should we use something chrony-ish to check if a server is working? Seems sensible. The documentation for chronyc is honestly kind of terrible, though, and I'm not sure if there's some simple chronyd or chronyc command you can fire off to just check if a server is up and responding, the way rdate did. But anyhoo - whatever we choose to use, it definitely shouldn't be rdate any more.

Comment 1 Adam Williamson 2013-05-07 18:23:02 UTC

*** This bug has been marked as a duplicate of bug 950267 ***


Note You need to log in before you can comment on or make changes to this bug.