summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2fb1d3a)
raw | patch | inline | side by side (parent: 2fb1d3a)
author | Johan Kiviniemi <devel@johan.kiviniemi.name> | |
Thu, 4 Oct 2012 17:56:34 +0000 (20:56 +0300) | ||
committer | Johan Kiviniemi <devel@johan.kiviniemi.name> | |
Thu, 4 Oct 2012 18:21:08 +0000 (21:21 +0300) |
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.
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 | patch | blob | history |
diff --git a/src/ntpd.c b/src/ntpd.c
index 8bbf74d7d965b94ac0d21939fc3a4776116a7539..15e60a5d0317735a00f75b6a1ae1391c827ac0aa 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
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
{