From: David S. Miller Date: Wed, 4 May 2011 19:03:30 +0000 (-0700) Subject: ipv4: In ip_build_and_send_pkt() use 'saddr' and 'daddr' args passed in. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dd927a2694ee412b440284dd72dd8e32caada3fc;p=linux-beck.git ipv4: In ip_build_and_send_pkt() use 'saddr' and 'daddr' args passed in. Instead of rt->rt_{dst,src} The only tricky part is source route option handling. If the source route option is enabled we can't just use plain 'daddr', we have to use opt->opt.faddr. Signed-off-by: David S. Miller --- diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 3aa4c31e5448..db38c1822de8 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -158,8 +158,8 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, else iph->frag_off = 0; iph->ttl = ip_select_ttl(inet, &rt->dst); - iph->daddr = rt->rt_dst; - iph->saddr = rt->rt_src; + iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr); + iph->saddr = saddr; iph->protocol = sk->sk_protocol; ip_select_ident(iph, &rt->dst, sk);