netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@idosch.org,
	roopa@cumulusnetworks.com, eric.dumazet@gmail.com,
	weiwan@google.com, kafai@fb.com, yoshfuji@linux-ipv6.org,
	David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 02/21] net: Handle null dst in rtnl_put_cacheinfo
Date: Mon, 16 Apr 2018 08:22:36 -0700	[thread overview]
Message-ID: <20180416152255.2256-3-dsahern@gmail.com> (raw)
In-Reply-To: <20180416152255.2256-1-dsahern@gmail.com>

Need to keep expires time for IPv6 routes in a dump of FIB entries.
Update rtnl_put_cacheinfo to allow dst to be NULL in which case
rta_cacheinfo will only contain non-dst data.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 net/core/rtnetlink.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 45936922d7e2..80802546c279 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -785,13 +785,15 @@ int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id,
 		       long expires, u32 error)
 {
 	struct rta_cacheinfo ci = {
-		.rta_lastuse = jiffies_delta_to_clock_t(jiffies - dst->lastuse),
-		.rta_used = dst->__use,
-		.rta_clntref = atomic_read(&(dst->__refcnt)),
 		.rta_error = error,
 		.rta_id =  id,
 	};
 
+	if (dst) {
+		ci.rta_lastuse = jiffies_delta_to_clock_t(jiffies - dst->lastuse);
+		ci.rta_used = dst->__use;
+		ci.rta_clntref = atomic_read(&dst->__refcnt);
+	}
 	if (expires) {
 		unsigned long clock;
 
-- 
2.11.0

  parent reply	other threads:[~2018-04-16 15:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 15:22 [PATCH net-next 00/21] net/ipv6: Separate data structures for FIB and data path David Ahern
2018-04-16 15:22 ` [PATCH net-next 01/21] net: Move fib_convert_metrics to metrics file David Ahern
2018-04-16 15:22 ` David Ahern [this message]
2018-04-16 15:22 ` [PATCH net-next 03/21] vrf: Move fib6_table into net_vrf David Ahern
2018-04-16 15:22 ` [PATCH net-next 04/21] net/ipv6: Pass net to fib6_update_sernum David Ahern
2018-04-16 15:22 ` [PATCH net-next 05/21] net/ipv6: Pass net namespace to route functions David Ahern
2018-04-16 15:22 ` [PATCH net-next 06/21] net/ipv6: Move support functions up in route.c David Ahern
2018-04-16 15:22 ` [PATCH net-next 07/21] net/ipv6: Save route type in rt6_info David Ahern
2018-04-16 19:20   ` David Miller
2018-04-16 19:26     ` David Ahern
2018-04-16 19:50     ` David Ahern
2018-04-16 19:55       ` David Miller
2018-04-16 15:22 ` [PATCH net-next 08/21] net/ipv6: Move nexthop data to fib6_nh David Ahern
2018-04-16 15:22 ` [PATCH net-next 09/21] net/ipv6: Defer initialization of dst to data path David Ahern
2018-04-16 15:22 ` [PATCH net-next 10/21] net/ipv6: move metrics from dst to rt6_info David Ahern
2018-04-16 15:22 ` [PATCH net-next 11/21] net/ipv6: move expires into rt6_info David Ahern
2018-04-16 15:22 ` [PATCH net-next 12/21] net/ipv6: Add fib6_null_entry David Ahern
2018-04-16 15:22 ` [PATCH net-next 13/21] net/ipv6: Add rt6_info create function for ip6_pol_route_lookup David Ahern
2018-04-16 15:22 ` [PATCH net-next 14/21] net/ipv6: Move dst flags to booleans in fib entries David Ahern
2018-04-16 15:22 ` [PATCH net-next 15/21] net/ipv6: Create a neigh_lookup for FIB entries David Ahern
2018-04-16 15:22 ` [PATCH net-next 16/21] net/ipv6: Add gfp_flags to route add functions David Ahern
2018-04-16 15:22 ` [PATCH net-next 17/21] net/ipv6: Cleanup exception and cache route handling David Ahern
2018-04-16 15:22 ` [PATCH net-next 18/21] net/ipv6: introduce fib6_info struct and helpers David Ahern
2018-04-16 15:22 ` [PATCH net-next 19/21] net/ipv6: separate handling of FIB entries from dst based routes David Ahern
2018-04-16 15:22 ` [PATCH net-next 20/21] net/ipv6: Flip FIB entries to fib6_info David Ahern
2018-04-16 15:22 ` [PATCH net-next 21/21] net/ipv6: Remove unused code and variables for rt6_info David Ahern

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=20180416152255.2256-3-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=idosch@idosch.org \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=weiwan@google.com \
    --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).