diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-10 23:46:21 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:47 -0400 |
commit | e2d1bca7e6134671bcb19810d004a252aa6a644d (patch) | |
tree | 5d8ee962cd69cd886aaedff8ac253590a985dd1c /net/ipv6 | |
parent | c1d2bbe1cd6c7bbdc6d532cefebb66c7efb789ce (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>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_output.c | 14 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 3 | ||||
-rw-r--r-- | net/ipv6/sit.c | 3 |
3 files changed, 14 insertions, 6 deletions
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); |