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)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jul 2017 08:46:10 +0000 (01:46 -0700)
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>
net/ipv4/ip_output.c
net/ipv4/tcp_output.c

index 2e61e2af251ae7b34c2ce19190119fe7a60e0e02..7eb252dceceea31acb84fc0bbc902ca426283154 100644 (file)
@@ -173,7 +173,8 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const 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(net, skb->sk, skb);
index 4d36f0b093e61162a81aa52987e3a9d7719517c0..4e985dea1dd24fdecfbf9b47d51cff698e97cd2f 100644 (file)
@@ -3213,6 +3213,7 @@ struct sk_buff *tcp_make_synack(const 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)
         */