Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / xfrm4_mode_tunnel.c
index fe5189e2e1147d338d96347666d7a98a4ac7b018..eb1dd4d643f2f92d5a2385d0839d06a3424c545c 100644 (file)
@@ -103,8 +103,12 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
 
        top_iph->protocol = xfrm_af2proto(skb_dst(skb)->ops->family);
 
-       /* DS disclosed */
-       top_iph->tos = INET_ECN_encapsulate(XFRM_MODE_SKB_CB(skb)->tos,
+       /* DS disclosing depends on XFRM_SA_XFLAG_DONT_ENCAP_DSCP */
+       if (x->props.extra_flags & XFRM_SA_XFLAG_DONT_ENCAP_DSCP)
+               top_iph->tos = 0;
+       else
+               top_iph->tos = XFRM_MODE_SKB_CB(skb)->tos;
+       top_iph->tos = INET_ECN_encapsulate(top_iph->tos,
                                            XFRM_MODE_SKB_CB(skb)->tos);
 
        flags = x->props.flags;