Skip to content

Commit f48f695

Browse files
authored
DHCP: Add parentheses to macro definitions
Missing parentheses in IP_UDP_SIZE caused wrong computation of MSZ (option57). When mtu is 1500, current MSZ value is 1488=1500-20+8, while the correct value should be 1472=1500-(20+8). Also added parentheses for BOOTP_MIN_MTU.
1 parent 661cdbd commit f48f695

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dhcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
__CTASSERT(sizeof(struct ip) == 20);
9999
__CTASSERT(sizeof(struct udphdr) == 8);
100100
__CTASSERT(sizeof(struct bootp) == 300);
101-
#define IP_UDP_SIZE sizeof(struct ip) + sizeof(struct udphdr)
102-
#define BOOTP_MIN_MTU IP_UDP_SIZE + sizeof(struct bootp)
101+
#define IP_UDP_SIZE (sizeof(struct ip) + sizeof(struct udphdr))
102+
#define BOOTP_MIN_MTU (IP_UDP_SIZE + sizeof(struct bootp))
103103

104104
struct dhcp_op {
105105
uint8_t value;

0 commit comments

Comments
 (0)