From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] ipv6: shouldn't dump the expired routes
Date: Thu, 26 Dec 2013 14:00:25 +0800 [thread overview]
Message-ID: <52BBC5F9.4050904@cn.fujitsu.com> (raw)
If we execute the command "ip -6 route show table all", those routes
that have been expired will be dumped. But as everyone knows, those
expired routes will not be used, and they will be deleted by the kernel.
So why we still need to dump they, and just don't dump them.
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
include/net/ip6_route.h | 2 ++
net/ipv6/ip6_fib.c | 3 +++
net/ipv6/route.c | 2 +-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index c2626ce..32fa188 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -103,6 +103,8 @@ void fib6_force_start_gc(struct net *net);
struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
const struct in6_addr *addr, bool anycast);
+bool rt6_check_expired(const struct rt6_info *rt);
+
/*
* support functions for ND
*
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 5550a81..f57a6bb 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -278,6 +278,9 @@ static int fib6_dump_node(struct fib6_walker_t *w)
struct rt6_info *rt;
for (rt = w->leaf; rt; rt = rt->dst.rt6_next) {
+ if (rt6_check_expired(rt))
+ continue;
+
res = rt6_dump_route(rt, w->args);
if (res < 0) {
/* Frame is full, suspend walking */
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 89b2735..abf5f05 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -348,7 +348,7 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
}
}
-static bool rt6_check_expired(const struct rt6_info *rt)
+bool rt6_check_expired(const struct rt6_info *rt)
{
if (rt->rt6i_flags & RTF_EXPIRES) {
if (time_after(jiffies, rt->dst.expires))
--
1.8.3.1
next reply other threads:[~2013-12-26 6:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-26 6:00 Duan Jiong [this message]
2013-12-26 17:48 ` [PATCH] ipv6: shouldn't dump the expired routes Stephen Hemminger
2013-12-31 21:01 ` 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=52BBC5F9.4050904@cn.fujitsu.com \
--to=duanj.fnst@cn.fujitsu.com \
--cc=davem@davemloft.net \
--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).