aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/esp4.c8
-rw-r--r--net/ipv4/icmp.c3
-rw-r--r--net/ipv4/igmp.c4
-rw-r--r--net/ipv4/inet_diag.c12
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipmr.c9
-rw-r--r--net/ipv4/ipvs/ip_vs_ftp.c4
-rw-r--r--net/ipv4/netfilter/arpt_mangle.c8
-rw-r--r--net/ipv4/netfilter/ip_queue.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_helper.c3
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_output.c2
12 files changed, 33 insertions, 28 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index de019f9fbfe1..5e5613930ffb 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -21,6 +21,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
21 struct blkcipher_desc desc; 21 struct blkcipher_desc desc;
22 struct esp_data *esp; 22 struct esp_data *esp;
23 struct sk_buff *trailer; 23 struct sk_buff *trailer;
24 u8 *tail;
24 int blksize; 25 int blksize;
25 int clen; 26 int clen;
26 int alen; 27 int alen;
@@ -49,12 +50,13 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
49 goto error; 50 goto error;
50 51
51 /* Fill padding... */ 52 /* Fill padding... */
53 tail = skb_tail_pointer(trailer);
52 do { 54 do {
53 int i; 55 int i;
54 for (i=0; i<clen-skb->len - 2; i++) 56 for (i=0; i<clen-skb->len - 2; i++)
55 *(u8*)(trailer->tail + i) = i+1; 57 tail[i] = i + 1;
56 } while (0); 58 } while (0);
57 *(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; 59 tail[clen - skb->len - 2] = (clen - skb->len) - 2;
58 pskb_put(skb, trailer, clen - skb->len); 60 pskb_put(skb, trailer, clen - skb->len);
59 61
60 __skb_push(skb, skb->data - skb_network_header(skb)); 62 __skb_push(skb, skb->data - skb_network_header(skb));
@@ -62,7 +64,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
62 esph = (struct ip_esp_hdr *)(skb_network_header(skb) + 64 esph = (struct ip_esp_hdr *)(skb_network_header(skb) +
63 top_iph->ihl * 4); 65 top_iph->ihl * 4);
64 top_iph->tot_len = htons(skb->len + alen); 66 top_iph->tot_len = htons(skb->len + alen);
65 *(u8*)(trailer->tail - 1) = top_iph->protocol; 67 *(skb_tail_pointer(skb) - 1) = top_iph->protocol;
66 68
67 /* this is non-NULL only with UDP Encapsulation */ 69 /* this is non-NULL only with UDP Encapsulation */
68 if (x->encap) { 70 if (x->encap) {
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 8372f8b8f0cd..d38cbba92a4d 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -450,7 +450,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
450 */ 450 */
451 iph = ip_hdr(skb_in); 451 iph = ip_hdr(skb_in);
452 452
453 if ((u8 *)iph < skb_in->head || (u8 *)(iph + 1) > skb_in->tail) 453 if ((u8 *)iph < skb_in->head ||
454 (skb_in->network_header + sizeof(*iph)) > skb_in->tail)
454 goto out; 455 goto out;
455 456
456 /* 457 /*
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 1fc637fb6750..2506021c2935 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -348,8 +348,8 @@ static int igmpv3_sendpack(struct sk_buff *skb)
348{ 348{
349 struct iphdr *pip = ip_hdr(skb); 349 struct iphdr *pip = ip_hdr(skb);
350 struct igmphdr *pig = igmp_hdr(skb); 350 struct igmphdr *pig = igmp_hdr(skb);
351 const int iplen = skb->tail - skb_network_header(skb); 351 const int iplen = skb->tail - skb->network_header;
352 const int igmplen = skb->tail - skb_transport_header(skb); 352 const int igmplen = skb->tail - skb->transport_header;
353 353
354 pip->tot_len = htons(iplen); 354 pip->tot_len = htons(iplen);
355 ip_send_check(pip); 355 ip_send_check(pip);
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 5df71cd08da8..37362cd1d07f 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -60,7 +60,7 @@ static int inet_csk_diag_fill(struct sock *sk,
60 struct nlmsghdr *nlh; 60 struct nlmsghdr *nlh;
61 void *info = NULL; 61 void *info = NULL;
62 struct inet_diag_meminfo *minfo = NULL; 62 struct inet_diag_meminfo *minfo = NULL;
63 unsigned char *b = skb->tail; 63 unsigned char *b = skb_tail_pointer(skb);
64 const struct inet_diag_handler *handler; 64 const struct inet_diag_handler *handler;
65 65
66 handler = inet_diag_table[unlh->nlmsg_type]; 66 handler = inet_diag_table[unlh->nlmsg_type];
@@ -147,7 +147,7 @@ static int inet_csk_diag_fill(struct sock *sk,
147 icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) 147 icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info)
148 icsk->icsk_ca_ops->get_info(sk, ext, skb); 148 icsk->icsk_ca_ops->get_info(sk, ext, skb);
149 149
150 nlh->nlmsg_len = skb->tail - b; 150 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
151 return skb->len; 151 return skb->len;
152 152
153rtattr_failure: 153rtattr_failure:
@@ -163,7 +163,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
163{ 163{
164 long tmo; 164 long tmo;
165 struct inet_diag_msg *r; 165 struct inet_diag_msg *r;
166 const unsigned char *previous_tail = skb->tail; 166 const unsigned char *previous_tail = skb_tail_pointer(skb);
167 struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq, 167 struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq,
168 unlh->nlmsg_type, sizeof(*r)); 168 unlh->nlmsg_type, sizeof(*r));
169 169
@@ -205,7 +205,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
205 &tw6->tw_v6_daddr); 205 &tw6->tw_v6_daddr);
206 } 206 }
207#endif 207#endif
208 nlh->nlmsg_len = skb->tail - previous_tail; 208 nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail;
209 return skb->len; 209 return skb->len;
210nlmsg_failure: 210nlmsg_failure:
211 skb_trim(skb, previous_tail - skb->data); 211 skb_trim(skb, previous_tail - skb->data);
@@ -535,7 +535,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
535{ 535{
536 const struct inet_request_sock *ireq = inet_rsk(req); 536 const struct inet_request_sock *ireq = inet_rsk(req);
537 struct inet_sock *inet = inet_sk(sk); 537 struct inet_sock *inet = inet_sk(sk);
538 unsigned char *b = skb->tail; 538 unsigned char *b = skb_tail_pointer(skb);
539 struct inet_diag_msg *r; 539 struct inet_diag_msg *r;
540 struct nlmsghdr *nlh; 540 struct nlmsghdr *nlh;
541 long tmo; 541 long tmo;
@@ -574,7 +574,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
574 &inet6_rsk(req)->rmt_addr); 574 &inet6_rsk(req)->rmt_addr);
575 } 575 }
576#endif 576#endif
577 nlh->nlmsg_len = skb->tail - b; 577 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
578 578
579 return skb->len; 579 return skb->len;
580 580
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index fcb35cd5ccfd..c199d2311731 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -316,7 +316,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
316 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); 316 serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
317 serr->port = port; 317 serr->port = port;
318 318
319 __skb_pull(skb, skb->tail - skb->data); 319 __skb_pull(skb, skb_tail_pointer(skb) - skb->data);
320 skb_reset_transport_header(skb); 320 skb_reset_transport_header(skb);
321 321
322 if (sock_queue_err_skb(sk, skb)) 322 if (sock_queue_err_skb(sk, skb))
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 50d0b301380e..ea0a491dce92 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -513,7 +513,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
513 struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); 513 struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
514 514
515 if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { 515 if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) {
516 nlh->nlmsg_len = skb->tail - (u8*)nlh; 516 nlh->nlmsg_len = (skb_tail_pointer(skb) -
517 (u8 *)nlh);
517 } else { 518 } else {
518 nlh->nlmsg_type = NLMSG_ERROR; 519 nlh->nlmsg_type = NLMSG_ERROR;
519 nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); 520 nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr));
@@ -580,7 +581,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
580 * Copy the IP header 581 * Copy the IP header
581 */ 582 */
582 583
583 skb_set_network_header(skb, skb->tail - skb->data); 584 skb->network_header = skb->tail;
584 skb_put(skb, ihl); 585 skb_put(skb, ihl);
585 memcpy(skb->data,pkt->data,ihl); 586 memcpy(skb->data,pkt->data,ihl);
586 ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ 587 ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */
@@ -1544,7 +1545,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
1544 int ct; 1545 int ct;
1545 struct rtnexthop *nhp; 1546 struct rtnexthop *nhp;
1546 struct net_device *dev = vif_table[c->mfc_parent].dev; 1547 struct net_device *dev = vif_table[c->mfc_parent].dev;
1547 u8 *b = skb->tail; 1548 u8 *b = skb_tail_pointer(skb);
1548 struct rtattr *mp_head; 1549 struct rtattr *mp_head;
1549 1550
1550 if (dev) 1551 if (dev)
@@ -1564,7 +1565,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
1564 } 1565 }
1565 } 1566 }
1566 mp_head->rta_type = RTA_MULTIPATH; 1567 mp_head->rta_type = RTA_MULTIPATH;
1567 mp_head->rta_len = skb->tail - (u8*)mp_head; 1568 mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head;
1568 rtm->rtm_type = RTN_MULTICAST; 1569 rtm->rtm_type = RTN_MULTICAST;
1569 return 1; 1570 return 1;
1570 1571
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c
index 25bd68967305..344ddbbdc756 100644
--- a/net/ipv4/ipvs/ip_vs_ftp.c
+++ b/net/ipv4/ipvs/ip_vs_ftp.c
@@ -162,7 +162,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
162 iph = ip_hdr(*pskb); 162 iph = ip_hdr(*pskb);
163 th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); 163 th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]);
164 data = (char *)th + (th->doff << 2); 164 data = (char *)th + (th->doff << 2);
165 data_limit = (*pskb)->tail; 165 data_limit = skb_tail_pointer(*pskb);
166 166
167 if (ip_vs_ftp_get_addrport(data, data_limit, 167 if (ip_vs_ftp_get_addrport(data, data_limit,
168 SERVER_STRING, 168 SERVER_STRING,
@@ -269,7 +269,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
269 the length of the header in 32-bit multiples, it is accurate 269 the length of the header in 32-bit multiples, it is accurate
270 to calculate data address by th+HLEN*4 */ 270 to calculate data address by th+HLEN*4 */
271 data = data_start = (char *)th + (th->doff << 2); 271 data = data_start = (char *)th + (th->doff << 2);
272 data_limit = (*pskb)->tail; 272 data_limit = skb_tail_pointer(*pskb);
273 273
274 while (data <= data_limit - 6) { 274 while (data <= data_limit - 6) {
275 if (strnicmp(data, "PASV\r\n", 6) == 0) { 275 if (strnicmp(data, "PASV\r\n", 6) == 0) {
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c
index b4450f1ccc1b..6298d404e7c7 100644
--- a/net/ipv4/netfilter/arpt_mangle.c
+++ b/net/ipv4/netfilter/arpt_mangle.c
@@ -37,28 +37,28 @@ target(struct sk_buff **pskb,
37 /* We assume that pln and hln were checked in the match */ 37 /* We assume that pln and hln were checked in the match */
38 if (mangle->flags & ARPT_MANGLE_SDEV) { 38 if (mangle->flags & ARPT_MANGLE_SDEV) {
39 if (ARPT_DEV_ADDR_LEN_MAX < hln || 39 if (ARPT_DEV_ADDR_LEN_MAX < hln ||
40 (arpptr + hln > (**pskb).tail)) 40 (arpptr + hln > skb_tail_pointer(*pskb)))
41 return NF_DROP; 41 return NF_DROP;
42 memcpy(arpptr, mangle->src_devaddr, hln); 42 memcpy(arpptr, mangle->src_devaddr, hln);
43 } 43 }
44 arpptr += hln; 44 arpptr += hln;
45 if (mangle->flags & ARPT_MANGLE_SIP) { 45 if (mangle->flags & ARPT_MANGLE_SIP) {
46 if (ARPT_MANGLE_ADDR_LEN_MAX < pln || 46 if (ARPT_MANGLE_ADDR_LEN_MAX < pln ||
47 (arpptr + pln > (**pskb).tail)) 47 (arpptr + pln > skb_tail_pointer(*pskb)))
48 return NF_DROP; 48 return NF_DROP;
49 memcpy(arpptr, &mangle->u_s.src_ip, pln); 49 memcpy(arpptr, &mangle->u_s.src_ip, pln);
50 } 50 }
51 arpptr += pln; 51 arpptr += pln;
52 if (mangle->flags & ARPT_MANGLE_TDEV) { 52 if (mangle->flags & ARPT_MANGLE_TDEV) {
53 if (ARPT_DEV_ADDR_LEN_MAX < hln || 53 if (ARPT_DEV_ADDR_LEN_MAX < hln ||
54 (arpptr + hln > (**pskb).tail)) 54 (arpptr + hln > skb_tail_pointer(*pskb)))
55 return NF_DROP; 55 return NF_DROP;
56 memcpy(arpptr, mangle->tgt_devaddr, hln); 56 memcpy(arpptr, mangle->tgt_devaddr, hln);
57 } 57 }
58 arpptr += hln; 58 arpptr += hln;
59 if (mangle->flags & ARPT_MANGLE_TIP) { 59 if (mangle->flags & ARPT_MANGLE_TIP) {
60 if (ARPT_MANGLE_ADDR_LEN_MAX < pln || 60 if (ARPT_MANGLE_ADDR_LEN_MAX < pln ||
61 (arpptr + pln > (**pskb).tail)) 61 (arpptr + pln > skb_tail_pointer(*pskb)))
62 return NF_DROP; 62 return NF_DROP;
63 memcpy(arpptr, &mangle->u_t.tgt_ip, pln); 63 memcpy(arpptr, &mangle->u_t.tgt_ip, pln);
64 } 64 }
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 5842f1aa973a..15e0d2002235 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -191,7 +191,7 @@ ipq_flush(int verdict)
191static struct sk_buff * 191static struct sk_buff *
192ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) 192ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
193{ 193{
194 unsigned char *old_tail; 194 sk_buff_data_t old_tail;
195 size_t size = 0; 195 size_t size = 0;
196 size_t data_len = 0; 196 size_t data_len = 0;
197 struct sk_buff *skb; 197 struct sk_buff *skb;
@@ -235,7 +235,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
235 if (!skb) 235 if (!skb)
236 goto nlmsg_failure; 236 goto nlmsg_failure;
237 237
238 old_tail= skb->tail; 238 old_tail = skb->tail;
239 nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); 239 nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh));
240 pmsg = NLMSG_DATA(nlh); 240 pmsg = NLMSG_DATA(nlh);
241 memset(pmsg, 0, sizeof(*pmsg)); 241 memset(pmsg, 0, sizeof(*pmsg));
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index c2c92ff12781..8a40fbe842b7 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -92,7 +92,8 @@ static void mangle_contents(struct sk_buff *skb,
92 /* move post-replacement */ 92 /* move post-replacement */
93 memmove(data + match_offset + rep_len, 93 memmove(data + match_offset + rep_len,
94 data + match_offset + match_len, 94 data + match_offset + match_len,
95 skb->tail - (data + match_offset + match_len)); 95 skb->tail - (skb->network_header + dataoff +
96 match_offset + match_len));
96 97
97 /* insert data from buffer */ 98 /* insert data from buffer */
98 memcpy(data + match_offset, rep_buffer, rep_len); 99 memcpy(data + match_offset, rep_buffer, rep_len);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2b214cc3724c..18a09a78ca0b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2231,7 +2231,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
2231 th->cwr = 0; 2231 th->cwr = 0;
2232 } while (skb->next); 2232 } while (skb->next);
2233 2233
2234 delta = htonl(oldlen + (skb->tail - skb_transport_header(skb)) + 2234 delta = htonl(oldlen + (skb->tail - skb->transport_header) +
2235 skb->data_len); 2235 skb->data_len);
2236 th->check = ~csum_fold((__force __wsum)((__force u32)th->check + 2236 th->check = ~csum_fold((__force __wsum)((__force u32)th->check +
2237 (__force u32)delta)); 2237 (__force u32)delta));
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 29c53fbb2204..c22cdcd84320 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -733,7 +733,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
733 } 733 }
734 skb_shinfo(skb)->nr_frags = k; 734 skb_shinfo(skb)->nr_frags = k;
735 735
736 skb->tail = skb->data; 736 skb_reset_tail_pointer(skb);
737 skb->data_len -= len; 737 skb->data_len -= len;
738 skb->len = skb->data_len; 738 skb->len = skb->data_len;
739} 739}