ipv4: Respect 'saddr' and 'daddr' args to ip_build_and_send_pkt().
Subsystems (3)
David Miller
maintainerPATCH 1/4 ipv4: Respect 'saddr' and 'daddr' args to ip_build_and_send_pkt().
This function ignores the passed in addresses and forces their settings using rt->rt_dst and rt->rt_src.
There is never a reason to do this, because the socket of the callers of this function must know what addresses it is using.
--- net/ipv4/ip_output.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ip_output.c +2 -2
@@ -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 = daddr; + iph->saddr = saddr; iph->protocol = sk->sk_protocol;ip_select_ident (iph, &rt->dst, sk);
Signature · 1 line
1.7.4.5
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Tue, 26 Apr 2011 15:12:00 -0700 (PDT)
Quoted 8 lines
This function ignores the passed in addresses and forces their settings using
rt->rt_dstandrt->rt_src.There is never a reason to do this, because the socket of the callers of this function must know what addresses it is using.
Signed-off-by David S. Miller <[email protected]>
I did not end up applying this one to net-next-2.6, it's not correct. It would break things when the source routing is enabled on the socket.
When that happens, we look up the route to the SRR options's first entry, not the actual final destination. And that initial SRR option address is the destination IP address we need to use in the IP header this we need to use rt->rt_{src,dst}.
This could be implemented properly by doing something like:
if (opt && opt->srr) iph->daddr = x; else iph->daddr = daddr;
I'll think about it.