[Git][NTPsec/ntpsec][working] 6 commits: Updated new features documentation re: ntpq & root distance.
Ian Bruene
gitlab at mg.gitlab.com
Thu Apr 12 16:01:58 UTC 2018
Ian Bruene pushed to branch working at NTPsec / ntpsec
Commits:
53cf63d1 by Ian Bruene at 2018-01-25T21:38:47Z
Updated new features documentation re: ntpq & root distance.
- - - - -
22740f1f by Ian Bruene at 2018-01-25T21:39:25Z
Merge branch 'fiddler'
- - - - -
5c09fb70 by Eric S. Raymond at 2018-01-25T23:11:37Z
Fill in sys_rootdist even if we have to combine peers.
- - - - -
108a6fdf by Stephen Walker at 2018-04-08T23:07:47Z
Merge branch 'master' of gitlab.com:sdwalker/ntpsec
- - - - -
861012e3 by Stephen Walker at 2018-04-08T23:13:57Z
attic: build on OpenSSL without Camellia
Signed-off-by: Stephen Walker <stephendwalker+github at gmail.com>
- - - - -
6d5ac823 by Ian Bruene at 2018-04-12T16:01:08Z
Removed type-punning on struct ntp_control.
- - - - -
2 changed files:
- attic/digest-timing.c
- ntpd/ntp_control.c
Changes:
=====================================
attic/digest-timing.c
=====================================
--- a/attic/digest-timing.c
+++ b/attic/digest-timing.c
@@ -242,10 +242,12 @@ int main(int argc, char *argv[])
DoCMAC("AES-128", EVP_aes_128_cbc(), key, 16, packet, PACKET_LENGTH);
DoCMAC("AES-192", EVP_aes_192_cbc(), key, 24, packet, PACKET_LENGTH);
DoCMAC("AES-256", EVP_aes_256_cbc(), key, 32, packet, PACKET_LENGTH);
+#ifndef OPENSSL_NO_CAMELLIA
DoCMAC("CAM-128", EVP_camellia_128_cbc(), key, 16, packet, PACKET_LENGTH);
DoCMAC("CAM-192", EVP_camellia_192_cbc(), key, 24, packet, PACKET_LENGTH);
DoCMAC("CAM-256", EVP_camellia_256_cbc(), key, 32, packet, PACKET_LENGTH);
#endif
+#endif
return 0;
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -698,6 +698,31 @@ init_control(void)
}
+/*
+ * unmarshall_ntp_control - unmarshall data stream into a ntp_sontrol struct
+ */
+void
+unmarshall_ntp_control(struct ntp_control *pkt, struct recvbuf *rbufp)
+{
+ pkt->li_vn_mode = (uint8_t)rbufp->recv_buffer[0];
+ pkt->r_m_e_op = (uint8_t)rbufp->recv_buffer[1];
+ pkt->sequence = (uint16_t)rbufp->recv_buffer[2] << 8;
+ pkt->sequence |= (uint16_t)rbufp->recv_buffer[3];
+ pkt->sequence = ntohs(pkt->sequence);
+ pkt->status = (uint16_t)rbufp->recv_buffer[4] << 8;
+ pkt->status |= (uint16_t)rbufp->recv_buffer[5];
+ pkt->status = ntohs(pkt->status);
+ pkt->associd = (uint16_t)rbufp->recv_buffer[6] << 8;
+ pkt->associd |= (uint16_t)rbufp->recv_buffer[7];
+ pkt->associd = ntohs(pkt->associd);
+ pkt->offset = (uint16_t)rbufp->recv_buffer[8] << 8;
+ pkt->offset |= (uint16_t)rbufp->recv_buffer[9];
+ pkt->offset = ntohs(pkt->offset);
+ pkt->count = (uint16_t)rbufp->recv_buffer[10] << 8;
+ pkt->count |= (uint16_t)rbufp->recv_buffer[11];
+ pkt->count = ntohs(pkt->count);
+ memcpy(&pkt->data, rbufp->recv_buffer + 12, 480 + MAX_MAC_LEN);
+}
/*
* ctl_error - send an error response for the current request
@@ -743,6 +768,7 @@ process_control(
)
{
struct ntp_control *pkt;
+ struct ntp_control pkt_core;
int req_count;
int req_data;
const struct ctl_proc *cc;
@@ -758,7 +784,8 @@ process_control(
numctlreq++;
rmt_addr = &rbufp->recv_srcadr;
lcl_inter = rbufp->dstadr;
- pkt = (struct ntp_control *)&rbufp->recv_buffer;
+ unmarshall_ntp_control(&pkt_core, rbufp);
+ pkt = &pkt_core;
/*
* If the length is less than required for the header, or
@@ -3963,6 +3990,7 @@ read_ordlist(
const char addr_rst_s[] = "addr_restrictions";
const size_t a_r_chars = COUNTOF(addr_rst_s) - 1;
struct ntp_control * cpkt;
+ struct ntp_control pkt_core;
unsigned short qdata_octets;
UNUSED_ARG(rbufp);
@@ -3979,7 +4007,8 @@ read_ordlist(
* which are access control lists. Other request data return
* CERR_UNKNOWNVAR.
*/
- cpkt = (struct ntp_control *)&rbufp->recv_buffer;
+ unmarshall_ntp_control(&pkt_core, rbufp);
+ cpkt = &pkt_core;
qdata_octets = ntohs(cpkt->count);
if (0 == qdata_octets || (ifstatint8_ts == qdata_octets &&
!memcmp(ifstats_s, cpkt->data, ifstatint8_ts))) {
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/443582c6622950c75d0e006c56d2b78e8a00fb01...6d5ac823e750039162762fcf6dfe54c9bed14658
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/443582c6622950c75d0e006c56d2b78e8a00fb01...6d5ac823e750039162762fcf6dfe54c9bed14658
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/20180412/415f70be/attachment.html>
More information about the vc
mailing list