Repository : ssh://git@diktynna/batctl
On branch : master
commit 4a4c54e50d981b17d92789f76231e565a3823e3a Author: Alexander Sarmanow asarmanow@gmail.com Date: Thu May 13 16:28:11 2021 +0200
batctl: Add transtable_global_json command
Signed-off-by: Alexander Sarmanow asarmanow@gmail.com [sven@narfation.org: Reimplement with shared json query helpers] Signed-off-by: Sven Eckelmann sven@narfation.org
4a4c54e50d981b17d92789f76231e565a3823e3a Makefile | 1 + README.rst | 76 ++++++++++++++++++++++++++++ man/batctl.8 | 3 ++ neighbors_json.c => transtable_global_json.c | 8 +-- 4 files changed, 84 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index b920d01..1d5d6fa 100755 --- a/Makefile +++ b/Makefile @@ -82,6 +82,7 @@ $(eval $(call add_command,traceroute,y)) $(eval $(call add_command,transglobal,y)) $(eval $(call add_command,translate,y)) $(eval $(call add_command,translocal,y)) +$(eval $(call add_command,transtable_global_json,y))
MANPAGE = man/batctl.8
diff --git a/README.rst b/README.rst index 606739f..4e37771 100644 --- a/README.rst +++ b/README.rst @@ -1111,6 +1111,82 @@ Example:: ]
+batctl transtable_global_json +----------------------------- + +Query batman-adv for the entries in the global (mac-to-originator) translation +table. Only next best hops have the key-value ``"best": true``. + +Usage:: + + batctl meshif <netdev> transtable_global_json|tgj + +Example:: + + $ batctl meshif bat0 transtable_global_json + [ + { + "best": true, + "orig_address": "ea:88:36:b0:fa:4b", + "tt_address": "1e:df:a8:43:c4:d5", + "tt_crc32": 3191293109, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": false, + "pending": false, + "raw": 2048, + "roam": false, + "temp": true, + "wifi": false + }, + "tt_last_ttvn": 255, + "tt_ttvn": 255, + "tt_vid": -1 + }, + { + "best": true, + "orig_address": "6a:d0:7f:eb:86:83", + "tt_address": "01:00:5e:7f:ff:fa", + "tt_crc32": 2358926211, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": false, + "pending": false, + "raw": 0, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_last_ttvn": 246, + "tt_ttvn": 245, + "tt_vid": -1 + }, + { + "orig_address": "0e:68:8c:7c:0f:1b", + "tt_address": "01:00:5e:7f:ff:fa", + "tt_crc32": 1334456817, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": false, + "pending": false, + "raw": 0, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_last_ttvn": 21, + "tt_ttvn": 20, + "tt_vid": -1 + }, + [...] + + Advanced Analytics ==================
diff --git a/man/batctl.8 b/man/batctl.8 index 3b50dc0..79f7437 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -335,6 +335,9 @@ List of available JSON queries: .RS 10 - originators_json|oj .RE +.RS 10 +- transtable_global_json|tgj +.RE .RE .br .IP "[\fBmeshif <netdev>\fP] \fBtranslate\fP|\fBt\fP \fBMAC_address\fP|\fBbat-host_name\fP|\fBhost_name\fP|\fBIP_address\fP" diff --git a/neighbors_json.c b/transtable_global_json.c similarity index 56% copy from neighbors_json.c copy to transtable_global_json.c index 6c9bdc3..9691401 100644 --- a/neighbors_json.c +++ b/transtable_global_json.c @@ -10,11 +10,11 @@
#include "genl_json.h"
-static struct json_query_data batctl_json_query_neighbors = { +static struct json_query_data batctl_json_query_transtable_global = { .nlm_flags = NLM_F_DUMP, - .cmd = BATADV_CMD_GET_NEIGHBORS, + .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, };
-COMMAND_NAMED(JSON_MIF, neighbors_json, "nj", handle_json_query, +COMMAND_NAMED(JSON_MIF, transtable_global_json, "tgj", handle_json_query, COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK, - &batctl_json_query_neighbors, ""); + &batctl_json_query_transtable_global, "");