chiark / gitweb /
sd-dhcp: check for ipv4 packets
[elogind.git] / src / libsystemd-network / dhcp-packet.c
index 9779cbd51d0de5de4885887729537a051ed86aa4..3b62c2572f52608f7990b64bb20355319ca6a21a 100644 (file)
@@ -130,6 +130,11 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
                 return -EINVAL;
         }
 
+        if (packet->ip.version != IPVERSION) {
+                log_dhcp_client(client, "ignoring packet: not IPv4");
+                return -EINVAL;
+        }
+
         if (packet->ip.ihl < 5) {
                 log_dhcp_client(client, "ignoring packet: IPv4 IHL (%u words) invalid",
                                 packet->ip.ihl);