* rt_uses_gateway was removed?
@ 2019-09-15 9:08 Julian Anastasov
2019-09-16 0:05 ` David Ahern
0 siblings, 1 reply; 2+ messages in thread
From: Julian Anastasov @ 2019-09-15 9:08 UTC (permalink / raw)
To: David Ahern; +Cc: netdev, Ido Schimmel
Hello,
Looks like I'm a bit late with the storm of changes
in the routing.
By default, after allocation rt_uses_gateway was set to 0.
Later it can be set to 1 if nh_gw is not the final route target,
i.e. it is indirect GW and not a target on LAN (the RT_SCOPE_LINK
check in rt_set_nexthop).
What remains hidden for the rt_uses_gateway semantic
is this code in rt_set_nexthop:
if (unlikely(!cached)) {
/* Routes we intend to cache in nexthop exception or
* FIB nexthop have the DST_NOCACHE bit clear.
* However, if we are unsuccessful at storing this
* route into the cache we really need to set it.
*/
if (!rt->rt_gateway)
rt->rt_gateway = daddr;
rt_add_uncached_list(rt);
}
and this code in rt_bind_exception:
if (!rt->rt_gateway)
rt->rt_gateway = daddr;
I.e. even if rt_uses_gateway remains 0, rt_gateway
can contain address, i.e. the target is on LAN and not
behind nh_gw.
Now I see commit 1550c171935d wrongly changes that to
"If rt_gw_family is set it implies rt_uses_gateway.".
As result, we set rt_gw_family while rt_uses_gateway was 0
for above cases. Think about it in this way: there should be
a reason why we used rt_uses_gateway flag instead a simple
"rt_gateway != 0" check, right?
Replacing rt->rt_gateway checks with rt_gw_family
checks is right but rt_uses_gateway checks should be put
back because they indicates the route has more hops to
target.
As the problem is related to some FNHW and non-cached
routes, redirects, etc the easiest way to see the problem is with
'ip route get LOCAL_IP oif eth0' where extra 'via GW' line is
shown.
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: rt_uses_gateway was removed?
2019-09-15 9:08 rt_uses_gateway was removed? Julian Anastasov
@ 2019-09-16 0:05 ` David Ahern
0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2019-09-16 0:05 UTC (permalink / raw)
To: Julian Anastasov; +Cc: netdev, Ido Schimmel
On 9/15/19 3:08 AM, Julian Anastasov wrote:
> Now I see commit 1550c171935d wrongly changes that to
> "If rt_gw_family is set it implies rt_uses_gateway.".
> As result, we set rt_gw_family while rt_uses_gateway was 0
> for above cases. Think about it in this way: there should be
> a reason why we used rt_uses_gateway flag instead a simple
> "rt_gateway != 0" check, right?
>
> Replacing rt->rt_gateway checks with rt_gw_family
> checks is right but rt_uses_gateway checks should be put
> back because they indicates the route has more hops to
> target.
>
> As the problem is related to some FNHW and non-cached
> routes, redirects, etc the easiest way to see the problem is with
> 'ip route get LOCAL_IP oif eth0' where extra 'via GW' line is
> shown.
Hi Julian:
Thanks for the detailed report. Yes, I misunderstood the subtle point of
rt_uses_gateway. I will look at a fix this week.
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-16 0:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-15 9:08 rt_uses_gateway was removed? Julian Anastasov
2019-09-16 0:05 ` David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).