Message ID | 20110426.151200.179925027.davem@davemloft.net |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: David Miller <davem@davemloft.net> Date: Tue, 26 Apr 2011 15:12:00 -0700 (PDT) > > 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. > > Signed-off-by: David S. Miller <davem@davemloft.net> 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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index bdad3d6..e0d0d5d 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 = daddr; + iph->saddr = saddr; iph->protocol = sk->sk_protocol; ip_select_ident(iph, &rt->dst, sk);
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. Signed-off-by: David S. Miller <davem@davemloft.net> --- net/ipv4/ip_output.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)