Require uint32_t alignment for ipfw_insn

There are many casts of this struct to uint32_t, so we also need to ensure
that it is sufficiently aligned to safely perform this cast on architectures
that don't allow unaligned accesses. This fixes lots of -Wcast-align warnings.

Reviewed By:	ae
Differential Revision: https://reviews.freebsd.org/D27879
This commit is contained in:
Alex Richardson 2021-01-19 11:32:33 +00:00
parent be5972695f
commit a81c165bce

View File

@ -339,7 +339,7 @@ enum ipfw_opcodes { /* arguments (4 byte each) */
*
*/
typedef struct _ipfw_insn { /* template for instructions */
u_int8_t opcode;
_Alignas(_Alignof(u_int32_t)) u_int8_t opcode;
u_int8_t len; /* number of 32-bit words */
#define F_NOT 0x80
#define F_OR 0x40