sd-dhcp: check for udp packets

Do not try to parse ICMP packets

[tomegun: slightly tweaked debug message]
This commit is contained in:
Umut Tezduyar Lindskog 2014-03-30 19:09:14 +02:00 committed by Tom Gundersen
parent 3cbbb3e678
commit d454a6748c

View 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,