ipv4: tcp: fix TOS value in ACK messages sent from TIME_WAIT
There is a long standing bug in linux tcp stack, about ACK messages sent on behalf of TIME_WAIT sockets. In the IP header of the ACK message, we choose to reflect TOS field of incoming message, and this might break some setups. Example of things that were broken : - Routing using TOS as a selector - Firewalls - Trafic classification / shaping We now remember in timewait structure the inet tos field and use it in ACK generation, and route lookup. Notes : - We still reflect incoming TOS in RST messages. - We could extend MuraliRaja Muniraju patch to report TOS value in netlink messages for TIME_WAIT sockets. - A patch is needed for IPv6 Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
318cf7aaa0
commit
66b13d99d9
@ -1466,7 +1466,7 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset,
|
||||
* structure to pass arguments.
|
||||
*/
|
||||
void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
|
||||
struct ip_reply_arg *arg, unsigned int len)
|
||||
const struct ip_reply_arg *arg, unsigned int len)
|
||||
{
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct ip_options_data replyopts;
|
||||
@ -1489,7 +1489,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
|
||||
}
|
||||
|
||||
flowi4_init_output(&fl4, arg->bound_dev_if, 0,
|
||||
RT_TOS(ip_hdr(skb)->tos),
|
||||
RT_TOS(arg->tos),
|
||||
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
||||
ip_reply_arg_flowi_flags(arg),
|
||||
daddr, rt->rt_spec_dst,
|
||||
@ -1506,7 +1506,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
|
||||
with locally disabled BH and that sk cannot be already spinlocked.
|
||||
*/
|
||||
bh_lock_sock(sk);
|
||||
inet->tos = ip_hdr(skb)->tos;
|
||||
inet->tos = arg->tos;
|
||||
sk->sk_priority = skb->priority;
|
||||
sk->sk_protocol = ip_hdr(skb)->protocol;
|
||||
sk->sk_bound_dev_if = arg->bound_dev_if;
|
||||
|
Reference in New Issue
Block a user