Commit 22f728f8 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent 0374d9ce
......@@ -1327,10 +1327,6 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
iph = (struct iphdr *)skb->data;
iph->version = 4;
iph->ihl = 5;
if (opt) {
iph->ihl += opt->optlen>>2;
ip_options_build(skb, opt, cork->addr, rt, 0);
}
iph->tos = inet->tos;
iph->frag_off = df;
ip_select_ident(iph, &rt->dst, sk);
......@@ -1339,6 +1335,11 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
iph->saddr = fl4->saddr;
iph->daddr = fl4->daddr;
if (opt) {
iph->ihl += opt->optlen>>2;
ip_options_build(skb, opt, cork->addr, rt, 0);
}
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment