From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: [PATCH net-next v2 02/21] net: Handle null dst in rtnl_put_cacheinfo Date: Tue, 17 Apr 2018 17:33:08 -0700 Message-ID: <20180418003327.19992-3-dsahern@gmail.com> References: <20180418003327.19992-1-dsahern@gmail.com> 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 To: netdev@vger.kernel.org Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:34721 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752965AbeDRAdh (ORCPT ); Tue, 17 Apr 2018 20:33:37 -0400 Received: by mail-pl0-f66.google.com with SMTP id z12-v6so28463plo.1 for ; Tue, 17 Apr 2018 17:33:37 -0700 (PDT) In-Reply-To: <20180418003327.19992-1-dsahern@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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