+ pd->ttl = ih0->ip4.ttl;
+
+ if (PREDICT_FALSE (ipsec_sa_is_set_IS_TUNNEL (sa0)))
+ {
+ if (sa0->tunnel.t_dscp)
+ pd->tos = sa0->tunnel.t_dscp << 2;
+ else
+ {
+ pd->tos = ih0->ip4.tos;
+
+ if (!(sa0->tunnel_flags &
+ TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
+ pd->tos &= 0x3;
+ if (!(sa0->tunnel_flags &
+ TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN))
+ pd->tos &= 0xfc;
+ }
+ }
+ else
+ {
+ pd->tos = ih0->ip4.tos;
+ }
+