Thread (3 messages) flat view 3 messages, 2 authors, 2012-07-18

Re: [PATCH 07/15] ipv4: Adjust semantics of rt->rt_gateway.

From: Joe Perches <joe@perches.com>
Date: 2012-07-18 18:57:15

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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help