aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/skbuff.h6
-rw-r--r--net/ax25/af_ax25.c20
-rw-r--r--net/ax25/ax25_in.c2
-rw-r--r--net/ipv4/esp4.c3
-rw-r--r--net/ipv4/ip_output.c19
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv6/ah6.c2
-rw-r--r--net/ipv6/esp6.c4
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c2
-rw-r--r--net/ipv6/xfrm6_mode_beet.c2
-rw-r--r--net/ipv6/xfrm6_mode_ro.c2
-rw-r--r--net/ipv6/xfrm6_mode_transport.c2
12 files changed, 33 insertions, 33 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 64c3c1687e49..684292efa823 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -962,6 +962,12 @@ static inline void skb_reset_transport_header(struct sk_buff *skb)
962 skb->h.raw = skb->data; 962 skb->h.raw = skb->data;
963} 963}
964 964
965static inline void skb_set_transport_header(struct sk_buff *skb,
966 const int offset)
967{
968 skb->h.raw = skb->data + offset;
969}
970
965static inline int skb_transport_offset(const struct sk_buff *skb) 971static inline int skb_transport_offset(const struct sk_buff *skb)
966{ 972{
967 return skb->h.raw - skb->data; 973 return skb->h.raw - skb->data;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 14db01a4ff63..75d4d695edec 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1425,7 +1425,6 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1425 struct sockaddr_ax25 sax; 1425 struct sockaddr_ax25 sax;
1426 struct sk_buff *skb; 1426 struct sk_buff *skb;
1427 ax25_digi dtmp, *dp; 1427 ax25_digi dtmp, *dp;
1428 unsigned char *asmptr;
1429 ax25_cb *ax25; 1428 ax25_cb *ax25;
1430 size_t size; 1429 size_t size;
1431 int lv, err, addr_len = msg->msg_namelen; 1430 int lv, err, addr_len = msg->msg_namelen;
@@ -1551,10 +1550,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1551 skb_reset_network_header(skb); 1550 skb_reset_network_header(skb);
1552 1551
1553 /* Add the PID if one is not supplied by the user in the skb */ 1552 /* Add the PID if one is not supplied by the user in the skb */
1554 if (!ax25->pidincl) { 1553 if (!ax25->pidincl)
1555 asmptr = skb_push(skb, 1); 1554 *skb_push(skb, 1) = sk->sk_protocol;
1556 *asmptr = sk->sk_protocol;
1557 }
1558 1555
1559 SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n"); 1556 SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n");
1560 1557
@@ -1573,7 +1570,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1573 goto out; 1570 goto out;
1574 } 1571 }
1575 1572
1576 asmptr = skb_push(skb, 1 + ax25_addr_size(dp)); 1573 skb_push(skb, 1 + ax25_addr_size(dp));
1577 1574
1578 SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp); 1575 SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp);
1579 1576
@@ -1581,17 +1578,16 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1581 SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi); 1578 SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi);
1582 1579
1583 /* Build an AX.25 header */ 1580 /* Build an AX.25 header */
1584 asmptr += (lv = ax25_addr_build(asmptr, &ax25->source_addr, 1581 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call,
1585 &sax.sax25_call, dp, 1582 dp, AX25_COMMAND, AX25_MODULUS);
1586 AX25_COMMAND, AX25_MODULUS));
1587 1583
1588 SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv); 1584 SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv);
1589 1585
1590 skb->h.raw = asmptr; 1586 skb_set_transport_header(skb, lv);
1591 1587
1592 SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, asmptr); 1588 SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, skb->h.raw);
1593 1589
1594 *asmptr = AX25_UI; 1590 *skb->h.raw = AX25_UI;
1595 1591
1596 /* Datagram frames go straight out of the door as UI */ 1592 /* Datagram frames go straight out of the door as UI */
1597 ax25_queue_xmit(skb, ax25->ax25_dev->dev); 1593 ax25_queue_xmit(skb, ax25->ax25_dev->dev);
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 724ad5ce75d4..31c59387a6fc 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -233,7 +233,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
233 233
234 /* UI frame - bypass LAPB processing */ 234 /* UI frame - bypass LAPB processing */
235 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) { 235 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) {
236 skb->h.raw = skb->data + 2; /* skip control and pid */ 236 skb_set_transport_header(skb, 2); /* skip control and pid */
237 237
238 ax25_send_to_raw(&dest, skb, skb->data[1]); 238 ax25_send_to_raw(&dest, skb, skb->data[1]);
239 239
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 957674562801..82543eebfa52 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -261,7 +261,8 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
261 261
262 iph->protocol = nexthdr[1]; 262 iph->protocol = nexthdr[1];
263 pskb_trim(skb, skb->len - alen - padlen - 2); 263 pskb_trim(skb, skb->len - alen - padlen - 2);
264 skb->h.raw = __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen) - ihl; 264 __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen);
265 skb_set_transport_header(skb, -ihl);
265 266
266 return 0; 267 return 0;
267 268
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 63c05be0764d..6d92358fc513 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -593,7 +593,7 @@ slow_path:
593 skb_reserve(skb2, ll_rs); 593 skb_reserve(skb2, ll_rs);
594 skb_put(skb2, len + hlen); 594 skb_put(skb2, len + hlen);
595 skb_reset_network_header(skb2); 595 skb_reset_network_header(skb2);
596 skb2->h.raw = skb2->data + hlen; 596 skb2->h.raw = skb2->nh.raw + hlen;
597 597
598 /* 598 /*
599 * Charge the memory for the fragment to any owner 599 * Charge the memory for the fragment to any owner
@@ -724,7 +724,7 @@ static inline int ip_ufo_append_data(struct sock *sk,
724 skb_reset_network_header(skb); 724 skb_reset_network_header(skb);
725 725
726 /* initialize protocol header pointer */ 726 /* initialize protocol header pointer */
727 skb->h.raw = skb->data + fragheaderlen; 727 skb->h.raw = skb->nh.raw + fragheaderlen;
728 728
729 skb->ip_summed = CHECKSUM_PARTIAL; 729 skb->ip_summed = CHECKSUM_PARTIAL;
730 skb->csum = 0; 730 skb->csum = 0;
@@ -1099,8 +1099,6 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
1099 } 1099 }
1100 if (len <= 0) { 1100 if (len <= 0) {
1101 struct sk_buff *skb_prev; 1101 struct sk_buff *skb_prev;
1102 char *data;
1103 struct iphdr *iph;
1104 int alloclen; 1102 int alloclen;
1105 1103
1106 skb_prev = skb; 1104 skb_prev = skb;
@@ -1123,16 +1121,15 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
1123 /* 1121 /*
1124 * Find where to start putting bytes. 1122 * Find where to start putting bytes.
1125 */ 1123 */
1126 data = skb_put(skb, fragheaderlen + fraggap); 1124 skb_put(skb, fragheaderlen + fraggap);
1127 skb_reset_network_header(skb); 1125 skb_reset_network_header(skb);
1128 iph = ip_hdr(skb); 1126 skb->h.raw = skb->nh.raw + fragheaderlen;
1129 data += fragheaderlen;
1130 skb->h.raw = data;
1131 1127
1132 if (fraggap) { 1128 if (fraggap) {
1133 skb->csum = skb_copy_and_csum_bits( 1129 skb->csum = skb_copy_and_csum_bits(skb_prev,
1134 skb_prev, maxfraglen, 1130 maxfraglen,
1135 data, fraggap, 0); 1131 skb->h.raw,
1132 fraggap, 0);
1136 skb_prev->csum = csum_sub(skb_prev->csum, 1133 skb_prev->csum = csum_sub(skb_prev->csum,
1137 skb->csum); 1134 skb->csum);
1138 pskb_trim_unique(skb_prev, maxfraglen); 1135 pskb_trim_unique(skb_prev, maxfraglen);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 5da823a32250..2776a8b01339 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3636,7 +3636,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,
3636 skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); 3636 skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head);
3637 skb_set_network_header(nskb, 3637 skb_set_network_header(nskb,
3638 skb_network_header(skb) - skb->head); 3638 skb_network_header(skb) - skb->head);
3639 nskb->h.raw = nskb->data + (skb->h.raw - skb->head); 3639 skb_set_transport_header(nskb, skb->h.raw - skb->head);
3640 3640
3641 skb_reserve(nskb, header); 3641 skb_reserve(nskb, header);
3642 memcpy(nskb->head, skb->head, header); 3642 memcpy(nskb->head, skb->head, header);
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index b682d2368c2a..e5ee981d3e10 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -247,7 +247,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
247 memcpy(tmp_base, top_iph, sizeof(tmp_base)); 247 memcpy(tmp_base, top_iph, sizeof(tmp_base));
248 248
249 tmp_ext = NULL; 249 tmp_ext = NULL;
250 extlen = skb->h.raw - (unsigned char *)(top_iph + 1); 250 extlen = skb_transport_offset(skb) + sizeof(struct ipv6hdr);
251 if (extlen) { 251 if (extlen) {
252 extlen += sizeof(*tmp_ext); 252 extlen += sizeof(*tmp_ext);
253 tmp_ext = kmalloc(extlen, GFP_ATOMIC); 253 tmp_ext = kmalloc(extlen, GFP_ATOMIC);
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 35905867ded1..ad522b7b5771 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -228,8 +228,8 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
228 ret = nexthdr[1]; 228 ret = nexthdr[1];
229 } 229 }
230 230
231 skb->h.raw = __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen) - hdr_len; 231 __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen);
232 232 skb_set_transport_header(skb, -hdr_len);
233out: 233out:
234 return ret; 234 return ret;
235} 235}
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 75138cf1fa61..015950522c8b 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -785,7 +785,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
785 goto ret_orig; 785 goto ret_orig;
786 } 786 }
787 787
788 clone->h.raw = clone->data + fhoff; 788 skb_set_transport_header(clone, fhoff);
789 hdr = ipv6_hdr(clone); 789 hdr = ipv6_hdr(clone);
790 fhdr = (struct frag_hdr *)clone->h.raw; 790 fhdr = (struct frag_hdr *)clone->h.raw;
791 791
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index b5a48c255f07..abac09409ded 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -42,7 +42,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *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->nh.raw = prevhdr - x->props.header_len;
45 skb->h.raw = skb->data + hdr_len; 45 skb_set_transport_header(skb, hdr_len);
46 memmove(skb->data, iph, hdr_len); 46 memmove(skb->data, iph, hdr_len);
47 47
48 skb_reset_network_header(skb); 48 skb_reset_network_header(skb);
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c
index d01958d921ac..da48ecf3fe96 100644
--- a/net/ipv6/xfrm6_mode_ro.c
+++ b/net/ipv6/xfrm6_mode_ro.c
@@ -54,7 +54,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
54 54
55 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 55 hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
56 skb->nh.raw = prevhdr - x->props.header_len; 56 skb->nh.raw = prevhdr - x->props.header_len;
57 skb->h.raw = skb->data + hdr_len; 57 skb_set_transport_header(skb, hdr_len);
58 memmove(skb->data, iph, hdr_len); 58 memmove(skb->data, iph, hdr_len);
59 return 0; 59 return 0;
60} 60}
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c
index cae6cacd58c4..0134d74ef087 100644
--- a/net/ipv6/xfrm6_mode_transport.c
+++ b/net/ipv6/xfrm6_mode_transport.c
@@ -36,7 +36,7 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *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->nh.raw = prevhdr - x->props.header_len;
39 skb->h.raw = skb->data + hdr_len; 39 skb_set_transport_header(skb, hdr_len);
40 memmove(skb->data, iph, hdr_len); 40 memmove(skb->data, iph, hdr_len);
41 return 0; 41 return 0;
42} 42}