diff options
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index dde51fb72cda..99cd90c22310 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, | |||
125 | struct iphdr *iph; | 125 | struct iphdr *iph; |
126 | 126 | ||
127 | /* Build the IP header. */ | 127 | /* Build the IP header. */ |
128 | if (opt) | 128 | skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0)); |
129 | iph=(struct iphdr *)skb_push(skb,sizeof(struct iphdr) + opt->optlen); | 129 | skb_reset_network_header(skb); |
130 | else | 130 | iph = skb->nh.iph; |
131 | iph=(struct iphdr *)skb_push(skb,sizeof(struct iphdr)); | ||
132 | |||
133 | iph->version = 4; | 131 | iph->version = 4; |
134 | iph->ihl = 5; | 132 | iph->ihl = 5; |
135 | iph->tos = inet->tos; | 133 | iph->tos = inet->tos; |
@@ -143,7 +141,6 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | |||
143 | iph->protocol = sk->sk_protocol; | 141 | iph->protocol = sk->sk_protocol; |
144 | iph->tot_len = htons(skb->len); | 142 | iph->tot_len = htons(skb->len); |
145 | ip_select_ident(iph, &rt->u.dst, sk); | 143 | ip_select_ident(iph, &rt->u.dst, sk); |
146 | skb->nh.iph = iph; | ||
147 | 144 | ||
148 | if (opt && opt->optlen) { | 145 | if (opt && opt->optlen) { |
149 | iph->ihl += opt->optlen>>2; | 146 | iph->ihl += opt->optlen>>2; |
@@ -333,7 +330,9 @@ packet_routed: | |||
333 | goto no_route; | 330 | goto no_route; |
334 | 331 | ||
335 | /* OK, we know where to send it, allocate and build IP header. */ | 332 | /* OK, we know where to send it, allocate and build IP header. */ |
336 | iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0)); | 333 | skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0)); |
334 | skb_reset_network_header(skb); | ||
335 | iph = skb->nh.iph; | ||
337 | *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff)); | 336 | *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff)); |
338 | iph->tot_len = htons(skb->len); | 337 | iph->tot_len = htons(skb->len); |
339 | if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok) | 338 | if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok) |
@@ -344,7 +343,6 @@ packet_routed: | |||
344 | iph->protocol = sk->sk_protocol; | 343 | iph->protocol = sk->sk_protocol; |
345 | iph->saddr = rt->rt_src; | 344 | iph->saddr = rt->rt_src; |
346 | iph->daddr = rt->rt_dst; | 345 | iph->daddr = rt->rt_dst; |
347 | skb->nh.iph = iph; | ||
348 | /* Transport layer set skb->h.foo itself. */ | 346 | /* Transport layer set skb->h.foo itself. */ |
349 | 347 | ||
350 | if (opt && opt->optlen) { | 348 | if (opt && opt->optlen) { |