From d454a6748c34f0f67eef618238e0a64b80c85303 Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lindskog Date: Sun, 30 Mar 2014 19:09:14 +0200 Subject: sd-dhcp: check for udp packets Do not try to parse ICMP packets [tomegun: slightly tweaked debug message] --- src/libsystemd-network/dhcp-packet.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c index bed942fd84..9779cbd51d 100644 --- a/src/libsystemd-network/dhcp-packet.c +++ b/src/libsystemd-network/dhcp-packet.c @@ -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, -- cgit v1.2.3-54-g00ecf