Repository : ssh://git@diktynna/batctl
On branch : master
commit 45eb2ac69d64c6c6d2c93aaf497ca52b3f4bf3d1 Author: Alexander Sarmanow asarmanow@gmail.com Date: Thu May 13 16:28:09 2021 +0200
batctl: Add originators_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
45eb2ac69d64c6c6d2c93aaf497ca52b3f4bf3d1 Makefile | 1 + README.rst | 45 ++++++++++++++++++++++++++++++++++ man/batctl.8 | 3 +++ neighbors_json.c => originators_json.c | 8 +++--- 4 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 97790ce..b920d01 100755 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ $(eval $(call add_command,neighbors_json,y)) $(eval $(call add_command,network_coding,y)) $(eval $(call add_command,orig_interval,y)) $(eval $(call add_command,originators,y)) +$(eval $(call add_command,originators_json,y)) $(eval $(call add_command,ping,y)) $(eval $(call add_command,routing_algo,y)) $(eval $(call add_command,statistics,y)) diff --git a/README.rst b/README.rst index ce22087..606739f 100644 --- a/README.rst +++ b/README.rst @@ -1066,6 +1066,51 @@ Example:: ]
+batctl originators_json +----------------------- + +Query batman-adv for the entries in the originators table. The table doesn't +only contain the list of best next hops but also all other known entries. +Only next best hops have the key-value ``"best": true``. + +Usage:: + + batctl meshif <netdev> originators_json|oj + +Example:: + + $ batctl meshif bat0 originators_json | json_pp + [ + { + "hard_ifindex": 3, + "hard_ifname": "enp0s1", + "last_seen_msecs": 4380, + "neigh_address": "ae:1b:bf:52:25:58", + "orig_address": "16:7b:3c:c2:bf:b8", + "tq": 236 + }, + { + "best": true, + "hard_ifindex": 3, + "hard_ifname": "enp0s1", + "last_seen_msecs": 4380, + "neigh_address": "16:7b:3c:c2:bf:b8", + "orig_address": "16:7b:3c:c2:bf:b8", + "tq": 251 + }, + [...] + { + "best": true, + "hard_ifindex": 3, + "hard_ifname": "enp0s1", + "last_seen_msecs": 4728, + "neigh_address": "ae:1b:bf:52:25:58", + "orig_address": "12:6d:7d:6f:f9:03", + "tq": 77 + } + ] + + Advanced Analytics ==================
diff --git a/man/batctl.8 b/man/batctl.8 index 826d21c..3b50dc0 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -332,6 +332,9 @@ List of available JSON queries: .RS 10 - neighbors_json|nj .RE +.RS 10 +- originators_json|oj +.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/originators_json.c similarity index 59% copy from neighbors_json.c copy to originators_json.c index 6c9bdc3..5617029 100644 --- a/neighbors_json.c +++ b/originators_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_originators = { .nlm_flags = NLM_F_DUMP, - .cmd = BATADV_CMD_GET_NEIGHBORS, + .cmd = BATADV_CMD_GET_ORIGINATORS, };
-COMMAND_NAMED(JSON_MIF, neighbors_json, "nj", handle_json_query, +COMMAND_NAMED(JSON_MIF, originators_json, "oj", handle_json_query, COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK, - &batctl_json_query_neighbors, ""); + &batctl_json_query_originators, "");