netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, kuznet@ms2.inr.ac.ru, jmorris@namei.org,
	yoshfuji@linux-ipv6.org, kaber@trash.net
Subject: Re: [PATCH net] ipv6: do not overwrite inetpeer metrics prematurely
Date: Wed, 26 Mar 2014 16:09:57 +0100	[thread overview]
Message-ID: <20140326150957.GB27720@unicorn.suse.cz> (raw)
In-Reply-To: <20140325191155.GB22086@order.stressinduktion.org>

On Tue, Mar 25, 2014 at 08:11:55PM +0100, Hannes Frederic Sowa wrote:
> > > What I ended up with is below. It uses the metrics in inetpeer if there
> > > is one even if the new host metric doesn't have any metrics to set (in
> > > which case it clears them first). I tested various scenarios and the
> > > results were correct.
> > 
> > This doesn't cover all cases either:
> > 
> >   ip route add fec0::1 dev eth0 rto_min 1000
> >   ip route delete fec0::1
> >   ip route add fec0::1 dev eth0
> >   ip route change fec0::1 dev eth0 hoplimit 10
> > 
> > This way the inetpeer with rto_min 1000 persists until the fourth
> > command but neither third nor fourth see old dst_entry with writeable
> > metrics.
> > 
> > I think changing the condition for copying in ip6_cow_metrics() would
> > do the trick but I better stop now and look at it again later with
> > a fresh mind.
> 
> Do you need some help regarding this patch so that it may be included in
> net-next before it gets closed?

Sorry for the delay, I was working on some more urgent bugs.

While rethinking the problem, I realized that these metrics hidden in
old inetpeer are actually even more dangerous. Assume we create a (host)
route with metrics, delete it but the inetpeer with the metrics still
exists. If we then create a new route without metrics, this inetpeer is
(later) bound to it but metrics in it are not used. However, as soon as
ipv6_cow_metrics() is called, they are linked into struct dst_entry but
as they are not "new", they are not overwritten.

The approach I tried was to add a new flag DST_KEEP_METRICS (should
rather be something like DST_OVERRIDE_INETPEER_METRICS but that looks
awful) which is set in ip6_route_add() and makes ipv6_cow_metrics()
always rewrite metrics in attached inetpeer and then reset the flag. In
ip6_rt_copy(), this flag is not copied (but the metrics are overwritten
anyway).

I ran some tests with all scenarios I could think of and all seem to
work fine. I'll post the patch for review in a moment.

                                                       Michal Kubecek

  reply	other threads:[~2014-03-26 15:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06  9:50 [PATCH net] ipv6: do not overwrite inetpeer metrics prematurely Michal Kubecek
2014-03-06 19:24 ` David Miller
2014-03-06 20:06   ` Michal Kubecek
2014-03-07 12:36     ` [PATCH net v2] " Michal Kubecek
2014-03-07 20:52     ` [PATCH net] " David Miller
2014-03-07 21:38       ` Michal Kubecek
2014-03-08  8:34         ` Hannes Frederic Sowa
2014-03-08  8:06       ` Hannes Frederic Sowa
2014-03-10  0:26         ` David Miller
2014-03-10  0:52           ` Hannes Frederic Sowa
2014-03-10  5:03             ` David Miller
2014-03-10  8:15               ` Michal Kubecek
2014-03-10 12:00                 ` Hannes Frederic Sowa
2014-03-10 13:15                   ` Michal Kubecek
2014-03-11  2:38                   ` David Miller
2014-03-11  9:53                     ` Michal Kubecek
2014-03-11 15:08                       ` Michal Kubecek
2014-03-11 15:20                         ` Hannes Frederic Sowa
2014-03-11 15:39                         ` Michal Kubecek
2014-03-25 19:11                           ` Hannes Frederic Sowa
2014-03-26 15:09                             ` Michal Kubecek [this message]
2014-03-26 15:42                             ` [PATCH net-next v3] " Michal Kubecek
2014-03-26 15:50                               ` Hannes Frederic Sowa
2014-03-26 15:56                                 ` Michal Kubecek
2014-03-26 16:05                                 ` [PATCH net-next v4] " Michal Kubecek
2014-03-27  5:06                                   ` Hannes Frederic Sowa
2014-03-27  7:43                                     ` Michal Kubecek
2014-03-27 12:04                                     ` [PATCH net-next v5] " Michal Kubecek
2014-03-27 16:30                                       ` Hannes Frederic Sowa
2014-03-27 19:09                                         ` David Miller
2014-03-12 20:54                         ` [PATCH net] " 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=20140326150957.GB27720@unicorn.suse.cz \
    --to=mkubecek@suse.cz \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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).