From ae3f1cd622adf6244264ca4368ef7f183e481244 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 9 Sep 2016 16:07:25 +0300 Subject: [PATCH] net: Calculate IPv4 checksum when sending IPv4 packet Change-Id: I7ecf578efcfedab2f5814d2822f3895cba375622 Signed-off-by: Jukka Rissanen --- net/yaip/ipv4.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/yaip/ipv4.c b/net/yaip/ipv4.c index a68f8cae630..d1c52dc744f 100644 --- a/net/yaip/ipv4.c +++ b/net/yaip/ipv4.c @@ -82,6 +82,9 @@ struct net_buf *net_ipv4_finalize(struct net_context *context, NET_IPV4_BUF(buf)->len[0] = total_len / 256; NET_IPV4_BUF(buf)->len[1] = total_len - NET_IPV4_BUF(buf)->len[0] * 256; + NET_IPV4_BUF(buf)->chksum = 0; + NET_IPV4_BUF(buf)->chksum = ~net_calc_chksum_ipv4(buf); + #if defined(CONFIG_NET_UDP) if (net_context_get_ip_proto(context) == IPPROTO_UDP) { NET_UDP_BUF(buf)->chksum = 0;