netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Popovich <popovich_sergei@mail.ru>
To: netdev@vger.kernel.org
Subject: Re: [PATCH 4/4] ipv4: mark nexthop as dead when it's subnet becomes unreachable
Date: Fri, 24 Jan 2014 12:12:28 +0200	[thread overview]
Message-ID: <2039386.VZO3kUlZdW@tuxracer> (raw)
In-Reply-To: <alpine.LFD.2.11.1401232221010.1667@ja.home.ssi.bg>


> 	Hello,

Hello, thanks for detailed explanation.

> 
> 
> 	My idea was that without calling fib_lookup() as
> done in fib_check_nh() you can not mark NH as dead because
> you are not sure that nh_gw is still reachable in different
> subnet. GW can be part of many subnets! Your patch assumes
> that GW can be part only from one subnet.

Agree, you are completely right.

> 
> 	Lets extend your example in this way:
> 
> ip -4 addr add 10.0.0.200/8 dev dummy1
> 
> 	ip route get 10.0.10.5 should return the longest
> match route, 10.0.10.0/24 in our case. If 10.0.10.1 is
> removed ip route get 10.0.10.5 will hit 10.0.0.0/8.
> 
> 	OK, lets delete the last 10.0.10.1 address on dummy1.
> 
> 	Before your patch only fib_sync_down_addr() was called.
> You now call fib_sync_down_dev() with force=0 and ifa, with the
> goal to mark 172.16.0.0/12 as dead (it is unipath route,
> so it will be removed). inet_ifa_match() checks that nh_gw
> 10.0.10.5 is part of the removed subnet: 10.0.10.0/24. Yes, it is.
> Who will check that 10.0.10.5 is still reachable as part of
> another subnet 10.0.0.0/8 ? At this point
> ip -4 route add 172.16.0.0/12 proto static via 10.0.10.5
> should succeed again because fib_check_nh() will see with
> fib_lookup() that 10.0.10.5 is part of 10.0.0.0/8. So, the
> patch wrongly marked the NH as dead.

Really, this true thank you for pointing me on the problem. V3 of patch
makes an attempt to address this. Please review it and tell what do you
thing about.

> 
> 	If last 10.0.10.5 is deleted we can mark NHs with
> nh_gw=10.0.10.5 as dead. It is again expensive (your
> new fib_sync_down_dev call) but this time fib_lookup() is
> not needed because this is a local GW. That is what I mean
> above.
> 
> > When deleting address and removing its subnet, instead of removing route
> > from the FIB, resolve new NH with fib_lookup() if possible, as this done
> > in fib_check_nh(), and leave route with modified NH?
> 
> 	I don't say to do it. But it is the only way to
> check if nh_gw is no more reachable.
> 
> > Well, sounds good, but what to do with multipath routes?
> > Is this correct at all?
> 
> 	fib_lookup() call is correct but expensive. That is
> why it was not done before.

fib_lookup() do its job well, but I dont think we need it at all because:

  1. We known what address is removed (if any).
  2. We known device where address is removed.
  3. Each route, regargless if this unipath or multipath, has device assigned
     for each NH entry (unless NH entry is dead or route is RTN_BLACKHOLE and
     friends). fib_check_nh() checks for this.

I think we could simply iterate over interface address list to find if there
are other subnet to which NH gateway resolve, beside removed address if any?

I did tests with v3 patch and seems described problem is gone.

> 
> Regards
> 
> --
> Julian Anastasov <ja@ssi.bg>

-- 
SP5474-RIPE
Sergey Popovich

  reply	other threads:[~2014-01-24 10:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 11:48 [PATCH 0/4] ipv4: small set of fixes Sergey Popovich
2014-01-21 11:48 ` [PATCH 1/4] ipv4: don't disable interface if last ipv4 address is removed Sergey Popovich
2014-01-23  1:52   ` David Miller
2014-01-21 11:48 ` [PATCH 2/4] ipv4: fib_semantics: increment fib_info_cnt after fib_info allocation Sergey Popovich
2014-01-21 11:48 ` [PATCH 3/4] ipv4: use SNMP macro assuming softirq context in ip_forward() Sergey Popovich
2014-01-23  1:52   ` David Miller
2014-01-21 11:48 ` [PATCH 4/4] ipv4: mark nexthop as dead when it's subnet becomes unreachable Sergey Popovich
2014-01-23  1:53   ` David Miller
2014-01-23 10:06   ` Julian Anastasov
2014-01-23 15:05     ` Sergey Popovich
2014-01-23 21:58       ` Julian Anastasov
2014-01-24 10:12         ` Sergey Popovich [this message]
2014-01-24 10:25           ` [PATCH 4/4 v3] " Sergey Popovich
2014-01-24 21:49             ` Julian Anastasov
2014-01-24 10:15         ` [PATCH 4/4 v3] ipv4: mark nexthop as dead when it's subnet becomes Sergey Popovich
2014-01-24 10:26           ` Sergey Popovich
2014-01-23  1:54 ` [PATCH 0/4] ipv4: small set of fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2039386.VZO3kUlZdW@tuxracer \
    --to=popovich_sergei@mail.ru \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).