Repository : ssh://git@diktynna/batctl
On branch : master
commit 20086d207940f3dd2d01a8f313316d93bccae932 Author: Alexander Sarmanow asarmanow@gmail.com Date: Thu May 13 16:28:12 2021 +0200
batctl: Add transtable_local_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
20086d207940f3dd2d01a8f313316d93bccae932 Makefile | 1 + README.rst | 97 +++++++++++++++++++++++++++++ man/batctl.8 | 3 + neighbors_json.c => transtable_local_json.c | 8 +-- 4 files changed, 105 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 1d5d6fa..15a88a5 100755 --- a/Makefile +++ b/Makefile @@ -83,6 +83,7 @@ $(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)) +$(eval $(call add_command,transtable_local_json,y))
MANPAGE = man/batctl.8
diff --git a/README.rst b/README.rst index 4e37771..9346378 100644 --- a/README.rst +++ b/README.rst @@ -1187,6 +1187,103 @@ Example:: [...]
+batctl transtable_local_json +---------------------------- + +Query batman-adv for the entries in the (mac-to-originator) translation +table for locally detected MAC addresses. + +Usage:: + + batctl meshif <netdev> transtable_local_json|tgj + +Example:: + + $ batctl meshif bat0 transtable_local_json + [ + { + "tt_address": "3e:dc:94:68:80:e8", + "tt_crc32": 3361904636, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": true, + "pending": false, + "raw": 256, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_vid": -1 + }, + { + "tt_address": "3e:dc:94:68:80:e8", + "tt_crc32": 1436598566, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": true, + "pending": false, + "raw": 256, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_vid": 0 + }, + { + "tt_address": "01:00:5e:00:00:01", + "tt_crc32": 3361904636, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": true, + "pending": false, + "raw": 256, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_vid": -1 + }, + { + "tt_address": "33:33:ff:68:80:e8", + "tt_crc32": 3361904636, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": true, + "pending": false, + "raw": 256, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_vid": -1 + }, + { + "tt_address": "33:33:00:00:00:01", + "tt_crc32": 3361904636, + "tt_flags": { + "del": false, + "isolated": false, + "new": false, + "nopurge": true, + "pending": false, + "raw": 256, + "roam": false, + "temp": false, + "wifi": false + }, + "tt_vid": -1 + } + ] + + Advanced Analytics ==================
diff --git a/man/batctl.8 b/man/batctl.8 index 79f7437..6abeb08 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -339,6 +339,9 @@ List of available JSON queries: - transtable_global_json|tgj .RE .RE +- transtable_local_json|tlj +.RE +.RS 10 .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_local_json.c similarity index 57% copy from neighbors_json.c copy to transtable_local_json.c index 6c9bdc3..0b2f124 100644 --- a/neighbors_json.c +++ b/transtable_local_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_local = { .nlm_flags = NLM_F_DUMP, - .cmd = BATADV_CMD_GET_NEIGHBORS, + .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, };
-COMMAND_NAMED(JSON_MIF, neighbors_json, "nj", handle_json_query, +COMMAND_NAMED(JSON_MIF, transtable_local_json, "tlj", handle_json_query, COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK, - &batctl_json_query_neighbors, ""); + &batctl_json_query_transtable_local, "");