[Git][NTPsec/ntpsec][master] Address GitLab issue #277: 32 bit OS warnings

Eric S. Raymond gitlab at mg.gitlab.com
Fri Aug 11 13:42:52 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
042c96d4 by Eric S. Raymond at 2017-08-11T09:42:35-04:00
Address GitLab issue #277: 32 bit OS warnings

- - - - -


1 changed file:

- include/ntp_control.h


Changes:

=====================================
include/ntp_control.h
=====================================
--- a/include/ntp_control.h
+++ b/include/ntp_control.h
@@ -6,6 +6,12 @@
 
 #include "ntp_types.h"
 
+/* The attribute after this structure is a gcc/clang extension that forces
+ * the beginning of a structure instance to be 32-bit aligned.  Without this
+ * attempting to compile on a 32-bit host may throw warnings or errors when
+ * a pointer to this tructure is passed to authdecrypt/authencrypt, both of
+ * which expect to be able to treat the structure as an array of uint32_t
+ * elements.  Ideally, we'd get rid of that nasty type punning. */
 struct ntp_control {
 	uint8_t li_vn_mode;		/* leap, version, mode */
 	uint8_t r_m_e_op;		/* response, more, error, opcode */
@@ -15,7 +21,7 @@ struct ntp_control {
 	uint16_t offset;		/* offset of this batch of data */
 	uint16_t count;			/* count of data in this packet */
 	uint8_t data[480 + MAX_MAC_LEN]; /* data + auth */
-};
+} __attribute__((aligned(32)));
 
 /*
  * Length of the control header, in octets



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/042c96d49ce392790cd97fd7acfaf496899b2fde

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/042c96d49ce392790cd97fd7acfaf496899b2fde
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/20170811/3709539a/attachment.html>


More information about the vc mailing list