Commit 1c7ea64d authored by Sebastian Smolorz via Xenomai's avatar Sebastian Smolorz via Xenomai Committed by Jan Kiszka

net/tcp: Set valid flags in struct tcphdr on little and big endian machines

Setting TCP header flags like ACK was fragile and not working when
RTnet was running on big endian processors. Use the macro provided
by the linux kernel for setting the TCP flags instead.
Signed-off-by: 's avatarSebastian Smolorz <sebastian.smolorz@gmx.de>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent b107e6cf
......@@ -280,12 +280,6 @@ static inline int rt_tcp_after(__u32 seq1, __u32 seq2)
return (__s32)(seq2-seq1) <= 0;
}
static inline void rt_tcp_set_flags(struct tcphdr* th, __be32 flags)
{
__be16 *tf = ((__be16*)th) + 6;
*tf = flags;
}
static inline u32 rt_tcp_compute_ack_seq(struct tcphdr* th, u32 len)
{
u32 ack_seq = ntohl(th->seq) + len;
......@@ -625,11 +619,10 @@ static void rt_tcp_build_header(struct tcp_socket *ts, struct rtskb *skb,
if (unlikely(is_keepalive))
th->seq--;
tcp_flag_word(th) = flags;
th->ack_seq = htonl(ts->sync.ack_seq);
th->window = htons(ts->sync.window);
rt_tcp_set_flags(th, flags);
th->doff = tcphdrlen >> 2; /* No options for now */
th->res1 = 0;
th->check = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment