diff options
author | David S. Miller <davem@davemloft.net> | 2011-05-13 17:21:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-13 17:21:27 -0400 |
commit | 22f728f8f311659b068e73ed92833c205651a47f (patch) | |
tree | cab06ba8b08c8c88a021d597c031c1ef24fae732 /net/ipv4/ip_output.c | |
parent | 0374d9ceb02eb12fcd65be9dd5df9c911ef93424 (diff) |
ipv4: Always call ip_options_build() after rest of IP header is filled in.
This will allow ip_options_build() to reliably look at the values of
iph->{daddr,saddr}
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 70778d48aa7b..98af3697c718 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -1327,10 +1327,6 @@ struct sk_buff *__ip_make_skb(struct sock *sk, | |||
1327 | iph = (struct iphdr *)skb->data; | 1327 | iph = (struct iphdr *)skb->data; |
1328 | iph->version = 4; | 1328 | iph->version = 4; |
1329 | iph->ihl = 5; | 1329 | iph->ihl = 5; |
1330 | if (opt) { | ||
1331 | iph->ihl += opt->optlen>>2; | ||
1332 | ip_options_build(skb, opt, cork->addr, rt, 0); | ||
1333 | } | ||
1334 | iph->tos = inet->tos; | 1330 | iph->tos = inet->tos; |
1335 | iph->frag_off = df; | 1331 | iph->frag_off = df; |
1336 | ip_select_ident(iph, &rt->dst, sk); | 1332 | ip_select_ident(iph, &rt->dst, sk); |
@@ -1339,6 +1335,11 @@ struct sk_buff *__ip_make_skb(struct sock *sk, | |||
1339 | iph->saddr = fl4->saddr; | 1335 | iph->saddr = fl4->saddr; |
1340 | iph->daddr = fl4->daddr; | 1336 | iph->daddr = fl4->daddr; |
1341 | 1337 | ||
1338 | if (opt) { | ||
1339 | iph->ihl += opt->optlen>>2; | ||
1340 | ip_options_build(skb, opt, cork->addr, rt, 0); | ||
1341 | } | ||
1342 | |||
1342 | skb->priority = sk->sk_priority; | 1343 | skb->priority = sk->sk_priority; |
1343 | skb->mark = sk->sk_mark; | 1344 | skb->mark = sk->sk_mark; |
1344 | /* | 1345 | /* |