aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/xfrm6_mode_beet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/xfrm6_mode_beet.c')
-rw-r--r--net/ipv6/xfrm6_mode_beet.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index edcfffa9e87b..2e61d6ddece3 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -38,17 +38,18 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
38 int hdr_len; 38 int hdr_len;
39 39
40 skb_push(skb, x->props.header_len); 40 skb_push(skb, x->props.header_len);
41 iph = skb->nh.ipv6h; 41 iph = ipv6_hdr(skb);
42 42
43 hdr_len = ip6_find_1stfragopt(skb, &prevhdr); 43 hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
44 skb->nh.raw = prevhdr - x->props.header_len; 44 skb_set_network_header(skb,
45 skb->h.raw = skb->data + hdr_len; 45 (prevhdr - x->props.header_len) - skb->data);
46 skb_set_transport_header(skb, hdr_len);
46 memmove(skb->data, iph, hdr_len); 47 memmove(skb->data, iph, hdr_len);
47 48
48 skb->nh.raw = skb->data; 49 skb_reset_network_header(skb);
49 top_iph = skb->nh.ipv6h; 50 top_iph = ipv6_hdr(skb);
50 skb->nh.raw = &top_iph->nexthdr; 51 skb->transport_header = skb->network_header + sizeof(struct ipv6hdr);
51 skb->h.ipv6h = top_iph + 1; 52 skb->network_header += offsetof(struct ipv6hdr, nexthdr);
52 53
53 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); 54 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
54 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); 55 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
@@ -59,6 +60,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
59static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) 60static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
60{ 61{
61 struct ipv6hdr *ip6h; 62 struct ipv6hdr *ip6h;
63 const unsigned char *old_mac;
62 int size = sizeof(struct ipv6hdr); 64 int size = sizeof(struct ipv6hdr);
63 int err = -EINVAL; 65 int err = -EINVAL;
64 66
@@ -66,13 +68,14 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
66 goto out; 68 goto out;
67 69
68 skb_push(skb, size); 70 skb_push(skb, size);
69 memmove(skb->data, skb->nh.raw, size); 71 memmove(skb->data, skb_network_header(skb), size);
70 skb->nh.raw = skb->data; 72 skb_reset_network_header(skb);
71 73
72 skb->mac.raw = memmove(skb->data - skb->mac_len, 74 old_mac = skb_mac_header(skb);
73 skb->mac.raw, skb->mac_len); 75 skb_set_mac_header(skb, -skb->mac_len);
76 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
74 77
75 ip6h = skb->nh.ipv6h; 78 ip6h = ipv6_hdr(skb);
76 ip6h->payload_len = htons(skb->len - size); 79 ip6h->payload_len = htons(skb->len - size);
77 ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6); 80 ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6);
78 ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6); 81 ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6);