]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
nts: include server address in client NTS-KE log messages
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 23 Mar 2020 14:39:58 +0000 (15:39 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 26 Mar 2020 14:30:27 +0000 (15:30 +0100)
nts_ke_client.c

index c9592f03e3ffc2ae39d0f41f2fb472377ce555d0..29421de1272af88a9a47d3e6db2bf658ab2fd536 100644 (file)
@@ -318,6 +318,7 @@ int
 NKC_Start(NKC_Instance inst)
 {
   IPSockAddr local_addr;
+  char label[512];
   int sock_fd;
 
   assert(!NKC_IsActive(inst));
@@ -338,9 +339,13 @@ NKC_Start(NKC_Instance inst)
   if (sock_fd < 0)
     return 0;
 
+  /* Make a label containing both the address and name of the server */
+  if (snprintf(label, sizeof (label), "%s (%s)",
+               UTI_IPSockAddrToString(&inst->address), inst->name) >= sizeof (label))
+    ;
+
   /* Start a NTS-KE session */
-  if (!NKSN_StartSession(inst->session, sock_fd, inst->name,
-                         client_credentials, CLIENT_TIMEOUT)) {
+  if (!NKSN_StartSession(inst->session, sock_fd, label, client_credentials, CLIENT_TIMEOUT)) {
     SCK_CloseSocket(sock_fd);
     return 0;
   }