gdhcp: Allow client to work on veth devices
PATCH 1/1 gdhcp: Allow client to work on veth devices
veth devices do not compute a checksum over the entire message. They simply pre-compute the pseudo-header portion and include this in the checksum field. Support such devices by computing the partial checksum. If the partial checksum matches, accept the packet.
--- gdhcp/client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
gdhcp/client.c +7 -2
@@ -1355,8 +1355,13 @@ static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd, packet.ip.tot_len = packet.udp.len;/* yes, this is needed */ check = packet.udp.check; packet.udp.check =0 ; -if (check && check !=dhcp_checksum (&packet, bytes)) -return -1 ; + +if (check) { +uint16_t partial = ~dhcp_checksum (&packet,sizeof (struct iphdr )); + +if (check != partial && check !=dhcp_checksum (&packet, bytes)) +return -1 ; + }memcpy (dhcp_pkt, &packet.data, bytes - (sizeof (packet.ip) +sizeof (packet.udp)));
Signature · 1 line
2.44.0
This patch was applied to connman.git (master) by Denis Kenzior <[email protected]>:
Hello:
This patch was applied to connman.git (master)
by Denis Kenzior <[email protected]>:
Quoted 7 lines · On Wed, 17 Apr 2024 11:22:24 -0500 you wrote:
veth devices do not compute a checksum over the entire message. They simply pre-compute the pseudo-header portion and include this in the checksum field. Support such devices by computing the partial checksum. If the partial checksum matches, accept the packet.
--- gdhcp/client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Here is the summary with links:
- gdhcp: Allow client to work on veth devices
https://git.kernel.org/pub/scm/network/connman/connman.git/?id=1d064a14ce45
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html