[Git][NTPsec/ntpsec][master] NTS: repair -4, -6 switch
Hal Murray
gitlab at mg.gitlab.com
Wed Mar 27 08:16:45 UTC 2019
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
c4d91288 by Hal Murray at 2019-03-27T08:10:30Z
NTS: repair -4, -6 switch
- - - - -
1 changed file:
- ntpd/nts_client.c
Changes:
=====================================
ntpd/nts_client.c
=====================================
@@ -27,12 +27,12 @@
#include "nts2.h"
#include "ntp_dns.h"
-int open_TCP_socket(const char *hostname);
+int open_TCP_socket(struct peer *peer, const char *hostname);
bool nts_set_cert_search(SSL_CTX *ctx);
void set_hostname(SSL *ssl, const char *hostname);
-bool check_certificate(SSL *ssl, struct peer* peer);
-bool nts_client_send_request(SSL *ssl, struct peer* peer);
-bool nts_client_process_response(SSL *ssl, struct peer* peer);
+bool check_certificate(SSL *ssl, struct peer *peer);
+bool nts_client_send_request(SSL *ssl, struct peer *peer);
+bool nts_client_process_response(SSL *ssl, struct peer *peer);
bool nts_server_lookup(char *server, sockaddr_u *addr);
static SSL_CTX *client_ctx = NULL;
@@ -121,7 +121,7 @@ bool nts_probe(struct peer * peer) {
hostname = hostbuf;
}
- server = open_TCP_socket(hostname);
+ server = open_TCP_socket(peer, hostname);
if (-1 == server) {
nts_ke_probes_bad++;
return false;
@@ -209,7 +209,7 @@ bool nts_check(struct peer *peer) {
return addrOK;
}
-int open_TCP_socket(const char *hostname) {
+int open_TCP_socket(struct peer *peer, const char *hostname) {
char host[256], port[32];
char *tmp;
struct addrinfo hints;
@@ -241,7 +241,7 @@ int open_TCP_socket(const char *hostname) {
ZERO(hints);
hints.ai_protocol = IPPROTO_TCP;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = AF(&peer->srcadr); /* -4, -6 switch */
get_systime(&start);
gai_rc = getaddrinfo(host, port, &hints, &answer);
if (0 != gai_rc) {
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c4d9128831d427738deec6235e363b9bfb21db1c
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c4d9128831d427738deec6235e363b9bfb21db1c
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/20190327/19fac4bd/attachment-0001.html>
More information about the vc
mailing list