All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 net-next] ipmroute: add support for age dumping
@ 2016-09-21  9:45 Nikolay Aleksandrov
  2016-10-10  2:10 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Aleksandrov @ 2016-09-21  9:45 UTC (permalink / raw)
  To: netdev; +Cc: roopa, anuradhak, stephen, Nikolay Aleksandrov

Add support to dump the mroute cache entry age if the show_stats (-s)
switch is provided.
Example:
$ ip -s mroute
(0.0.0.0, 239.10.10.10)          Iif: eth0       Oifs: eth0
  0 packets, 0 bytes, Age  245.44

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 ip/ipmroute.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index 133367a2388d..512afcd2086e 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -169,6 +169,13 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 			fprintf(fp, ", %"PRIu64" arrived on wrong iif.",
 				(uint64_t)mfcs->mfcs_wrong_if);
 	}
+	if (show_stats && tb[RTA_EXPIRES]) {
+		struct timeval tv;
+
+		__jiffies_to_tv(&tv, rta_getattr_u64(tb[RTA_EXPIRES]));
+		fprintf(fp, ", Age %4i.%.2i", (int)tv.tv_sec,
+			(int)tv.tv_usec/10000);
+	}
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2 net-next] ipmroute: add support for age dumping
  2016-09-21  9:45 [PATCH iproute2 net-next] ipmroute: add support for age dumping Nikolay Aleksandrov
@ 2016-10-10  2:10 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-10-10  2:10 UTC (permalink / raw)
  To: Nikolay Aleksandrov; +Cc: netdev, roopa, anuradhak

On Wed, 21 Sep 2016 11:45:58 +0200
Nikolay Aleksandrov <nikolay@cumulusnetworks.com> wrote:

> Add support to dump the mroute cache entry age if the show_stats (-s)
> switch is provided.
> Example:
> $ ip -s mroute
> (0.0.0.0, 239.10.10.10)          Iif: eth0       Oifs: eth0
>   0 packets, 0 bytes, Age  245.44
> 
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Applied to net-next (pending for 4.9)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-10  2:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21  9:45 [PATCH iproute2 net-next] ipmroute: add support for age dumping Nikolay Aleksandrov
2016-10-10  2:10 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.