[Git][NTPsec/ntpsec][master] 2 commits: NTS: Ask for extra cookies if we need more

Hal Murray gitlab at mg.gitlab.com
Fri Feb 22 12:55:23 UTC 2019


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
c2331fb5 by Hal Murray at 2019-02-22T07:40:58Z
NTS: Ask for extra cookies if we need more

- - - - -
429d8c0e by Hal Murray at 2019-02-22T08:02:15Z
Rearrange order of ntpq nts printout

- - - - -


2 changed files:

- ntpclients/ntpq.py
- ntpd/ntp_extens.c


Changes:

=====================================
ntpclients/ntpq.py
=====================================
@@ -1494,11 +1494,11 @@ usage: authinfo
             ("nts_client_send",      "NTS client sends:         ", NTP_INT),
             ("nts_client_recv",      "NTS client recvs:         ", NTP_INT),
             ("nts_client_recv_bad",  "NTS client recvs w error: ", NTP_INT),
-            ("nts_server_send",      "NTS server sends:         ", NTP_INT),
             ("nts_server_recv",      "NTS server recvs:         ", NTP_INT),
             ("nts_server_recv_bad",  "NTS server recvs w error: ", NTP_INT),
-            ("nts_ke_serves",        "NTS KE serves:            ", NTP_INT),
+            ("nts_server_send",      "NTS server sends:         ", NTP_INT),
             ("nts_ke_probes",        "NTS KE probes:            ", NTP_INT),
+            ("nts_ke_serves",        "NTS KE serves:            ", NTP_INT),
         )
         self.collect_display(associd=0, variables=ntsinfo, decodestatus=False)
 


=====================================
ntpd/ntp_extens.c
=====================================
@@ -82,7 +82,13 @@ int extens_client_send(struct peer *peer, struct pkt *xpkt) {
   peer->nts_state.count--;
   // FIXME - what to do if out of cookies
 
-  // FIXME - need more cookies?
+  // Need more cookies?
+  for (int i=peer->nts_state.count+1; i<NTS_MAX_COOKIES; i++) {
+    nts_append_header(&buf, NTS_Cookie_Placeholder, peer->nts_state.cookielen);
+    memset(buf.next, 0, peer->nts_state.cookielen);
+    buf.next += peer->nts_state.cookielen;
+    buf.left -= peer->nts_state.cookielen;
+  }
 
   /* AEAD */
   adlength = buf.next-packet;
@@ -131,6 +137,7 @@ bool extens_server_recv(struct ntspacket_t *ntspacket, uint8_t *pkt, int lng) {
 
   sawcookie = sawAEEF = false;
   ntspacket->uidlen = 0;
+  ntspacket->needed = 0;
 
   while (buf.left > 0) {
     uint16_t type;
@@ -165,7 +172,7 @@ bool extens_server_recv(struct ntspacket_t *ntspacket, uint8_t *pkt, int lng) {
         buf.next += length;
 	buf.left -= length;
 	sawcookie = true;
-	ntspacket->needed = 1;
+	ntspacket->needed++;
 	ntspacket->aead = aead;
 	break;
       case NTS_Cookie_Placeholder:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/14c073d5fff29a5c9b63397bca46694c759174b8...429d8c0e9c5647bb079b73ca1b8125eabdbca972

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/14c073d5fff29a5c9b63397bca46694c759174b8...429d8c0e9c5647bb079b73ca1b8125eabdbca972
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190222/5392ebbd/attachment-0001.html>


More information about the vc mailing list