chiark / gitweb /
sd-dhcp: check for udp packets
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>
Sun, 30 Mar 2014 17:09:14 +0000 (19:09 +0200)
committerTom Gundersen <teg@jklm.no>
Sun, 30 Mar 2014 18:46:20 +0000 (20:46 +0200)
Do not try to parse ICMP packets

[tomegun: slightly tweaked debug message]

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,