summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-protocol.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-04-06 14:05:32 +0200
committerTom Gundersen <teg@jklm.no>2014-04-06 19:36:05 +0200
commit3b7ca119fdc501e21f017695dc9b6f82fdbd1d93 (patch)
treeefefc912fa1925f1197dd0e5b56a14ad2282de38 /src/libsystemd-network/dhcp-protocol.h
parent19aa72f74e41045510b4af3f1415b419d42ff20b (diff)
sd-dhcp-client: move magic cookie into DHCPMessage struct
Also move the checking of it to the main message handler, rather than the options parser. Fix a bug, so we now drop the packet if any of the magic bytes don't match. Before we used to only drop the packet if they were all wrong.
Diffstat (limited to 'src/libsystemd-network/dhcp-protocol.h')
-rw-r--r--src/libsystemd-network/dhcp-protocol.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd-network/dhcp-protocol.h b/src/libsystemd-network/dhcp-protocol.h
index 9aa9618b44..400e953f41 100644
--- a/src/libsystemd-network/dhcp-protocol.h
+++ b/src/libsystemd-network/dhcp-protocol.h
@@ -43,6 +43,7 @@ struct DHCPMessage {
uint8_t chaddr[16];
uint8_t sname[64];
uint8_t file[128];
+ be32_t magic;
} _packed_;
typedef struct DHCPMessage DHCPMessage;
@@ -58,7 +59,8 @@ typedef struct DHCPPacket DHCPPacket;
#define DHCP_IP_SIZE (int32_t)(sizeof(struct iphdr))
#define DHCP_IP_UDP_SIZE (int32_t)(sizeof(struct udphdr) + DHCP_IP_SIZE)
#define DHCP_MESSAGE_SIZE (int32_t)(sizeof(DHCPMessage))
-#define DHCP_MIN_OPTIONS_SIZE 312
+#define DHCP_MIN_OPTIONS_SIZE 308
+#define DHCP_MAGIC_COOKIE (uint32_t)(0x63825363)
enum {
DHCP_PORT_SERVER = 67,