From 09e5eca32c1872c1676c25dfd3f240b10bc85d55 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Fri, 26 Apr 2019 14:15:55 +0200 Subject: dhcpv4: fix DHCP packet size Calculate the DHCP packet size based on the number of DHCP options in the message. Make sure the DHCP packet size does not go lower than 300 bytes as some clients ignore DHCP messages smaller than 300 bytes. Based on a patch by Dainis Jonitis Signed-off-by: Hans Dedecker --- src/dhcpv4.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/dhcpv4.h') diff --git a/src/dhcpv4.h b/src/dhcpv4.h index 96bd068..505346f 100644 --- a/src/dhcpv4.h +++ b/src/dhcpv4.h @@ -19,6 +19,8 @@ #define DHCPV4_FLAG_BROADCAST 0x8000 +#define DHCPV4_MIN_PACKET_SIZE 300 + enum dhcpv4_op { DHCPV4_BOOTREQUEST = 1, DHCPV4_BOOTREPLY = 2 @@ -37,6 +39,7 @@ enum dhcpv4_msg { }; enum dhcpv4_opt { + DHCPV4_OPT_PAD = 0, DHCPV4_OPT_NETMASK = 1, DHCPV4_OPT_ROUTER = 3, DHCPV4_OPT_DNSSERVER = 6, -- cgit v1.2.3