summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-03-30 20:33:57 +0200
committerTom Gundersen <teg@jklm.no>2014-03-30 20:46:40 +0200
commit6e34949d7207f9dff4e2b01a3037a0af88e1c25c (patch)
tree62fd99695d85eb9a5e41df85379d37c8556c559a /src
parentd454a6748c34f0f67eef618238e0a64b80c85303 (diff)
sd-dhcp: check for ipv4 packets
Diffstat (limited to 'src')
-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 9779cbd51d..3b62c2572f 100644
--- a/src/libsystemd-network/dhcp-packet.c
+++ b/src/libsystemd-network/dhcp-packet.c
@@ -130,6 +130,11 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
return -EINVAL;
}
+ if (packet->ip.version != IPVERSION) {
+ log_dhcp_client(client, "ignoring packet: not IPv4");
+ return -EINVAL;
+ }
+
if (packet->ip.ihl < 5) {
log_dhcp_client(client, "ignoring packet: IPv4 IHL (%u words) invalid",
packet->ip.ihl);