Repository : ssh://git@diktynna/batctl
On branch : master
commit cce68903508d85e2d1d242b046caadc4867aee58 Author: Sven Eckelmann sven@narfation.org Date: Fri May 14 16:23:03 2021 +0200
batctl: Add gateways_json command
Signed-off-by: Sven Eckelmann sven@narfation.org
cce68903508d85e2d1d242b046caadc4867aee58 Makefile | 1 + README.rst | 46 +++++++++++++++++++++++++++++++++++++ dat_cache_json.c => gateways_json.c | 8 +++---- man/batctl.8 | 3 +++ 4 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 0c91b66..091ee9d 100755 --- a/Makefile +++ b/Makefile @@ -52,6 +52,7 @@ $(eval $(call add_command,elp_interval,y)) $(eval $(call add_command,event,y)) $(eval $(call add_command,fragmentation,y)) $(eval $(call add_command,gateways,y)) +$(eval $(call add_command,gateways_json,y)) $(eval $(call add_command,gw_mode,y)) $(eval $(call add_command,hop_penalty,y)) $(eval $(call add_command,interface,y)) diff --git a/README.rst b/README.rst index a4c7ab1..6fc3e15 100644 --- a/README.rst +++ b/README.rst @@ -806,6 +806,52 @@ Example:: ]
+batctl gateways_json +-------------------- + +Query batman-adv for the entries in the gateways list. Only selected gateways +(for the gateway mode "client) will have have the key-value ``"best": true``. + +Usage:: + + batctl meshif <netdev> gateways_json|gwj + +Example:: + + $ batctl meshif bat0 gateways_json | json_pp + [ + { + "bandwidth_down": 100, + "bandwidth_up": 20, + "hard_ifindex": 3, + "hard_ifname": "enp0s1", + "orig_address": "02:62:e7:ab:01:01", + "router": "ae:1b:bf:52:25:58", + "tq": 180 + }, + { + "bandwidth_down": 100, + "bandwidth_up": 20, + "hard_ifindex": 3, + "hard_ifname": "enp0s1", + "orig_address": "02:62:e7:ab:05:01", + "router": "ae:1b:bf:52:25:58", + "tq": 180 + }, + { + "bandwidth_down": 100, + "bandwidth_up": 20, + "best": true, + "hard_ifindex": 3, + "hard_ifname": "enp0s1", + "orig_address": "02:62:e7:ab:06:01", + "router": "ae:1b:bf:52:25:58", + "tq": 236 + }, + [...] + ] + + Advanced Analytics ==================
diff --git a/dat_cache_json.c b/gateways_json.c similarity index 59% copy from dat_cache_json.c copy to gateways_json.c index 4dcefd0..3ab75da 100644 --- a/dat_cache_json.c +++ b/gateways_json.c @@ -10,11 +10,11 @@
#include "genl_json.h"
-static struct json_query_data batctl_json_query_dat_cache = { +static struct json_query_data batctl_json_query_gateways = { .nlm_flags = NLM_F_DUMP, - .cmd = BATADV_CMD_GET_DAT_CACHE, + .cmd = BATADV_CMD_GET_GATEWAYS, };
-COMMAND_NAMED(JSON_MIF, dat_cache_json, "dcj", handle_json_query, +COMMAND_NAMED(JSON_MIF, gateways_json, "gwj", handle_json_query, COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK, - &batctl_json_query_dat_cache, ""); + &batctl_json_query_gateways, ""); diff --git a/man/batctl.8 b/man/batctl.8 index dafd1bd..3fff6fc 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -314,6 +314,9 @@ List of available JSON queries: .RS 10 - dat_cache_json|dcj .RE +.RS 10 +- gateways_json|gwj +.RE .RE .br .IP "[\fBmeshif <netdev>\fP] \fBtranslate\fP|\fBt\fP \fBMAC_address\fP|\fBbat-host_name\fP|\fBhost_name\fP|\fBIP_address\fP"