aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/ah4.c1
-rw-r--r--net/ipv4/esp4.c6
-rw-r--r--net/ipv4/ipcomp.c1
-rw-r--r--net/ipv4/xfrm4_mode_beet.c5
-rw-r--r--net/ipv4/xfrm4_mode_transport.c4
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c3
-rw-r--r--net/ipv4/xfrm4_tunnel.c1
-rw-r--r--net/ipv6/ah6.c1
-rw-r--r--net/ipv6/esp6.c9
-rw-r--r--net/ipv6/ipcomp6.c5
-rw-r--r--net/ipv6/mip6.c2
-rw-r--r--net/ipv6/xfrm6_mode_beet.c13
-rw-r--r--net/ipv6/xfrm6_mode_ro.c12
-rw-r--r--net/ipv6/xfrm6_mode_transport.c12
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c13
-rw-r--r--net/ipv6/xfrm6_tunnel.c1
16 files changed, 47 insertions, 42 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 3513149c3843..dbb1f11721e4 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -66,6 +66,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
66 char buf[60]; 66 char buf[60];
67 } tmp_iph; 67 } tmp_iph;
68 68
69 skb_push(skb, -skb_network_offset(skb));
69 top_iph = ip_hdr(skb); 70 top_iph = ip_hdr(skb);
70 iph = &tmp_iph.iph; 71 iph = &tmp_iph.iph;
71 72
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 1af332df72d9..0f5e8387ccb4 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -28,9 +28,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
28 int alen; 28 int alen;
29 int nfrags; 29 int nfrags;
30 30
31 /* Strip IP+ESP header. */ 31 /* skb is pure payload to encrypt */
32 __skb_pull(skb, skb_transport_offset(skb));
33 /* Now skb is pure payload to encrypt */
34 32
35 err = -ENOMEM; 33 err = -ENOMEM;
36 34
@@ -60,7 +58,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
60 tail[clen - skb->len - 2] = (clen - skb->len) - 2; 58 tail[clen - skb->len - 2] = (clen - skb->len) - 2;
61 pskb_put(skb, trailer, clen - skb->len); 59 pskb_put(skb, trailer, clen - skb->len);
62 60
63 __skb_push(skb, -skb_network_offset(skb)); 61 skb_push(skb, -skb_network_offset(skb));
64 top_iph = ip_hdr(skb); 62 top_iph = ip_hdr(skb);
65 esph = (struct ip_esp_hdr *)(skb_network_header(skb) + 63 esph = (struct ip_esp_hdr *)(skb_network_header(skb) +
66 top_iph->ihl * 4); 64 top_iph->ihl * 4);
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index e787044a8514..1929d451dab5 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -134,6 +134,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
134 int hdr_len = 0; 134 int hdr_len = 0;
135 struct iphdr *iph = ip_hdr(skb); 135 struct iphdr *iph = ip_hdr(skb);
136 136
137 skb_push(skb, -skb_network_offset(skb));
137 iph->tot_len = htons(skb->len); 138 iph->tot_len = htons(skb->len);
138 hdr_len = iph->ihl * 4; 139 hdr_len = iph->ihl * 4;
139 if ((skb->len - hdr_len) < ipcd->threshold) { 140 if ((skb->len - hdr_len) < ipcd->threshold) {
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index a73e710740c2..77888f596737 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -40,10 +40,11 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
40 if (unlikely(optlen)) 40 if (unlikely(optlen))
41 hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); 41 hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4);
42 42
43 skb_push(skb, x->props.header_len - IPV4_BEET_PHMAXLEN + hdrlen); 43 skb_set_network_header(skb, IPV4_BEET_PHMAXLEN - x->props.header_len -
44 skb_reset_network_header(skb); 44 hdrlen);
45 top_iph = ip_hdr(skb); 45 top_iph = ip_hdr(skb);
46 skb->transport_header += sizeof(*iph) - hdrlen; 46 skb->transport_header += sizeof(*iph) - hdrlen;
47 __skb_pull(skb, sizeof(*iph) - hdrlen);
47 48
48 memmove(top_iph, iph, sizeof(*iph)); 49 memmove(top_iph, iph, sizeof(*iph));
49 if (unlikely(optlen)) { 50 if (unlikely(optlen)) {
diff --git a/net/ipv4/xfrm4_mode_transport.c b/net/ipv4/xfrm4_mode_transport.c
index 601047161ea6..10499d2ec65e 100644
--- a/net/ipv4/xfrm4_mode_transport.c
+++ b/net/ipv4/xfrm4_mode_transport.c
@@ -27,8 +27,8 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
27 int ihl = iph->ihl * 4; 27 int ihl = iph->ihl * 4;
28 28
29 skb->transport_header = skb->network_header + ihl; 29 skb->transport_header = skb->network_header + ihl;
30 skb_push(skb, x->props.header_len); 30 skb_set_network_header(skb, -x->props.header_len);
31 skb_reset_network_header(skb); 31 __skb_pull(skb, ihl);
32 memmove(skb_network_header(skb), iph, ihl); 32 memmove(skb_network_header(skb), iph, ihl);
33 return 0; 33 return 0;
34} 34}
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 9963700e74c1..bac1a91f0cbe 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -49,8 +49,7 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
49 iph = ip_hdr(skb); 49 iph = ip_hdr(skb);
50 skb->transport_header = skb->network_header; 50 skb->transport_header = skb->network_header;
51 51
52 skb_push(skb, x->props.header_len); 52 skb_set_network_header(skb, -x->props.header_len);
53 skb_reset_network_header(skb);
54 top_iph = ip_hdr(skb); 53 top_iph = ip_hdr(skb);
55 54
56 top_iph->ihl = 5; 55 top_iph->ihl = 5;
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 9275c79119b6..be572f918b5e 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -14,6 +14,7 @@ static int ipip_output(struct xfrm_state *x, struct sk_buff *skb)
14{ 14{
15 struct iphdr *iph = ip_hdr(skb); 15 struct iphdr *iph = ip_hdr(skb);
16 16
17 skb_push(skb, -skb_network_offset(skb));
17 iph->tot_len = htons(skb->len); 18 iph->tot_len = htons(skb->len);
18 ip_send_check(iph); 19 ip_send_check(iph);
19 20
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 */
35static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) 35static 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 */
48static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb) 48static 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 */
29static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) 29static 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 */
47static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) 47static 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