net: reflect mark on tcp syn ack packets
authorJamal Hadi Salim <jhs@mojatatu.com>
Mon, 3 Jul 2017 13:51:50 +0000 (09:51 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 12 Oct 2017 14:28:01 +0000 (15:28 +0100)
commit e05a90ec9e1680952454ea9510da9a761a5baac9 upstream.

SYN-ACK responses on a server in response to a SYN from a client
did not get the injected skb mark that was tagged on the SYN packet.

Fixes: 84f39b08d786 ("net: support marking accepting TCP sockets")
Reviewed-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv4/ip_output.c
net/ipv4/tcp_output.c

index 3cb23fb85a4a8c496288c665803b4166ddeef9c0..6561c103e2162fcaf4ef8015549e3cf655334566 100644 (file)
@@ -158,7 +158,8 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
        }
 
        skb->priority = sk->sk_priority;
-       skb->mark = sk->sk_mark;
+       if (!skb->mark)
+               skb->mark = sk->sk_mark;
 
        /* Send it out. */
        return ip_local_out(skb);
index f8ee2fc404cd71b503e27eb684428e4a6c5183b3..6ad29aa904bf9583e7e2daf228fc1facbe89d057 100644 (file)
@@ -2863,6 +2863,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
        TCP_ECN_make_synack(req, th);
        th->source = htons(ireq->ir_num);
        th->dest = ireq->ir_rmt_port;
+       skb->mark = ireq->ir_mark;
        /* Setting of flags are superfluous here for callers (and ECE is
         * not even correctly set)
         */