2021-08-05 15:41:12

by Gokul Sivakumar

[permalink] [raw]
Subject: [PATCH 2/2] iw: mesh: add new cmd to dump all the supported mesh config params at once

The function print_mesh_param_handler() already supports printing all the
mesh config params when not pasing one specific parameter, so add a new
"mesh_param dump" command to help the user see all the parameters at once.

$ iw dev mesh0 mesh_param dump
mesh_retry_timeout = 100 milliseconds
mesh_confirm_timeout = 100 milliseconds
mesh_holding_timeout = 100 milliseconds
mesh_max_peer_links = 99
mesh_max_retries = 3
mesh_ttl = 31
mesh_element_ttl = 31
mesh_auto_open_plinks = 0
mesh_hwmp_max_preq_retries = 4
mesh_path_refresh_time = 1000 milliseconds
mesh_min_discovery_timeout = 100 milliseconds
mesh_hwmp_active_path_timeout = 5000 TUs
mesh_hwmp_preq_min_interval = 10 TUs
mesh_hwmp_net_diameter_traversal_time = 50 TUs
mesh_hwmp_rootmode = 0
mesh_hwmp_rann_interval = 5000 TUs
mesh_gate_announcements = 0
mesh_fwding = 1
mesh_sync_offset_max_neighor = 50
mesh_rssi_threshold = 0 dBm
mesh_hwmp_active_path_to_root_timeout = 6000 TUs
mesh_hwmp_root_interval = 5000 TUs
mesh_hwmp_confirmation_interval = 2000 TUs
mesh_power_mode = active
mesh_awake_window = 10 TUs
mesh_plink_timeout = 0 seconds
mesh_connected_to_gate = 0

Signed-off-by: Gokul Sivakumar <[email protected]>
---
mesh.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/mesh.c b/mesh.c
index 3797335..943edf5 100644
--- a/mesh.c
+++ b/mesh.c
@@ -11,6 +11,7 @@
#include "iw.h"

SECTION(mesh);
+SECTION(mesh_param);


typedef struct _any_t {
@@ -447,6 +448,19 @@ COMMAND(get, mesh_param, "[<param>]",
NL80211_CMD_GET_MESH_PARAMS, 0, CIB_NETDEV, get_interface_meshparam,
"Retrieve mesh parameter (run command without any to see available ones).");

+static int dump_interface_meshparam(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ register_handler(print_mesh_param_handler, NULL);
+ return 0;
+}
+
+COMMAND(mesh_param, dump, "",
+ NL80211_CMD_GET_MESH_PARAMS, 0, CIB_NETDEV, dump_interface_meshparam,
+ "List all supported mesh parameters");
+
static int join_mesh(struct nl80211_state *state,
struct nl_msg *msg, int argc, char **argv,
enum id_input id)
--
2.25.1