summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/dhcp-packet.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-04-06 19:35:36 +0200
committerTom Gundersen <teg@jklm.no>2014-04-06 19:42:11 +0200
commit0c79c68d93d721d37ba088fb50dbf07bb0d447e5 (patch)
tree597fbd5e1524af6e0479ceea2813e20148aea653 /src/libsystemd-network/dhcp-packet.c
parent3b7ca119fdc501e21f017695dc9b6f82fdbd1d93 (diff)
sd-dhcp-client: eagerly drop too small packets
If they are too small to fit the IP+UDP+DHCP headers they can be of no use, so don't waste resources parsing them. This is at the cost of losing some verbosity in the logging.
Diffstat (limited to 'src/libsystemd-network/dhcp-packet.c')
-rw-r--r--src/libsystemd-network/dhcp-packet.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c
index 0549f575ac..102ed096af 100644
--- a/src/libsystemd-network/dhcp-packet.c
+++ b/src/libsystemd-network/dhcp-packet.c
@@ -113,13 +113,6 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
/* IP */
- if (len < DHCP_IP_SIZE) {
- log_dhcp_client(client, "ignoring packet: packet (%zu bytes) "
- " smaller than IP header (%u bytes)", len,
- DHCP_IP_SIZE);
- return -EINVAL;
- }
-
if (packet->ip.version != IPVERSION) {
log_dhcp_client(client, "ignoring packet: not IPv4");
return -EINVAL;
@@ -152,13 +145,6 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
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,
- DHCP_IP_UDP_SIZE);
- return -EINVAL;
- }
-
if (len < hdrlen + be16toh(packet->udp.len)) {
log_dhcp_client(client, "ignoring packet: packet (%zu bytes) "
"smaller than expected (%zu) by UDP header", len,