Repository : ssh://git@diktynna/batctl
On branch : master
commit 35d8327f9d983961d4d6b7346712974f52b6d457 Author: Sven Eckelmann sven@narfation.org Date: Fri May 14 18:01:03 2021 +0200
batctl: Add vlan_json command
Signed-off-by: Sven Eckelmann sven@narfation.org
35d8327f9d983961d4d6b7346712974f52b6d457 Makefile | 1 + README.rst | 28 ++++++++++++++++++++++++++++ genl_json.c | 2 +- man/batctl.8 | 3 +++ mesh_json.c => vlan_json.c | 8 ++++---- 5 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index 15a88a5..c1212c4 100755 --- a/Makefile +++ b/Makefile @@ -84,6 +84,7 @@ $(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)) +$(eval $(call add_command,vlan_json,y))
MANPAGE = man/batctl.8
diff --git a/README.rst b/README.rst index 9346378..606d557 100644 --- a/README.rst +++ b/README.rst @@ -1284,6 +1284,34 @@ Example:: ]
+batctl vlan_json +---------------- + +Read the vlan state for an vlan on top a batman-adv interface. + +Usage:: + + batctl meshif <netdev> vid <vid> vlan_json|vj + batctl vlan <vdev> vlan_json|vj + +Example:: + + $ batctl meshif bat0 vid 0 vlan_json + { + "ap_isolation_enabled": false, + "mesh_ifindex": 9, + "mesh_ifname": "bat0", + "vlanid": 0 + } + + $ batctl vlan bat0.1 vlan_json + { + "ap_isolation_enabled": false, + "mesh_ifindex": 9, + "mesh_ifname": "bat0", + "vlanid": 1 + } + Advanced Analytics ==================
diff --git a/genl_json.c b/genl_json.c index 9bdfcd5..460838b 100644 --- a/genl_json.c +++ b/genl_json.c @@ -383,7 +383,7 @@ static const struct nla_policy_json batadv_genl_json[NUM_BATADV_ATTR] = { }, [BATADV_ATTR_VLANID] = { .name = "vlanid", - .cb = nljson_print_vlanid, + .cb = nljson_print_uint16, }, [BATADV_ATTR_AGGREGATED_OGMS_ENABLED] = { .name = "aggregated_ogms_enabled", diff --git a/man/batctl.8 b/man/batctl.8 index 6abeb08..80077bb 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -341,6 +341,9 @@ List of available JSON queries: .RE - transtable_local_json|tlj .RE +.RE +- vlan_json|vj +.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/mesh_json.c b/vlan_json.c similarity index 61% copy from mesh_json.c copy to vlan_json.c index 47bba11..e1f7fab 100644 --- a/mesh_json.c +++ b/vlan_json.c @@ -10,11 +10,11 @@
#include "genl_json.h"
-static struct json_query_data batctl_json_query_mesh = { +static struct json_query_data batctl_json_query_vlan = { .nlm_flags = 0, - .cmd = BATADV_CMD_GET_MESH, + .cmd = BATADV_CMD_GET_VLAN, };
-COMMAND_NAMED(JSON_MIF, mesh_json, "mj", handle_json_query, +COMMAND_NAMED(JSON_VID, vlan_json, "vj", handle_json_query, COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK, - &batctl_json_query_mesh, ""); + &batctl_json_query_vlan, "");