X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv6%2Fxfrm6_output.c;h=172dd8f10190e9a11a1af6eb8e85d108a752542d;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=712856f0f3569957cde3a72498554012f4e9dc55;hpb=5fc42a6ed0ec81088c37caadb45898ae6cd0ad2c;p=linux-2.6.git diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 712856f0f..172dd8f10 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ static void xfrm6_encap(struct sk_buff *skb) struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; struct ipv6hdr *iph, *top_iph; + int dsfield; skb_push(skb, x->props.header_len); iph = skb->nh.ipv6h; @@ -58,13 +60,16 @@ static void xfrm6_encap(struct sk_buff *skb) top_iph->version = 6; top_iph->priority = iph->priority; - if (x->props.flags & XFRM_STATE_NOECN) - IP6_ECN_clear(top_iph); top_iph->flow_lbl[0] = iph->flow_lbl[0]; top_iph->flow_lbl[1] = iph->flow_lbl[1]; top_iph->flow_lbl[2] = iph->flow_lbl[2]; + dsfield = ipv6_get_dsfield(top_iph); + dsfield = INET_ECN_encapsulate(dsfield, dsfield); + if (x->props.flags & XFRM_STATE_NOECN) + dsfield &= ~INET_ECN_MASK; + ipv6_change_dsfield(top_iph, 0, dsfield); top_iph->nexthdr = IPPROTO_IPV6; - top_iph->hop_limit = iph->hop_limit; + top_iph->hop_limit = dst_path_metric(dst, RTAX_HOPLIMIT); ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); } @@ -74,7 +79,7 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb) int mtu, ret = 0; struct dst_entry *dst = skb->dst; - mtu = dst_pmtu(dst) - sizeof(struct ipv6hdr); + mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len; if (mtu < IPV6_MIN_MTU) mtu = IPV6_MIN_MTU; @@ -86,35 +91,32 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb) return ret; } -int xfrm6_output(struct sk_buff **pskb) +int xfrm6_output(struct sk_buff *skb) { - struct sk_buff *skb = *pskb; struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; int err; if (skb->ip_summed == CHECKSUM_HW) { - err = skb_checksum_help(pskb, 0); - skb = *pskb; + err = skb_checksum_help(skb, 0); if (err) goto error_nolock; } - spin_lock_bh(&x->lock); - err = xfrm_state_check(x, skb); - if (err) - goto error; - if (x->props.mode) { err = xfrm6_tunnel_check_size(skb); if (err) - goto error; + goto error_nolock; } + spin_lock_bh(&x->lock); + err = xfrm_state_check(x, skb); + if (err) + goto error; + xfrm6_encap(skb); - err = x->type->output(pskb); - skb = *pskb; + err = x->type->output(skb); if (err) goto error;