chiark / gitweb /
sd-dhcp: check for udp packets
[elogind.git] / src / libsystemd-network / dhcp-packet.c
index bed942fd84345d0af51fa80dd3b9efe973408c16..9779cbd51d0de5de4885887729537a051ed86aa4 100644 (file)
@@ -157,6 +157,11 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
 
         /* UDP */
 
+        if (packet->ip.protocol != IPPROTO_UDP) {
+                log_dhcp_client(client, "ignoring packet: not UDP");
+                return -EINVAL;
+        }
+
         if (len < DHCP_IP_UDP_SIZE) {
                 log_dhcp_client(client, "ignoring packet: packet (%zu bytes) "
                                 " smaller than IP+UDP header (%u bytes)", len,