This allows the setting of * Path selection protocol ID * Path selection metric ID * Congestion control mode ID Signed-off-by: Florian Sesser <flomaillist@xxxxxxxxxxxxx> --- mesh.c | 29 +++++++++++++++++++++++++++++ nl80211.h | 3 +++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/mesh.c b/mesh.c index f663363..e790175 100644 --- a/mesh.c +++ b/mesh.c @@ -93,6 +93,18 @@ static uint32_t _parse_u32(const char *str, _any *ret) return 0; } +static uint32_t _parse_hex_u32(const char *str, _any *ret) +{ + char *endptr = NULL; + long long int v = strtoll(str, &endptr, 16); + if (*endptr != '\0') + return 0xffffffff; + if ((v < 0) || (v > 0xffffffff)) + return 0xffffffff; + ret->u.as_32 = (uint32_t)v; + return 0; +} + static void _print_u8(struct nlattr *a) { printf("%d", nla_get_u8(a)); @@ -123,6 +135,11 @@ static void _print_u32_in_TUs(struct nlattr *a) printf("%d TUs", nla_get_u32(a)); } +void _print_u32_as_hex(struct nlattr *a) +{ + printf("%08X", nla_get_u32(a)); +} + /* The current mesh parameters */ const static struct mesh_param_descr _mesh_param_descrs[] = { @@ -165,6 +182,15 @@ const static struct mesh_param_descr _mesh_param_descrs[] = {"mesh_hwmp_net_diameter_traversal_time", NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, _my_nla_put_u16, _parse_u16, _print_u16_in_TUs}, + {"mesh_path_selection_protocol_id", + NL80211_MESHCONF_PATH_SELECTION_PROTOCOL_ID, + _my_nla_put_u32, _parse_hex_u32, _print_u32_as_hex}, + {"mesh_path_selection_metric_id", + NL80211_MESHCONF_PATH_SELECTION_METRIC_ID, + _my_nla_put_u32, _parse_hex_u32, _print_u32_as_hex}, + {"mesh_congestion_control_mode_id", + NL80211_MESHCONF_CONGESTION_CONTROL_MODE_ID, + _my_nla_put_u32, _parse_hex_u32, _print_u32_as_hex}, }; static void print_all_mesh_param_descr(void) @@ -187,6 +213,9 @@ static const struct mesh_param_descr* find_mesh_param(int argc, char **argv, if (argc < 1) { printf("You must specify which mesh parameter to %s.\n", action_name); + printf("Mesh_param must be one of: "); + print_all_mesh_param_descr(); + printf("\n"); return NULL; } diff --git a/nl80211.h b/nl80211.h index e86ed59..db0fe93 100644 --- a/nl80211.h +++ b/nl80211.h @@ -765,6 +765,9 @@ enum nl80211_meshconf_params { NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, + NL80211_MESHCONF_PATH_SELECTION_PROTOCOL_ID, + NL80211_MESHCONF_PATH_SELECTION_METRIC_ID, + NL80211_MESHCONF_CONGESTION_CONTROL_MODE_ID, /* keep last */ __NL80211_MESHCONF_ATTR_AFTER_LAST, -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html