aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/xfrm6_mode_transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/xfrm6_mode_transport.c')
-rw-r--r--net/ipv6/xfrm6_mode_transport.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c
index 3a4b39b12bad..c026bfea820a 100644
--- a/net/ipv6/xfrm6_mode_transport.c
+++ b/net/ipv6/xfrm6_mode_transport.c
@@ -32,11 +32,12 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
32 int hdr_len; 32 int hdr_len;
33 33
34 skb_push(skb, x->props.header_len); 34 skb_push(skb, x->props.header_len);
35 iph = skb->nh.ipv6h; 35 iph = ipv6_hdr(skb);
36 36
37 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 37 hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
38 skb->nh.raw = prevhdr - x->props.header_len; 38 skb_set_network_header(skb,
39 skb->h.raw = skb->data + hdr_len; 39 (prevhdr - x->props.header_len) - skb->data);
40 skb_set_transport_header(skb, hdr_len);
40 memmove(skb->data, iph, hdr_len); 41 memmove(skb->data, iph, hdr_len);
41 return 0; 42 return 0;
42} 43}
@@ -51,13 +52,16 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
51 */ 52 */
52static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb) 53static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
53{ 54{
54 int ihl = skb->data - skb->h.raw; 55 int ihl = skb->data - skb_transport_header(skb);
55 56
56 if (skb->h.raw != skb->nh.raw) 57 if (skb->transport_header != skb->network_header) {
57 skb->nh.raw = memmove(skb->h.raw, skb->nh.raw, ihl); 58 memmove(skb_transport_header(skb),
58 skb->nh.ipv6h->payload_len = htons(skb->len + ihl - 59 skb_network_header(skb), ihl);
60 skb->network_header = skb->transport_header;
61 }
62 ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
59 sizeof(struct ipv6hdr)); 63 sizeof(struct ipv6hdr));
60 skb->h.raw = skb->data; 64 skb_reset_transport_header(skb);
61 return 0; 65 return 0;
62} 66}
63 67