From: Martin KaFai Lau <kafai@fb.com>
To: <netdev@vger.kernel.org>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>, <kernel-team@fb.com>
Subject: [RFC PATCH net-next 08/10] ipv6: Do not use inetpeer when creating RTF_CACHE route for /128 via gateway entry
Date: Fri, 10 Apr 2015 18:59:34 -0700 [thread overview]
Message-ID: <1428717576-1040383-9-git-send-email-kafai@fb.com> (raw)
In-Reply-To: <1428717576-1040383-1-git-send-email-kafai@fb.com>
When there is a pmtu exception on /128 via gateway route, we need to
create a separate metrics copy for the newly created RTF_CACHE route instead
of reusing the inetpeer cache. Otherwise, the original mtu will be
over-written and the mtu update will stay after the expiration.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
net/ipv6/route.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 91c80bc..61ce45e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -322,8 +322,16 @@ static void ip6_dst_destroy(struct dst_entry *dst)
struct rt6_info *rt = (struct rt6_info *)dst;
struct inet6_dev *idev = rt->rt6i_idev;
struct dst_entry *from = dst->from;
+ unsigned long peer_metrics = 0;
- if (!(rt->dst.flags & DST_HOST))
+ if (rt6_has_peer(rt)) {
+ struct inet_peer *peer = rt6_peer_ptr(rt);
+
+ peer_metrics = (unsigned long)peer->metrics;
+ inet_putpeer(peer);
+ }
+
+ if (peer_metrics != dst->_metrics)
dst_destroy_metrics_generic(dst);
if (idev) {
@@ -333,11 +341,6 @@ static void ip6_dst_destroy(struct dst_entry *dst)
dst->from = NULL;
dst_release(from);
-
- if (rt6_has_peer(rt)) {
- struct inet_peer *peer = rt6_peer_ptr(rt);
- inet_putpeer(peer);
- }
}
static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
@@ -1956,6 +1959,8 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,
rt->rt6i_dst.addr = *dest;
rt->rt6i_dst.plen = 128;
+ if (ort->dst.flags & DST_HOST)
+ dst_cow_metrics_generic(&rt->dst, rt->dst._metrics);
dst_copy_metrics(&rt->dst, &ort->dst);
rt->dst.error = ort->dst.error;
rt->rt6i_idev = ort->rt6i_idev;
--
1.8.1
next prev parent reply other threads:[~2015-04-11 1:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-11 1:59 [RFC PATCH net-next 00/10] ipv6: Only create RTF_CACHE route after encountering pmtu exception Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 01/10] ipv6: Remove external dependency on rt6i_dst and rt6i_src Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 02/10] ipv6: Remove external dependency on rt6i_gateway and RTF_ANYCAST Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 03/10] ipv6: Combine rt6_alloc_cow and rt6_alloc_clone Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 04/10] ipv6: Only create RTF_CACHE routes after encountering pmtu exception Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 05/10] ipv6: Allow pmtu update on /128 via gateway route Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 06/10] ipv6: Avoid deleting RTF_CACHE route from ip6_route_del() Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 07/10] ipv6: Extend the route lookups to low priority metrics Martin KaFai Lau
2015-04-11 1:59 ` Martin KaFai Lau [this message]
2015-04-13 11:06 ` [RFC PATCH net-next 08/10] ipv6: Do not use inetpeer when creating RTF_CACHE route for /128 via gateway entry Steffen Klassert
2015-04-13 17:51 ` Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 09/10] ipv6: Break up ip6_rt_copy() Martin KaFai Lau
2015-04-11 1:59 ` [RFC PATCH net-next 10/10] ipv6: Create percpu rt6_info Martin KaFai Lau
2015-04-13 10:59 ` Steffen Klassert
2015-04-13 20:16 ` Martin KaFai Lau
2015-04-13 21:46 ` Hannes Frederic Sowa
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=1428717576-1040383-9-git-send-email-kafai@fb.com \
--to=kafai@fb.com \
--cc=hannes@stressinduktion.org \
--cc=kernel-team@fb.com \
--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).