9ee60b1a63ca485ce6c6fa9c6ee0172457e78545
[oweals/openwrt.git] / package / network / services / hostapd / patches / 463-add-mcast_rate-to-11s.patch
1 From: Sven Eckelmann <sven.eckelmann@openmesh.com>
2 Date: Thu, 11 May 2017 08:21:45 +0200
3 Subject: [PATCH] set mcast_rate in mesh mode
4
5 The wpa_supplicant code for IBSS allows to set the mcast rate. It is
6 recommended to increase this value from 1 or 6 Mbit/s to something higher
7 when using a mesh protocol on top which uses the multicast packet loss as
8 indicator for the link quality.
9
10 This setting was unfortunately not applied for mesh mode. But it would be
11 beneficial when wpa_supplicant would behave similar to IBSS mode and set
12 this argument during mesh join like authsae already does. At least it is
13 helpful for companies/projects which are currently switching to 802.11s
14 (without mesh_fwding and with mesh_ttl set to 1) as replacement for IBSS
15 because newer drivers seem to support 802.11s but not IBSS anymore.
16
17 Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
18 Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
19
20 --- a/src/drivers/driver.h
21 +++ b/src/drivers/driver.h
22 @@ -1546,6 +1546,7 @@ struct wpa_driver_mesh_join_params {
23  #define WPA_DRIVER_MESH_FLAG_SAE_AUTH  0x00000004
24  #define WPA_DRIVER_MESH_FLAG_AMPE      0x00000008
25         unsigned int flags;
26 +       int mcast_rate;
27  };
28  
29  struct wpa_driver_set_key_params {
30 --- a/src/drivers/driver_nl80211.c
31 +++ b/src/drivers/driver_nl80211.c
32 @@ -9959,6 +9959,18 @@ static int nl80211_put_mesh_id(struct nl
33  }
34  
35  
36 +static int nl80211_put_mcast_rate(struct nl_msg *msg, int mcast_rate)
37 +{
38 +       if (mcast_rate > 0) {
39 +               wpa_printf(MSG_DEBUG, "  * mcast_rate=%.1f",
40 +                          (double)mcast_rate / 10);
41 +               return nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, mcast_rate);
42 +       }
43 +
44 +       return 0;
45 +}
46 +
47 +
48  static int nl80211_put_mesh_config(struct nl_msg *msg,
49                                    struct wpa_driver_mesh_bss_params *params)
50  {
51 @@ -10017,6 +10029,7 @@ static int nl80211_join_mesh(struct i802
52             nl80211_put_basic_rates(msg, params->basic_rates) ||
53             nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
54             nl80211_put_beacon_int(msg, params->beacon_int) ||
55 +           nl80211_put_mcast_rate(msg, params->mcast_rate) ||
56             nl80211_put_dtim_period(msg, params->dtim_period))
57                 goto fail;
58  
59 --- a/wpa_supplicant/mesh.c
60 +++ b/wpa_supplicant/mesh.c
61 @@ -460,6 +460,7 @@ int wpa_supplicant_join_mesh(struct wpa_
62  
63         params->meshid = ssid->ssid;
64         params->meshid_len = ssid->ssid_len;
65 +       params->mcast_rate = ssid->mcast_rate;
66         ibss_mesh_setup_freq(wpa_s, ssid, &params->freq);
67         wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled;
68         wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled;