summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>2014-03-30 19:09:14 +0200
committerTom Gundersen <teg@jklm.no>2014-03-30 20:46:20 +0200
commitd454a6748c34f0f67eef618238e0a64b80c85303 (patch)
tree182c702147940746343ab63d68e983d1b439df03 /src/libsystemd-network
parent3cbbb3e6787ad002cae3e1c80179af7d4d6cf9e7 (diff)
sd-dhcp: check for udp packets
Do not try to parse ICMP packets [tomegun: slightly tweaked debug message]
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/dhcp-packet.c5
1 files changed, 5 insertions, 0 deletions
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,