From f2696c0e21e9226d3911457250ef64138900aa2b Mon Sep 17 00:00:00 2001 From: Johan Kiviniemi Date: Thu, 4 Oct 2012 20:56:34 +0300 Subject: [PATCH] src/ntpd.c: Add unit number to refclock name There can be multiple instances of the same refclock with different unit numbers. The unit number needs to be a part of the peer name, otherwise the code will try to write the measurements from multiple peers to the same RRD file. --- src/ntpd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ntpd.c b/src/ntpd.c index 8bbf74d7..15e60a5d 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -857,8 +857,11 @@ static int ntpd_read (void) if (refclock_id < refclock_names_num) { - sstrncpy (peername, refclock_names[refclock_id], - sizeof (peername)); + /* The unit number is in the lowest byte. */ + ssnprintf (peername, sizeof (peername), + "%s%i", + refclock_names[refclock_id], + ntohl (ptr->srcadr) & 0xFF); } else { -- 2.30.2