[PATCH 2/2] mesh: Make NL80211_MESHCONF_RSSI_THRESHOLD configurable

Jouni Malinen j at w1.fi
Wed Mar 29 05:02:53 PDT 2017


On Thu, Mar 16, 2017 at 10:59:41AM +0900, Masashi Honma wrote:
> On some practical cases, it is useful to suppress joining to node in the
> distance. The new field mesh_rssi_threshold could be used as RSSI
> threshold for joining. This patch requires kernel modification patch
> provided by us.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> index bceeba2..cd1b5b9 100644
> --- a/src/drivers/driver_nl80211.c
> +++ b/src/drivers/driver_nl80211.c
> @@ -8774,7 +8774,10 @@ static int nl80211_put_mesh_config(struct nl_msg *msg,
>  			 params->auto_plinks)) ||
>  	    ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) &&
>  	     nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
> -			 params->max_peer_links)))
> +			 params->max_peer_links)) ||
> +	    ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD) &&
> +	     nla_put_s32(msg, NL80211_MESHCONF_RSSI_THRESHOLD,
> +			 params->rssi_threshold)))
>  		return -1;

nla_put_s32() is a recent addition to libnl and this would break builds
with most released versions.. Can we use nla_put_u32 instead()? Or add a
backwards compatibility wrapper for this?

> @@ -8847,6 +8850,7 @@ static int nl80211_join_mesh(struct i802_bss *bss,
>  	params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS;
>  	params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT;
>  	params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS;
> +	params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD;
>  	if (nl80211_put_mesh_config(msg, &params->conf) < 0)

Would it be better to add WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD only
if the configuration value is actually set? This would leave the current
behavior of kernel using its default value (which may happen to be the
same as the default in wpa_supplicant) more consistent rather than
moving this to be enforced by whatever the wpa_supplicant default value
is.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list