summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/dhcp-packet.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-24 01:09:21 +0100
committerTom Gundersen <teg@jklm.no>2014-02-24 03:28:19 +0100
commit55dab2ed837c17236b7df12decaffbc4388d1dff (patch)
tree44b39f61128131327baf3311277d4694311b7446 /src/libsystemd-dhcp/dhcp-packet.c
parent872c2ab3e2887c1c2b6c9815a201683e246e56fc (diff)
sd-dhcp-client: respect TP_STATUS_CSUMNOTREADY
If an UDP packet has not passed through a hardware device, its checksum may not have been computed. This is exposed through the TP_STATUS_CSUMNOTREADY sockopt. When using raw sockets, skip checksum validation when TP_STATUS_CSUMNOTREADY is set. This is necessary for dhcp to work directly over a veth tunnel, e.g. as done in systemd-nspawn.
Diffstat (limited to 'src/libsystemd-dhcp/dhcp-packet.c')
-rw-r--r--src/libsystemd-dhcp/dhcp-packet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-dhcp/dhcp-packet.c b/src/libsystemd-dhcp/dhcp-packet.c
index 1937de4252..8388e56222 100644
--- a/src/libsystemd-dhcp/dhcp-packet.c
+++ b/src/libsystemd-dhcp/dhcp-packet.c
@@ -113,7 +113,7 @@ void dhcp_packet_append_ip_headers(DHCPPacket *packet, uint16_t len) {
packet->ip.check = dhcp_checksum(&packet->ip, DHCP_IP_SIZE);
}
-int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len) {
+int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum) {
size_t hdrlen;
assert(packet);
@@ -168,7 +168,7 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len) {
return -EINVAL;
}
- if (packet->udp.check) {
+ if (checksum && packet->udp.check) {
packet->ip.check = packet->udp.len;
packet->ip.ttl = 0;