aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-10 23:46:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:47 -0400
commite2d1bca7e6134671bcb19810d004a252aa6a644d (patch)
tree5d8ee962cd69cd886aaedff8ac253590a985dd1c
parentc1d2bbe1cd6c7bbdc6d532cefebb66c7efb789ce (diff)
[SK_BUFF]: Use skb_reset_network_header in skb_push cases
skb_push updates and returns skb->data, so we can just call skb_reset_network_header after the call to skb_push. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/netpoll.c4
-rw-r--r--net/ipv4/ip_gre.c3
-rw-r--r--net/ipv4/ip_output.c3
-rw-r--r--net/ipv4/ipip.c3
-rw-r--r--net/ipv4/ipmr.c3
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c3
-rw-r--r--net/ipv4/xfrm4_mode_beet.c3
-rw-r--r--net/ipv4/xfrm4_mode_transport.c4
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c3
-rw-r--r--net/ipv6/ip6_output.c14
-rw-r--r--net/ipv6/ip6_tunnel.c3
-rw-r--r--net/ipv6/sit.c3
12 files changed, 34 insertions, 15 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index b4d1cdd58f11..44e030eb6e75 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -308,7 +308,9 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
308 if (udph->check == 0) 308 if (udph->check == 0)
309 udph->check = CSUM_MANGLED_0; 309 udph->check = CSUM_MANGLED_0;
310 310
311 skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph)); 311 skb_push(skb, sizeof(*iph));
312 skb_reset_network_header(skb);
313 iph = skb->nh.iph;
312 314
313 /* iph->version = 4; iph->ihl = 5; */ 315 /* iph->version = 4; iph->ihl = 5; */
314 put_unaligned(0x45, (unsigned char *)iph); 316 put_unaligned(0x45, (unsigned char *)iph);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index ced2c4baf174..f84ca6668fb9 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -828,7 +828,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
828 } 828 }
829 829
830 skb->h.raw = skb->nh.raw; 830 skb->h.raw = skb->nh.raw;
831 skb->nh.raw = skb_push(skb, gre_hlen); 831 skb_push(skb, gre_hlen);
832 skb_reset_network_header(skb);
832 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 833 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
833 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 834 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
834 IPSKB_REROUTED); 835 IPSKB_REROUTED);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 32f1a23a80f9..d329718a8e8c 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -503,7 +503,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
503 if (frag) { 503 if (frag) {
504 frag->ip_summed = CHECKSUM_NONE; 504 frag->ip_summed = CHECKSUM_NONE;
505 frag->h.raw = frag->data; 505 frag->h.raw = frag->data;
506 frag->nh.raw = __skb_push(frag, hlen); 506 __skb_push(frag, hlen);
507 skb_reset_network_header(frag);
507 memcpy(frag->nh.raw, iph, hlen); 508 memcpy(frag->nh.raw, iph, hlen);
508 iph = frag->nh.iph; 509 iph = frag->nh.iph;
509 iph->tot_len = htons(frag->len); 510 iph->tot_len = htons(frag->len);
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 5f886c892861..843cc09f961f 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -619,7 +619,8 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
619 } 619 }
620 620
621 skb->h.raw = skb->nh.raw; 621 skb->h.raw = skb->nh.raw;
622 skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); 622 skb_push(skb, sizeof(struct iphdr));
623 skb_reset_network_header(skb);
623 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 624 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
624 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 625 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
625 IPSKB_REROUTED); 626 IPSKB_REROUTED);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index f73f4e402f72..05c82ca45aaf 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1593,7 +1593,8 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
1593 return -ENOMEM; 1593 return -ENOMEM;
1594 } 1594 }
1595 1595
1596 skb2->nh.raw = skb_push(skb2, sizeof(struct iphdr)); 1596 skb_push(skb2, sizeof(struct iphdr));
1597 skb_reset_network_header(skb2);
1597 skb2->nh.iph->ihl = sizeof(struct iphdr)>>2; 1598 skb2->nh.iph->ihl = sizeof(struct iphdr)>>2;
1598 skb2->nh.iph->saddr = rt->rt_src; 1599 skb2->nh.iph->saddr = rt->rt_src;
1599 skb2->nh.iph->daddr = rt->rt_dst; 1600 skb2->nh.iph->daddr = rt->rt_dst;
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c
index f73c5acf5dd1..d1403d0855ed 100644
--- a/net/ipv4/ipvs/ip_vs_xmit.c
+++ b/net/ipv4/ipvs/ip_vs_xmit.c
@@ -385,7 +385,8 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
385 /* fix old IP header checksum */ 385 /* fix old IP header checksum */
386 ip_send_check(old_iph); 386 ip_send_check(old_iph);
387 387
388 skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); 388 skb_push(skb, sizeof(struct iphdr));
389 skb_reset_network_header(skb);
389 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 390 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
390 391
391 /* drop old route */ 392 /* drop old route */
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index d419e15d9803..eaaf3565f3b2 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -40,7 +40,8 @@ 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->nh.raw = skb_push(skb, x->props.header_len + hdrlen); 43 skb_push(skb, x->props.header_len + hdrlen);
44 skb_reset_network_header(skb);
44 top_iph = skb->nh.iph; 45 top_iph = skb->nh.iph;
45 skb->h.raw += sizeof(*iph) - hdrlen; 46 skb->h.raw += sizeof(*iph) - hdrlen;
46 47
diff --git a/net/ipv4/xfrm4_mode_transport.c b/net/ipv4/xfrm4_mode_transport.c
index 92676b7e4034..290c0f2e7c29 100644
--- a/net/ipv4/xfrm4_mode_transport.c
+++ b/net/ipv4/xfrm4_mode_transport.c
@@ -32,7 +32,9 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
32 ihl = iph->ihl * 4; 32 ihl = iph->ihl * 4;
33 skb->h.raw += ihl; 33 skb->h.raw += ihl;
34 34
35 skb->nh.raw = memmove(skb_push(skb, x->props.header_len), iph, ihl); 35 skb_push(skb, x->props.header_len);
36 skb_reset_network_header(skb);
37 memmove(skb->nh.raw, iph, ihl);
36 return 0; 38 return 0;
37} 39}
38 40
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index ffc6005d1d55..bec851f278e5 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -49,7 +49,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
49 iph = skb->nh.iph; 49 iph = skb->nh.iph;
50 skb->h.ipiph = iph; 50 skb->h.ipiph = iph;
51 51
52 skb->nh.raw = skb_push(skb, x->props.header_len); 52 skb_push(skb, x->props.header_len);
53 skb_reset_network_header(skb);
53 top_iph = skb->nh.iph; 54 top_iph = skb->nh.iph;
54 55
55 top_iph->ihl = 5; 56 top_iph->ihl = 5;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 4406546d3ce8..8a7b5c760147 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -191,7 +191,9 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
191 ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop); 191 ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop);
192 } 192 }
193 193
194 hdr = skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6hdr)); 194 skb_push(skb, sizeof(struct ipv6hdr));
195 skb_reset_network_header(skb);
196 hdr = skb->nh.ipv6h;
195 197
196 /* 198 /*
197 * Fill in the IPv6 header 199 * Fill in the IPv6 header
@@ -626,7 +628,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
626 628
627 __skb_pull(skb, hlen); 629 __skb_pull(skb, hlen);
628 fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr)); 630 fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr));
629 skb->nh.raw = __skb_push(skb, hlen); 631 __skb_push(skb, hlen);
632 skb_reset_network_header(skb);
630 memcpy(skb->nh.raw, tmp_hdr, hlen); 633 memcpy(skb->nh.raw, tmp_hdr, hlen);
631 634
632 ipv6_select_ident(skb, fh); 635 ipv6_select_ident(skb, fh);
@@ -649,7 +652,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
649 frag->ip_summed = CHECKSUM_NONE; 652 frag->ip_summed = CHECKSUM_NONE;
650 frag->h.raw = frag->data; 653 frag->h.raw = frag->data;
651 fh = (struct frag_hdr*)__skb_push(frag, sizeof(struct frag_hdr)); 654 fh = (struct frag_hdr*)__skb_push(frag, sizeof(struct frag_hdr));
652 frag->nh.raw = __skb_push(frag, hlen); 655 __skb_push(frag, hlen);
656 skb_reset_network_header(frag);
653 memcpy(frag->nh.raw, tmp_hdr, hlen); 657 memcpy(frag->nh.raw, tmp_hdr, hlen);
654 offset += skb->len - hlen - sizeof(struct frag_hdr); 658 offset += skb->len - hlen - sizeof(struct frag_hdr);
655 fh->nexthdr = nexthdr; 659 fh->nexthdr = nexthdr;
@@ -1346,7 +1350,9 @@ int ip6_push_pending_frames(struct sock *sk)
1346 if (opt && opt->opt_nflen) 1350 if (opt && opt->opt_nflen)
1347 ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst); 1351 ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst);
1348 1352
1349 skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr)); 1353 skb_push(skb, sizeof(struct ipv6hdr));
1354 skb_reset_network_header(skb);
1355 hdr = skb->nh.ipv6h;
1350 1356
1351 *(__be32*)hdr = fl->fl6_flowlabel | 1357 *(__be32*)hdr = fl->fl6_flowlabel |
1352 htonl(0x60000000 | ((int)np->cork.tclass << 20)); 1358 htonl(0x60000000 | ((int)np->cork.tclass << 20));
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 30df8e6c42cc..a1e4f39c6793 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -907,7 +907,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
907 init_tel_txopt(&opt, encap_limit); 907 init_tel_txopt(&opt, encap_limit);
908 ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL); 908 ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
909 } 909 }
910 skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr)); 910 skb_push(skb, sizeof(struct ipv6hdr));
911 skb_reset_network_header(skb);
911 ipv6h = skb->nh.ipv6h; 912 ipv6h = skb->nh.ipv6h;
912 *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000); 913 *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
913 dsfield = INET_ECN_encapsulate(0, dsfield); 914 dsfield = INET_ECN_encapsulate(0, dsfield);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 0477728578fe..62883d41b6c3 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -554,7 +554,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
554 } 554 }
555 555
556 skb->h.raw = skb->nh.raw; 556 skb->h.raw = skb->nh.raw;
557 skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); 557 skb_push(skb, sizeof(struct iphdr));
558 skb_reset_network_header(skb);
558 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 559 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
559 IPCB(skb)->flags = 0; 560 IPCB(skb)->flags = 0;
560 dst_release(skb->dst); 561 dst_release(skb->dst);