[systemd-devel] [PATCH] sd-dhcp: check for udp packets
Umut Tezduyar Lindskog
umut.tezduyar at axis.com
Sun Mar 30 10:09:14 PDT 2014
Do not try to parse ICMP packets
---
src/libsystemd-network/dhcp-packet.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c
index bed942f..f4a6227 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: packet is 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,
--
1.7.10.4
More information about the systemd-devel
mailing list