net: Calculate IPv4 checksum when sending IPv4 packet

Change-Id: I7ecf578efcfedab2f5814d2822f3895cba375622
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-09-09 16:07:25 +03:00
parent e04445a042
commit ae3f1cd622
1 changed files with 3 additions and 0 deletions

View File

@ -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;