kernel/modules: snd-pcm-dmaengine only if CONFIG_SND_DMAENGINE_PCM is set
[openwrt/svn-archive/archive.git] / package / network / services / hostapd / patches / 450-reload_freq_change.patch
1 --- a/src/ap/hostapd.c
2 +++ b/src/ap/hostapd.c
3 @@ -133,38 +133,51 @@ static void hostapd_clear_old(struct hos
4 int hostapd_reload_config(struct hostapd_iface *iface)
5 {
6 struct hostapd_data *hapd = iface->bss[0];
7 - struct hostapd_config *newconf, *oldconf;
8 + struct hostapd_config *conf = hapd->iconf, *oldconf = NULL;
9 size_t j;
10
11 - if (iface->config_fname == NULL) {
12 - /* Only in-memory config in use - assume it has been updated */
13 + if (iface->config_fname) {
14 + if (iface->interfaces == NULL ||
15 + iface->interfaces->config_read_cb == NULL)
16 + return -1;
17 + conf = iface->interfaces->config_read_cb(iface->config_fname);
18 + if (conf == NULL)
19 + return -1;
20 +
21 hostapd_clear_old(iface);
22 - for (j = 0; j < iface->num_bss; j++)
23 - hostapd_reload_bss(iface->bss[j]);
24 - return 0;
25 - }
26
27 - if (iface->interfaces == NULL ||
28 - iface->interfaces->config_read_cb == NULL)
29 - return -1;
30 - newconf = iface->interfaces->config_read_cb(iface->config_fname);
31 - if (newconf == NULL)
32 - return -1;
33 + oldconf = hapd->iconf;
34 + iface->conf = conf;
35 + }
36
37 - hostapd_clear_old(iface);
38 + hostapd_select_hw_mode(iface);
39 + iface->freq = hostapd_hw_get_freq(hapd, conf->channel);
40
41 - oldconf = hapd->iconf;
42 - iface->conf = newconf;
43 + if (iface->current_mode)
44 + hostapd_prepare_rates(iface, iface->current_mode);
45
46 for (j = 0; j < iface->num_bss; j++) {
47 hapd = iface->bss[j];
48 - hapd->iconf = newconf;
49 - hapd->conf = &newconf->bss[j];
50 + hapd->iconf = iface->conf;
51 + hapd->conf = &iface->conf->bss[j];
52 +
53 + if (hostapd_set_freq(hapd, conf->hw_mode, iface->freq,
54 + conf->channel,
55 + conf->ieee80211n,
56 + conf->ieee80211ac,
57 + conf->secondary_channel,
58 + conf->vht_oper_chwidth,
59 + conf->vht_oper_centr_freq_seg0_idx,
60 + conf->vht_oper_centr_freq_seg1_idx)) {
61 + wpa_printf(MSG_ERROR, "Could not set channel for "
62 + "kernel driver");
63 + }
64 +
65 hostapd_reload_bss(hapd);
66 }
67
68 - hostapd_config_free(oldconf);
69 -
70 + if (oldconf)
71 + hostapd_config_free(oldconf);
72
73 return 0;
74 }
75 --- a/src/drivers/driver_nl80211.c
76 +++ b/src/drivers/driver_nl80211.c
77 @@ -6511,7 +6511,7 @@ static int wpa_driver_nl80211_set_freq(s
78
79 nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_WIPHY);
80
81 - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
82 + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
83 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq);
84 if (freq->vht_enabled) {
85 switch (freq->bandwidth) {