]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: make use of NCR_ProcessUnknown in NCR_ProcessKnown
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 20 Mar 2014 18:14:47 +0000 (19:14 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 21 Mar 2014 12:20:34 +0000 (13:20 +0100)
After recent changes the code in NCR_ProcessKnown is now identical and
can be replaced with NCR_ProcessUnknown call.

ntp_core.c

index 388b3a54ba2581025979ded1aefe407c532a5b77..15066eb63f071c45c086dc831bf18972de649a0d 100644 (file)
@@ -1251,10 +1251,7 @@ NCR_ProcessKnown
 {
   int pkt_mode;
   int version;
-  int valid_auth;
-  int authenticate_reply, auth_len;
-  unsigned long auth_key_id;
-  unsigned long reply_auth_key_id;
+  int auth_len;
 
   /* Ignore packets from offline sources */
   if (inst->opmode == MD_OFFLINE) {
@@ -1296,45 +1293,7 @@ NCR_ProcessKnown
          one of the secondaries to flywheel it. The behaviour coded here
          is required in the secondaries to make this possible. */
 
-      if (ADF_IsAllowed(access_auth_table, &inst->remote_addr.ip_addr)) {
-        int do_auth;
-
-        CLG_LogNTPClientAccess(&inst->remote_addr.ip_addr, (time_t) now->tv_sec);
-
-        if (auth_len > 0) {
-          do_auth = 1;
-          auth_key_id = ntohl(message->auth_keyid);
-          valid_auth = check_packet_auth(message, auth_key_id, auth_len);
-          
-          if (valid_auth) {
-            authenticate_reply = 1;
-            reply_auth_key_id = auth_key_id;
-          } else {
-            authenticate_reply = 0;
-            reply_auth_key_id = 0UL;
-          }
-        } else {
-          do_auth = 0;
-          authenticate_reply = 0;
-          reply_auth_key_id = 0UL;
-        }
-        
-        if (!do_auth || valid_auth) {
-          transmit_packet(MODE_SERVER, inst->local_poll,
-                          version,
-                          authenticate_reply, reply_auth_key_id,
-                          &message->transmit_ts,
-                          now,
-                          NULL,
-                          NULL,
-                          &inst->remote_addr);
-        }
-
-      } else if (!LOG_RateLimited()) {
-        LOG(LOGS_WARN, LOGF_NtpCore, "NTP packet received from unauthorised host %s port %d",
-            UTI_IPToString(&inst->remote_addr.ip_addr),
-            inst->remote_addr.port);
-      }
+      NCR_ProcessUnknown(message, now, now_err, &inst->remote_addr, length);
 
       break;