summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-dhcp/sd-dhcp-client.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libsystemd-dhcp/sd-dhcp-client.c b/src/libsystemd-dhcp/sd-dhcp-client.c
index 130a61d6f8..37fad9a301 100644
--- a/src/libsystemd-dhcp/sd-dhcp-client.c
+++ b/src/libsystemd-dhcp/sd-dhcp-client.c
@@ -838,13 +838,18 @@ static int client_verify_headers(sd_dhcp_client *client, DHCPPacket *message,
hdrlen))
return -EINVAL;
- message->ip.check = message->udp.len;
- message->ip.ttl = 0;
-
- if (hdrlen + be16toh(message->udp.len) > len ||
- client_checksum(&message->ip.ttl, be16toh(message->udp.len) + 12))
+ if (hdrlen + be16toh(message->udp.len) > len)
return -EINVAL;
+ if (message->udp.check) {
+ message->ip.check = message->udp.len;
+ message->ip.ttl = 0;
+
+ if (client_checksum(&message->ip.ttl,
+ be16toh(message->udp.len) + 12))
+ return -EINVAL;
+ }
+
if (be16toh(message->udp.source) != DHCP_PORT_SERVER ||
be16toh(message->udp.dest) != DHCP_PORT_CLIENT)
return -EINVAL;