Skip to contentSkip to conversation

ipv4: In ip_build_and_send_pkt() use 'saddr' and 'daddr' args passed in.

PATCH New David Miller 1 participant 1 message May 4, 2011

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 2/5 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.

---
 net/ipv4/ip_output.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ip_output.c +2 -2
index 3aa4c31..db38c18 100644
@@ -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);
 
Signature · 1 line
1.7.4.5