net: tcp: Store MSS in tcp header correctly

Use UNALIGNED_PUT() to store the MSS value into network packet
because the memory location cannot be guaranteed to be properly
aligned.

Change-Id: I77fd7a70ef45eedb657cac29457b0239b0a1d4c2
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-04-07 21:57:52 +03:00
commit 7a07f23da7

View file

@ -521,8 +521,9 @@ static void net_tcp_set_syn_opt(struct net_tcp *tcp, uint8_t *options,
recv_mss = 0;
}
*((uint32_t *)(options + *optionlen)) =
htonl((uint32_t)(recv_mss | NET_TCP_MSS_HEADER));
UNALIGNED_PUT(htonl((uint32_t)recv_mss | NET_TCP_MSS_HEADER),
(uint32_t *)(options + *optionlen));
*optionlen += NET_TCP_MSS_SIZE;
}