mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
dhcp: split out DHCP_MESSAGE_HEADER_DEFINITION to allow building test-dhcp-server.c with -Werror=flex-array-member-not-at-end
This commit is contained in:
@@ -19,22 +19,25 @@
|
||||
* MIN_V6ONLY_WAIT: The lower boundary for V6ONLY_WAIT. Value: 300 seconds */
|
||||
#define MIN_V6ONLY_WAIT_USEC (300U * USEC_PER_SEC)
|
||||
|
||||
struct DHCPMessage {
|
||||
uint8_t op;
|
||||
uint8_t htype;
|
||||
uint8_t hlen;
|
||||
uint8_t hops;
|
||||
be32_t xid;
|
||||
be16_t secs;
|
||||
be16_t flags;
|
||||
be32_t ciaddr;
|
||||
be32_t yiaddr;
|
||||
be32_t siaddr;
|
||||
be32_t giaddr;
|
||||
uint8_t chaddr[16];
|
||||
uint8_t sname[64];
|
||||
uint8_t file[128];
|
||||
#define DHCP_MESSAGE_HEADER_DEFINITION \
|
||||
uint8_t op; \
|
||||
uint8_t htype; \
|
||||
uint8_t hlen; \
|
||||
uint8_t hops; \
|
||||
be32_t xid; \
|
||||
be16_t secs; \
|
||||
be16_t flags; \
|
||||
be32_t ciaddr; \
|
||||
be32_t yiaddr; \
|
||||
be32_t siaddr; \
|
||||
be32_t giaddr; \
|
||||
uint8_t chaddr[16]; \
|
||||
uint8_t sname[64]; \
|
||||
uint8_t file[128]; \
|
||||
be32_t magic;
|
||||
|
||||
struct DHCPMessage {
|
||||
DHCP_MESSAGE_HEADER_DEFINITION;
|
||||
uint8_t options[];
|
||||
} _packed_;
|
||||
|
||||
|
||||
@@ -82,7 +82,9 @@ static int test_basic(bool bind_to_interface) {
|
||||
static void test_message_handler(void) {
|
||||
_cleanup_(sd_dhcp_server_unrefp) sd_dhcp_server *server = NULL;
|
||||
struct {
|
||||
DHCPMessage message;
|
||||
struct {
|
||||
DHCP_MESSAGE_HEADER_DEFINITION;
|
||||
} _packed_ message;
|
||||
struct {
|
||||
uint8_t code;
|
||||
uint8_t length;
|
||||
|
||||
Reference in New Issue
Block a user