]> err.no Git - linux-2.6/commitdiff
[SK_BUFF]: Use skb_reset_network_header in skb_push cases
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 Apr 2007 03:46:21 +0000 (20:46 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:24:47 +0000 (22:24 -0700)
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>
12 files changed:
net/core/netpoll.c
net/ipv4/ip_gre.c
net/ipv4/ip_output.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_xmit.c
net/ipv4/xfrm4_mode_beet.c
net/ipv4/xfrm4_mode_transport.c
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/ipv6/sit.c

index b4d1cdd58f11542d189a2d64a8554767d7dddba2..44e030eb6e75f7029d655d31f6a9b321069d9f0d 100644 (file)
@@ -308,7 +308,9 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        if (udph->check == 0)
                udph->check = CSUM_MANGLED_0;
 
-       skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
+       skb_push(skb, sizeof(*iph));
+       skb_reset_network_header(skb);
+       iph = skb->nh.iph;
 
        /* iph->version = 4; iph->ihl = 5; */
        put_unaligned(0x45, (unsigned char *)iph);
index ced2c4baf174f5782c10b4d057440e191f9f8517..f84ca6668fb90382309ac581a513d3b62226467c 100644 (file)
@@ -828,7 +828,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        skb->h.raw = skb->nh.raw;
-       skb->nh.raw = skb_push(skb, gre_hlen);
+       skb_push(skb, gre_hlen);
+       skb_reset_network_header(skb);
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
        IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
                              IPSKB_REROUTED);
index 32f1a23a80f9a9c920e7064e75eceedb10d90659..d329718a8e8cb2985d9e98d8c2ed6d1c512fafcd 100644 (file)
@@ -503,7 +503,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
                        if (frag) {
                                frag->ip_summed = CHECKSUM_NONE;
                                frag->h.raw = frag->data;
-                               frag->nh.raw = __skb_push(frag, hlen);
+                               __skb_push(frag, hlen);
+                               skb_reset_network_header(frag);
                                memcpy(frag->nh.raw, iph, hlen);
                                iph = frag->nh.iph;
                                iph->tot_len = htons(frag->len);
index 5f886c892861e84214b331a6d48a9b86d3a10b2f..843cc09f961f756edbe6684c684b3092adcd4d0f 100644 (file)
@@ -619,7 +619,8 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        skb->h.raw = skb->nh.raw;
-       skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
+       skb_push(skb, sizeof(struct iphdr));
+       skb_reset_network_header(skb);
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
        IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
                              IPSKB_REROUTED);
index f73f4e402f728e96b87c35f695165b289284dde0..05c82ca45aaffd860dbba2d9900d514a07d09545 100644 (file)
@@ -1593,7 +1593,8 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
                        return -ENOMEM;
                }
 
-               skb2->nh.raw = skb_push(skb2, sizeof(struct iphdr));
+               skb_push(skb2, sizeof(struct iphdr));
+               skb_reset_network_header(skb2);
                skb2->nh.iph->ihl = sizeof(struct iphdr)>>2;
                skb2->nh.iph->saddr = rt->rt_src;
                skb2->nh.iph->daddr = rt->rt_dst;
index f73c5acf5dd165cf07984173656749fb12257186..d1403d0855eda8e55e4314e5a89beb948a9419d0 100644 (file)
@@ -385,7 +385,8 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        /* fix old IP header checksum */
        ip_send_check(old_iph);
 
-       skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
+       skb_push(skb, sizeof(struct iphdr));
+       skb_reset_network_header(skb);
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
 
        /* drop old route */
index d419e15d98035bc34ce9d6f2f84fb0db1cefed48..eaaf3565f3b224946b0a52ab6de677e845f418e1 100644 (file)
@@ -40,7 +40,8 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
        if (unlikely(optlen))
                hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4);
 
-       skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen);
+       skb_push(skb, x->props.header_len + hdrlen);
+       skb_reset_network_header(skb);
        top_iph = skb->nh.iph;
        skb->h.raw += sizeof(*iph) - hdrlen;
 
index 92676b7e403477ec575ef7bd861fdd09381a46d1..290c0f2e7c29124a7112a352c20f3f698ef1f430 100644 (file)
@@ -32,7 +32,9 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
        ihl = iph->ihl * 4;
        skb->h.raw += ihl;
 
-       skb->nh.raw = memmove(skb_push(skb, x->props.header_len), iph, ihl);
+       skb_push(skb, x->props.header_len);
+       skb_reset_network_header(skb);
+       memmove(skb->nh.raw, iph, ihl);
        return 0;
 }
 
index ffc6005d1d558cc78dde6d78a754e3ba74717ffd..bec851f278e5f3fec25e93cf69f6e2c32e9ef9da 100644 (file)
@@ -49,7 +49,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
        iph = skb->nh.iph;
        skb->h.ipiph = iph;
 
-       skb->nh.raw = skb_push(skb, x->props.header_len);
+       skb_push(skb, x->props.header_len);
+       skb_reset_network_header(skb);
        top_iph = skb->nh.iph;
 
        top_iph->ihl = 5;
index 4406546d3ce82e5448c1a11922e215d3f082ffe2..8a7b5c760147e1564455d24f1448e84315f08432 100644 (file)
@@ -191,7 +191,9 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
                        ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop);
        }
 
-       hdr = skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6hdr));
+       skb_push(skb, sizeof(struct ipv6hdr));
+       skb_reset_network_header(skb);
+       hdr = skb->nh.ipv6h;
 
        /*
         *      Fill in the IPv6 header
@@ -626,7 +628,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
 
                __skb_pull(skb, hlen);
                fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr));
-               skb->nh.raw = __skb_push(skb, hlen);
+               __skb_push(skb, hlen);
+               skb_reset_network_header(skb);
                memcpy(skb->nh.raw, tmp_hdr, hlen);
 
                ipv6_select_ident(skb, fh);
@@ -649,7 +652,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
                                frag->ip_summed = CHECKSUM_NONE;
                                frag->h.raw = frag->data;
                                fh = (struct frag_hdr*)__skb_push(frag, sizeof(struct frag_hdr));
-                               frag->nh.raw = __skb_push(frag, hlen);
+                               __skb_push(frag, hlen);
+                               skb_reset_network_header(frag);
                                memcpy(frag->nh.raw, tmp_hdr, hlen);
                                offset += skb->len - hlen - sizeof(struct frag_hdr);
                                fh->nexthdr = nexthdr;
@@ -1346,7 +1350,9 @@ int ip6_push_pending_frames(struct sock *sk)
        if (opt && opt->opt_nflen)
                ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst);
 
-       skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr));
+       skb_push(skb, sizeof(struct ipv6hdr));
+       skb_reset_network_header(skb);
+       hdr = skb->nh.ipv6h;
 
        *(__be32*)hdr = fl->fl6_flowlabel |
                     htonl(0x60000000 | ((int)np->cork.tclass << 20));
index 30df8e6c42ccb83729eac101f3a61ec3c98a8d03..a1e4f39c6793f3ea4ec1432e7cc4ed78f72b3c5c 100644 (file)
@@ -907,7 +907,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
                init_tel_txopt(&opt, encap_limit);
                ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
        }
-       skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr));
+       skb_push(skb, sizeof(struct ipv6hdr));
+       skb_reset_network_header(skb);
        ipv6h = skb->nh.ipv6h;
        *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
        dsfield = INET_ECN_encapsulate(0, dsfield);
index 0477728578fe8e1b4d42c7b6f1fb312cbd2304a1..62883d41b6c37b1ebf452beb65e9b86f334c49d6 100644 (file)
@@ -554,7 +554,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        skb->h.raw = skb->nh.raw;
-       skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
+       skb_push(skb, sizeof(struct iphdr));
+       skb_reset_network_header(skb);
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
        IPCB(skb)->flags = 0;
        dst_release(skb->dst);