From: Miroslav Lichvar Date: Mon, 18 May 2015 09:20:03 +0000 (+0200) Subject: ntp: add sources specified by IP directly without name resolving X-Git-Tag: 2.1-pre1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4eeaf34295d20a7d787f8805845a08a6d4f5c960;p=thirdparty%2Fchrony.git ntp: add sources specified by IP directly without name resolving --- diff --git a/ntp_sources.c b/ntp_sources.c index 6fc05c45..d166d4d0 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -505,6 +505,15 @@ NSR_AddSourceByName(char *name, int port, int pool, NTP_Source_Type type, Source { struct UnresolvedSource *us; struct SourcePool *sp; + NTP_Remote_Address remote_addr; + + /* If the name is an IP address, don't bother with full resolving now + or later when trying to replace the source */ + if (UTI_StringToIP(name, &remote_addr.ip_addr)) { + remote_addr.port = port; + NSR_AddSource(&remote_addr, type, params); + return; + } us = MallocNew(struct UnresolvedSource); us->name = Strdup(name);