On Wed, 2012-07-18 at 11:23 -0700, David Miller wrote:
In order to allow prefixed routes, we have to adjust how rt_gateway
is set an interpreted.
typo an/and and a trivial style note:
quoted hunk ↗ jump to hunk
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
[]
quoted hunk ↗ jump to hunk
@@ -1079,8 +1079,10 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res) == 0)
src = FIB_RES_PREFSRC(dev_net(rt->dst.dev), res);
else
- src = inet_select_addr(rt->dst.dev, rt->rt_gateway,
- RT_SCOPE_UNIVERSE);
+ src = inet_select_addr(rt->dst.dev, (rt->rt_gateway ?
+ rt->rt_gateway :
+ iph->daddr),
+ RT_SCOPE_UNIVERSE);
maybe use the moderately common gcc ?: extension
src = inet_select_addr(rt->dst.dev,
rt->rt_gateway ?: iph->daddr,
RT_SCOPE_UNIVERSE);