diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ah6.c | 1 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 9 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 5 | ||||
-rw-r--r-- | net/ipv6/mip6.c | 2 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_beet.c | 13 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_ro.c | 12 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_transport.c | 12 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_tunnel.c | 13 | ||||
-rw-r--r-- | net/ipv6/xfrm6_tunnel.c | 1 |
9 files changed, 36 insertions, 32 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index c51d77564b44..ac6bae17a13b 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -236,6 +236,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
236 | char hdrs[0]; | 236 | char hdrs[0]; |
237 | } *tmp_ext; | 237 | } *tmp_ext; |
238 | 238 | ||
239 | skb_push(skb, -skb_network_offset(skb)); | ||
239 | top_iph = ipv6_hdr(skb); | 240 | top_iph = ipv6_hdr(skb); |
240 | top_iph->payload_len = htons(skb->len - sizeof(*top_iph)); | 241 | top_iph->payload_len = htons(skb->len - sizeof(*top_iph)); |
241 | 242 | ||
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 7355bb0345e2..21c93f026dbc 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -54,13 +54,8 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
54 | int nfrags; | 54 | int nfrags; |
55 | u8 *tail; | 55 | u8 *tail; |
56 | struct esp_data *esp = x->data; | 56 | struct esp_data *esp = x->data; |
57 | int hdr_len = (skb_transport_offset(skb) + | ||
58 | sizeof(*esph) + esp->conf.ivlen); | ||
59 | 57 | ||
60 | /* Strip IP+ESP header. */ | 58 | /* skb is pure payload to encrypt */ |
61 | __skb_pull(skb, hdr_len); | ||
62 | |||
63 | /* Now skb is pure payload to encrypt */ | ||
64 | err = -ENOMEM; | 59 | err = -ENOMEM; |
65 | 60 | ||
66 | /* Round to block size */ | 61 | /* Round to block size */ |
@@ -89,7 +84,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
89 | tail[clen-skb->len - 2] = (clen - skb->len) - 2; | 84 | tail[clen-skb->len - 2] = (clen - skb->len) - 2; |
90 | pskb_put(skb, trailer, clen - skb->len); | 85 | pskb_put(skb, trailer, clen - skb->len); |
91 | 86 | ||
92 | __skb_push(skb, -skb_network_offset(skb)); | 87 | skb_push(skb, -skb_network_offset(skb)); |
93 | top_iph = ipv6_hdr(skb); | 88 | top_iph = ipv6_hdr(skb); |
94 | esph = (struct ipv6_esp_hdr *)skb_transport_header(skb); | 89 | esph = (struct ipv6_esp_hdr *)skb_transport_header(skb); |
95 | top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph)); | 90 | top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph)); |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 71a14c09975c..87e6407ebf97 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -128,7 +128,10 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
128 | u8 *start, *scratch; | 128 | u8 *start, *scratch; |
129 | struct crypto_comp *tfm; | 129 | struct crypto_comp *tfm; |
130 | int cpu; | 130 | int cpu; |
131 | int hdr_len = skb_transport_offset(skb); | 131 | int hdr_len; |
132 | |||
133 | skb_push(skb, -skb_network_offset(skb)); | ||
134 | hdr_len = skb_transport_offset(skb); | ||
132 | 135 | ||
133 | /* check whether datagram len is larger than threshold */ | 136 | /* check whether datagram len is larger than threshold */ |
134 | if ((skb->len - hdr_len) < ipcd->threshold) { | 137 | if ((skb->len - hdr_len) < ipcd->threshold) { |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index 6475baca63d2..0e7a60f7393a 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -153,6 +153,7 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb) | |||
153 | u8 nexthdr; | 153 | u8 nexthdr; |
154 | int len; | 154 | int len; |
155 | 155 | ||
156 | skb_push(skb, -skb_network_offset(skb)); | ||
156 | iph = ipv6_hdr(skb); | 157 | iph = ipv6_hdr(skb); |
157 | iph->payload_len = htons(skb->len - sizeof(*iph)); | 158 | iph->payload_len = htons(skb->len - sizeof(*iph)); |
158 | 159 | ||
@@ -367,6 +368,7 @@ static int mip6_rthdr_output(struct xfrm_state *x, struct sk_buff *skb) | |||
367 | struct rt2_hdr *rt2; | 368 | struct rt2_hdr *rt2; |
368 | u8 nexthdr; | 369 | u8 nexthdr; |
369 | 370 | ||
371 | skb_push(skb, -skb_network_offset(skb)); | ||
370 | iph = ipv6_hdr(skb); | 372 | iph = ipv6_hdr(skb); |
371 | iph->payload_len = htons(skb->len - sizeof(*iph)); | 373 | iph->payload_len = htons(skb->len - sizeof(*iph)); |
372 | 374 | ||
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c index d9366dfbf868..bca018d19ec6 100644 --- a/net/ipv6/xfrm6_mode_beet.c +++ b/net/ipv6/xfrm6_mode_beet.c | |||
@@ -29,8 +29,8 @@ | |||
29 | * filled in by x->type->output and the mac header will be set to the | 29 | * filled in by x->type->output and the mac header will be set to the |
30 | * nextheader field of the extension header directly preceding the | 30 | * nextheader field of the extension header directly preceding the |
31 | * encapsulation header, or in its absence, that of the top IP header. | 31 | * encapsulation header, or in its absence, that of the top IP header. |
32 | * The value of skb->data and the network header will always point to the | 32 | * The value of the network header will always point to the top IP header |
33 | * top IP header. | 33 | * while skb->data will point to the payload. |
34 | */ | 34 | */ |
35 | static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) | 35 | static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) |
36 | { | 36 | { |
@@ -38,16 +38,17 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
38 | u8 *prevhdr; | 38 | u8 *prevhdr; |
39 | int hdr_len; | 39 | int hdr_len; |
40 | 40 | ||
41 | skb_push(skb, x->props.header_len); | ||
42 | iph = ipv6_hdr(skb); | 41 | iph = ipv6_hdr(skb); |
43 | 42 | ||
44 | hdr_len = ip6_find_1stfragopt(skb, &prevhdr); | 43 | hdr_len = ip6_find_1stfragopt(skb, &prevhdr); |
45 | memmove(skb->data, iph, hdr_len); | ||
46 | 44 | ||
47 | skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); | 45 | skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); |
48 | skb_reset_network_header(skb); | 46 | skb_set_network_header(skb, -x->props.header_len); |
49 | skb_set_transport_header(skb, hdr_len); | 47 | skb_set_transport_header(skb, hdr_len - x->props.header_len); |
48 | __skb_pull(skb, hdr_len); | ||
49 | |||
50 | top_iph = ipv6_hdr(skb); | 50 | top_iph = ipv6_hdr(skb); |
51 | memmove(top_iph, iph, hdr_len); | ||
51 | 52 | ||
52 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); | 53 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); |
53 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); | 54 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); |
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c index 25758048af54..5c29b367b432 100644 --- a/net/ipv6/xfrm6_mode_ro.c +++ b/net/ipv6/xfrm6_mode_ro.c | |||
@@ -42,8 +42,8 @@ | |||
42 | * filled in by x->type->output and the mac header will be set to the | 42 | * filled in by x->type->output and the mac header will be set to the |
43 | * nextheader field of the extension header directly preceding the | 43 | * nextheader field of the extension header directly preceding the |
44 | * encapsulation header, or in its absence, that of the top IP header. | 44 | * encapsulation header, or in its absence, that of the top IP header. |
45 | * The value of skb->data and the network header will always point to the | 45 | * The value of the network header will always point to the top IP header |
46 | * top IP header. | 46 | * while skb->data will point to the payload. |
47 | */ | 47 | */ |
48 | static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb) | 48 | static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb) |
49 | { | 49 | { |
@@ -51,14 +51,14 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb) | |||
51 | u8 *prevhdr; | 51 | u8 *prevhdr; |
52 | int hdr_len; | 52 | int hdr_len; |
53 | 53 | ||
54 | skb_push(skb, x->props.header_len); | ||
55 | iph = ipv6_hdr(skb); | 54 | iph = ipv6_hdr(skb); |
56 | 55 | ||
57 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); | 56 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); |
58 | skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); | 57 | skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); |
59 | skb_reset_network_header(skb); | 58 | skb_set_network_header(skb, -x->props.header_len); |
60 | skb_set_transport_header(skb, hdr_len); | 59 | skb_set_transport_header(skb, hdr_len - x->props.header_len); |
61 | memmove(skb->data, iph, hdr_len); | 60 | __skb_pull(skb, hdr_len); |
61 | memmove(ipv6_hdr(skb), iph, hdr_len); | ||
62 | 62 | ||
63 | x->lastused = get_seconds(); | 63 | x->lastused = get_seconds(); |
64 | 64 | ||
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c index 65c166b5d72c..f2ee186494ed 100644 --- a/net/ipv6/xfrm6_mode_transport.c +++ b/net/ipv6/xfrm6_mode_transport.c | |||
@@ -23,8 +23,8 @@ | |||
23 | * filled in by x->type->output and the mac header will be set to the | 23 | * filled in by x->type->output and the mac header will be set to the |
24 | * nextheader field of the extension header directly preceding the | 24 | * nextheader field of the extension header directly preceding the |
25 | * encapsulation header, or in its absence, that of the top IP header. | 25 | * encapsulation header, or in its absence, that of the top IP header. |
26 | * The value of skb->data and the network header will always point to the | 26 | * The value of the network header will always point to the top IP header |
27 | * top IP header. | 27 | * while skb->data will point to the payload. |
28 | */ | 28 | */ |
29 | static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) | 29 | static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) |
30 | { | 30 | { |
@@ -32,14 +32,14 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) | |||
32 | u8 *prevhdr; | 32 | u8 *prevhdr; |
33 | int hdr_len; | 33 | int hdr_len; |
34 | 34 | ||
35 | skb_push(skb, x->props.header_len); | ||
36 | iph = ipv6_hdr(skb); | 35 | iph = ipv6_hdr(skb); |
37 | 36 | ||
38 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); | 37 | hdr_len = x->type->hdr_offset(x, skb, &prevhdr); |
39 | skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); | 38 | skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); |
40 | skb_reset_network_header(skb); | 39 | skb_set_network_header(skb, -x->props.header_len); |
41 | skb_set_transport_header(skb, hdr_len); | 40 | skb_set_transport_header(skb, hdr_len - x->props.header_len); |
42 | memmove(skb->data, iph, hdr_len); | 41 | __skb_pull(skb, hdr_len); |
42 | memmove(ipv6_hdr(skb), iph, hdr_len); | ||
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index 3dd40af75e81..01bd7d11ea1b 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -41,8 +41,8 @@ static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb) | |||
41 | * filled in by x->type->output and the mac header will be set to the | 41 | * filled in by x->type->output and the mac header will be set to the |
42 | * nextheader field of the extension header directly preceding the | 42 | * nextheader field of the extension header directly preceding the |
43 | * encapsulation header, or in its absence, that of the top IP header. | 43 | * encapsulation header, or in its absence, that of the top IP header. |
44 | * The value of skb->data and the network header will always point to the | 44 | * The value of the network header will always point to the top IP header |
45 | * top IP header. | 45 | * while skb->data will point to the payload. |
46 | */ | 46 | */ |
47 | static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | 47 | static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) |
48 | { | 48 | { |
@@ -51,12 +51,13 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
51 | struct ipv6hdr *iph, *top_iph; | 51 | struct ipv6hdr *iph, *top_iph; |
52 | int dsfield; | 52 | int dsfield; |
53 | 53 | ||
54 | skb_push(skb, x->props.header_len); | ||
55 | iph = ipv6_hdr(skb); | 54 | iph = ipv6_hdr(skb); |
56 | 55 | ||
57 | skb_set_mac_header(skb, offsetof(struct ipv6hdr, nexthdr)); | 56 | skb_set_mac_header(skb, offsetof(struct ipv6hdr, nexthdr) - |
58 | skb_reset_network_header(skb); | 57 | x->props.header_len); |
59 | skb_set_transport_header(skb, sizeof(struct ipv6hdr)); | 58 | skb_set_network_header(skb, -x->props.header_len); |
59 | skb_set_transport_header(skb, sizeof(struct ipv6hdr) - | ||
60 | x->props.header_len); | ||
60 | top_iph = ipv6_hdr(skb); | 61 | top_iph = ipv6_hdr(skb); |
61 | 62 | ||
62 | top_iph->version = 6; | 63 | top_iph->version = 6; |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index aeb06076fdd0..00a1a3e5237c 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -244,6 +244,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
244 | { | 244 | { |
245 | struct ipv6hdr *top_iph; | 245 | struct ipv6hdr *top_iph; |
246 | 246 | ||
247 | skb_push(skb, -skb_network_offset(skb)); | ||
247 | top_iph = ipv6_hdr(skb); | 248 | top_iph = ipv6_hdr(skb); |
248 | top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); | 249 | top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); |
249 | 250 | ||