[Git][NTPsec/ntpsec][master] 4 commits: Added comments about where to find source for sockaddr_*

Hal Murray gitlab at mg.gitlab.com
Sat Mar 30 21:15:19 UTC 2019



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
f6059609 by Hal Murray at 2019-03-30T08:55:52Z
Added comments about where to find source for sockaddr_*

- - - - -
b8581e7d by Hal Murray at 2019-03-30T08:57:07Z
NTS: free cert
  There may be more things that need free-ing

- - - - -
8fb13e96 by Hal Murray at 2019-03-30T08:58:26Z
NTS: fix printout from accept-ed when IPv6

- - - - -
0a5a780f by Hal Murray at 2019-03-30T08:59:25Z
NTS: Added a bug section to devel/TODO-NTS

- - - - -


4 changed files:

- devel/TODO-NTS
- include/ntp_net.h
- ntpd/nts_client.c
- ntpd/nts_server.c


Changes:

=====================================
devel/TODO-NTS
=====================================
@@ -1,3 +1,8 @@
+BUGS:
+  timeout on client connect too long (system default)
+  Is 3 seconds timeout OK? (both client and server)
+
+
 multithread msyslog
   libntp/lib_strbuf.c too
   strerror


=====================================
include/ntp_net.h
=====================================
@@ -14,10 +14,10 @@
 
 #include "ntp_malloc.h"
 
-typedef union {
-	struct sockaddr		sa;
-	struct sockaddr_in	sa4;
-	struct sockaddr_in6	sa6;
+typedef union {				/* On Linux, these come from: */
+	struct sockaddr		sa;	/* /usr/include/bits/socket.h */
+	struct sockaddr_in	sa4;	/* /usr/include/linux/in.h */
+	struct sockaddr_in6	sa6;	/* /usr/include/linux/in6.h */
 } sockaddr_u;
 
 /*


=====================================
ntpd/nts_client.c
=====================================
@@ -326,6 +326,7 @@ bool check_certificate(SSL *ssl, struct peer* peer) {
     certname = X509_get_issuer_name(cert);
     X509_NAME_oneline(certname, name, sizeof(name));
     msyslog(LOG_INFO, "NTSc: certificate issuer name: %s", name);
+    X509_free(cert);
     certok = SSL_get_verify_result(ssl);
     if (X509_V_OK == certok) {
       msyslog(LOG_INFO, "NTSc: certificate is valid.");


=====================================
ntpd/nts_server.c
=====================================
@@ -109,13 +109,13 @@ void* nts_ke_listener(void* arg) {
     int sock = *(int*)arg;
 
     while(1) {
-        struct sockaddr addr;
+        sockaddr_u addr;
         uint len = sizeof(addr);
         SSL *ssl;
         l_fp start, finish;
-        int err;
+        int client, err;
 
-        int client = accept(sock, &addr, &len);
+        client = accept(sock, &addr.sa, &len);
         if (client < 0) {
             msyslog(LOG_ERR, "NTSs: TCP accept failed: %s", strerror(errno));
             if (EBADF == errno)
@@ -123,7 +123,7 @@ void* nts_ke_listener(void* arg) {
             sleep(1);		/* avoid log clutter on bug */
             continue;
         }
-	nts_ke_serves++;
+        nts_ke_serves++;
         get_systime(&start);
         msyslog(LOG_INFO, "NTSs: TCP accept-ed from %s",
             sockporttoa((sockaddr_u *)&addr));



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/9eae92b6b79d93163c3bce19fb34f817574f383a...0a5a780fbd407a7f0e119b3c0cd3769356920a9c

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/9eae92b6b79d93163c3bce19fb34f817574f383a...0a5a780fbd407a7f0e119b3c0cd3769356920a9c
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/20190330/0cf3b2f1/attachment-0001.html>


More information about the vc mailing list