From 0498e6a433e23cfc6e3b6397328019d5d6cd9973 Mon Sep 17 00:00:00 2001 From: Steven Xu Date: Mon, 17 May 2021 19:12:22 +1000 Subject: [PATCH] feat: make `gw_iface` work with `downspeedgraph` & `upspeedgraph`, e.g. `${downspeedgraph ${gw_iface}}` --- src/net_stat.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net_stat.cc b/src/net_stat.cc index 9673ac7b..9e889f61 100644 --- a/src/net_stat.cc +++ b/src/net_stat.cc @@ -335,6 +335,14 @@ void parse_net_stat_graph_arg(struct text_object *obj, const char *arg, // default to DEFAULTNETDEV if (buf != nullptr) { +#if defined(__linux__) + if (0 == (strcmp("$gw_iface", buf)) || 0 == (strcmp("${gw_iface}", buf))) { + update_gateway_info(); + obj->data.opaque = get_net_stat(e_iface, obj, free_at_crash); + free(buf); + return; + } +#endif obj->data.opaque = get_net_stat(buf, obj, free_at_crash); free(buf); return;