diff options
author | Tom Gundersen <teg@jklm.no> | 2014-02-24 01:09:21 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-02-24 03:28:19 +0100 |
commit | 55dab2ed837c17236b7df12decaffbc4388d1dff (patch) | |
tree | 44b39f61128131327baf3311277d4694311b7446 /src/libsystemd-dhcp/dhcp-network.c | |
parent | 872c2ab3e2887c1c2b6c9815a201683e246e56fc (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-network.c')
-rw-r--r-- | src/libsystemd-dhcp/dhcp-network.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd-dhcp/dhcp-network.c b/src/libsystemd-dhcp/dhcp-network.c index 6c9d4ef999..934e8bf13e 100644 --- a/src/libsystemd-dhcp/dhcp-network.c +++ b/src/libsystemd-dhcp/dhcp-network.c @@ -32,7 +32,7 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link) { - int s; + int s, one = 1; assert(index > 0); assert(link); @@ -48,6 +48,9 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link) link->ll.sll_halen = ETH_ALEN; memset(link->ll.sll_addr, 0xff, ETH_ALEN); + if (setsockopt (s, SOL_PACKET, PACKET_AUXDATA, &one, sizeof(one)) < 0) + return -errno; + if (bind(s, &link->sa, sizeof(link->ll)) < 0) { close_nointr_nofail(s); return -errno; |