[Git][NTPsec/ntpsec][master] NTS: add support for port_negotiation

Hal Murray gitlab at mg.gitlab.com
Sun Mar 24 02:34:35 UTC 2019



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
0bdb9c2b by Hal Murray at 2019-03-24T02:33:33Z
NTS: add support for port_negotiation

- - - - -


1 changed file:

- ntpd/nts_client.c


Changes:

=====================================
ntpd/nts_client.c
=====================================
@@ -236,7 +236,8 @@ int open_TCP_socket(struct peer *peer) {
   memcpy(&sockaddr, answer->ai_addr, answer->ai_addrlen);
   msyslog(LOG_INFO, "NTSc: nts_probe connecting to %s:%s => %s",
     host, port, sockporttoa(&sockaddr));
-  SET_PORT(&sockaddr, NTP_PORT);	/* setup default NTP address */
+  /* switch to NTP port in case of server-name:port */
+  SET_PORT(&sockaddr, NTP_PORT);
   sockfd = socket(answer->ai_family, SOCK_STREAM, 0);
   if (-1 == sockfd) {
     msyslog(LOG_INFO, "NTSc: nts_probe: no socket: %s", strerror(errno));
@@ -464,6 +465,11 @@ bool nts_client_process_response(struct peer* peer, SSL *ssl) {
         peer->nts_state.writeIdx = peer->nts_state.writeIdx % NTS_MAX_COOKIES;
         peer->nts_state.count++;
         break;
+      case nts_port_negotiation:
+        data = next_uint16(&buf);
+        SET_PORT(&sockaddr, data);
+        msyslog(LOG_ERR, "NTSc: Using port %d", data);
+        break;
       case nts_end_of_message:
         if ((0 != length) || !critical) {
           msyslog(LOG_ERR, "NTSc: EOM-Wrong length or not Critical: %d, %d",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0bdb9c2b7425178be1e1008d9670224c51a8060d

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0bdb9c2b7425178be1e1008d9670224c51a8060d
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/20190324/fc750c9a/attachment.html>


More information about the vc mailing list