Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8856dfa3e9b71ac2177016f66ace3a8978afecc1
Commit:     8856dfa3e9b71ac2177016f66ace3a8978afecc1
Parent:     04b964dbad25cbd6edd8ecbeca2efb40c9860865
Author:     Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
AuthorDate: Sat Mar 10 19:40:39 2007 -0300
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:24:53 2007 -0700

    [SK_BUFF]: Use skb_reset_network_header after skb_push
    
    Some more cases where skb->nh.iph was being set that were converted
    to using skb_reset_network_header.
    
    Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/ip_output.c |   14 ++++++--------
 net/ipv4/ipmr.c      |    9 ++++++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index dde51fb..99cd90c 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -125,11 +125,9 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock 
*sk,
        struct iphdr *iph;
 
        /* Build the IP header. */
-       if (opt)
-               iph=(struct iphdr *)skb_push(skb,sizeof(struct iphdr) + 
opt->optlen);
-       else
-               iph=(struct iphdr *)skb_push(skb,sizeof(struct iphdr));
-
+       skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
+       skb_reset_network_header(skb);
+       iph = skb->nh.iph;
        iph->version  = 4;
        iph->ihl      = 5;
        iph->tos      = inet->tos;
@@ -143,7 +141,6 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock 
*sk,
        iph->protocol = sk->sk_protocol;
        iph->tot_len  = htons(skb->len);
        ip_select_ident(iph, &rt->u.dst, sk);
-       skb->nh.iph   = iph;
 
        if (opt && opt->optlen) {
                iph->ihl += opt->optlen>>2;
@@ -333,7 +330,9 @@ packet_routed:
                goto no_route;
 
        /* OK, we know where to send it, allocate and build IP header. */
-       iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? 
opt->optlen : 0));
+       skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
+       skb_reset_network_header(skb);
+       iph = skb->nh.iph;
        *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff));
        iph->tot_len = htons(skb->len);
        if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok)
@@ -344,7 +343,6 @@ packet_routed:
        iph->protocol = sk->sk_protocol;
        iph->saddr    = rt->rt_src;
        iph->daddr    = rt->rt_dst;
-       skb->nh.iph   = iph;
        /* Transport layer set skb->h.foo itself. */
 
        if (opt && opt->optlen) {
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 45435f0..51528d3 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1093,7 +1093,12 @@ static struct notifier_block ip_mr_notifier={
 
 static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
 {
-       struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
+       struct iphdr *iph;
+
+       skb_push(skb, sizeof(struct iphdr));
+       skb->h.ipiph = skb->nh.iph;
+       skb_reset_network_header(skb);
+       iph = skb->nh.iph;
 
        iph->version    =       4;
        iph->tos        =       skb->nh.iph->tos;
@@ -1107,8 +1112,6 @@ static void ip_encap(struct sk_buff *skb, __be32 saddr, 
__be32 daddr)
        ip_select_ident(iph, skb->dst, NULL);
        ip_send_check(iph);
 
-       skb->h.ipiph = skb->nh.iph;
-       skb->nh.iph = iph;
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
        nf_reset(skb);
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to