| package/hostapd/patches/510-multicall.patch |
| 132 | 132 | wpa_cli.exe: wpa_cli |
| 133 | 133 | --- a/src/drivers/driver.h |
| 134 | 134 | +++ b/src/drivers/driver.h |
| 135 | | @@ -3186,8 +3186,8 @@ union wpa_event_data { |
| 135 | @@ -3187,8 +3187,8 @@ union wpa_event_data { |
| 136 | 136 | * Driver wrapper code should call this function whenever an event is received |
| 137 | 137 | * from the driver. |
| 138 | 138 | */ |
| ... | ... | |
| 145 | 145 | /* |
| 146 | 146 | --- a/src/ap/drv_callbacks.c |
| 147 | 147 | +++ b/src/ap/drv_callbacks.c |
| 148 | | @@ -443,8 +443,8 @@ static void hostapd_event_eapol_rx(struc |
| 148 | @@ -448,8 +448,8 @@ static void hostapd_event_eapol_rx(struc |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
| ... | ... | |
| 179 | 179 | for (;;) { |
| 180 | 180 | --- a/wpa_supplicant/events.c |
| 181 | 181 | +++ b/wpa_supplicant/events.c |
| 182 | | @@ -1734,8 +1734,8 @@ static void wpa_supplicant_event_unprot_ |
| 182 | @@ -1741,8 +1741,8 @@ static void wpa_supplicant_event_unprot_ |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
| ... | ... | |
| 192 | 192 | u16 reason_code = 0; |
| 193 | 193 | --- a/wpa_supplicant/wpa_supplicant.c |
| 194 | 194 | +++ b/wpa_supplicant/wpa_supplicant.c |
| 195 | | @@ -2311,6 +2311,9 @@ static void wpa_supplicant_deinit_iface( |
| 195 | @@ -2314,6 +2314,9 @@ static void wpa_supplicant_deinit_iface( |
| 196 | 196 | wpa_drv_deinit(wpa_s); |
| 197 | 197 | } |
| 198 | 198 | |
| ... | ... | |
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * wpa_supplicant_add_iface - Add a new network interface |
| 205 | | @@ -2494,6 +2497,7 @@ struct wpa_global * wpa_supplicant_init( |
| 205 | @@ -2497,6 +2500,7 @@ struct wpa_global * wpa_supplicant_init( |
| 206 | 206 | wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); |
| 207 | 207 | #endif /* CONFIG_NO_WPA_MSG */ |
| 208 | 208 | |
| package/hostapd/patches/560-disable_ctrl_iface_mib.patch |
| 55 | 55 | |
| 56 | 56 | --- a/wpa_supplicant/ctrl_iface.c |
| 57 | 57 | +++ b/wpa_supplicant/ctrl_iface.c |
| 58 | | @@ -2896,6 +2896,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 58 | @@ -2927,6 +2927,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 59 | 59 | reply_len = -1; |
| 60 | 60 | } else if (os_strncmp(buf, "NOTE ", 5) == 0) { |
| 61 | 61 | wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); |
| ... | ... | |
| 63 | 63 | } else if (os_strcmp(buf, "MIB") == 0) { |
| 64 | 64 | reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); |
| 65 | 65 | if (reply_len >= 0) { |
| 66 | | @@ -2907,6 +2908,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 66 | @@ -2938,6 +2939,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 67 | 67 | else |
| 68 | 68 | reply_len += res; |
| 69 | 69 | } |
| ... | ... | |
| 71 | 71 | } else if (os_strncmp(buf, "STATUS", 6) == 0) { |
| 72 | 72 | reply_len = wpa_supplicant_ctrl_iface_status( |
| 73 | 73 | wpa_s, buf + 6, reply, reply_size); |
| 74 | | @@ -3200,6 +3202,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 74 | @@ -3243,6 +3245,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 75 | 75 | reply_len = wpa_supplicant_ctrl_iface_bss( |
| 76 | 76 | wpa_s, buf + 4, reply, reply_size); |
| 77 | 77 | #ifdef CONFIG_AP |
| ... | ... | |
| 79 | 79 | } else if (os_strcmp(buf, "STA-FIRST") == 0) { |
| 80 | 80 | reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); |
| 81 | 81 | } else if (os_strncmp(buf, "STA ", 4) == 0) { |
| 82 | | @@ -3208,6 +3211,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 82 | @@ -3251,6 +3254,7 @@ char * wpa_supplicant_ctrl_iface_process |
| 83 | 83 | } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { |
| 84 | 84 | reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, |
| 85 | 85 | reply_size); |
| ... | ... | |
| 105 | 105 | +#endif |
| 106 | 106 | --- a/src/ap/ieee802_1x.c |
| 107 | 107 | +++ b/src/ap/ieee802_1x.c |
| 108 | | @@ -1876,6 +1876,7 @@ static const char * bool_txt(Boolean boo |
| 108 | @@ -1895,6 +1895,7 @@ static const char * bool_txt(Boolean boo |
| 109 | 109 | return bool ? "TRUE" : "FALSE"; |
| 110 | 110 | } |
| 111 | 111 | |
| ... | ... | |
| 113 | 113 | |
| 114 | 114 | int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) |
| 115 | 115 | { |
| 116 | | @@ -2027,6 +2028,7 @@ int ieee802_1x_get_mib_sta(struct hostap |
| 116 | @@ -2046,6 +2047,7 @@ int ieee802_1x_get_mib_sta(struct hostap |
| 117 | 117 | return len; |
| 118 | 118 | } |
| 119 | 119 | |
| package/hostapd/patches/800-dynamic_20_40_mhz.patch |
| 1 | --- a/hostapd/config_file.c |
| 2 | @@ -1901,6 +1901,10 @@ struct hostapd_config * hostapd_config_r |
| 3 | "ht_capab", line); |
| 4 | errors++; |
| 5 | } |
| 6 | + } else if (os_strcmp(buf, "dynamic_ht40") == 0) { |
| 7 | + conf->dynamic_ht40 = atoi(pos); |
| 8 | + if (conf->dynamic_ht40 == 1) |
| 9 | + conf->dynamic_ht40 = 1500; |
| 10 | } else if (os_strcmp(buf, "require_ht") == 0) { |
| 11 | conf->require_ht = atoi(pos); |
| 12 | #endif /* CONFIG_IEEE80211N */ |
| 13 | --- a/src/ap/ap_config.h |
| 14 | @@ -393,6 +393,7 @@ struct hostapd_config { |
| 15 | int ieee80211n; |
| 16 | int secondary_channel; |
| 17 | int require_ht; |
| 18 | + int dynamic_ht40; |
| 19 | }; |
| 20 | |
| 21 | |
| 22 | --- a/src/ap/hostapd.c |
| 23 | @@ -285,6 +285,7 @@ static void hostapd_cleanup_iface_pre(st |
| 24 | */ |
| 25 | static void hostapd_cleanup_iface(struct hostapd_iface *iface) |
| 26 | { |
| 27 | + hostapd_deinit_ht(iface); |
| 28 | hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); |
| 29 | iface->hw_features = NULL; |
| 30 | os_free(iface->current_rates); |
| 31 | --- a/src/ap/hostapd.h |
| 32 | @@ -220,6 +220,9 @@ struct hostapd_iface { |
| 33 | /* Overlapping BSS information */ |
| 34 | int olbc_ht; |
| 35 | |
| 36 | + int force_20mhz; |
| 37 | + struct os_time last_20mhz_trigger; |
| 38 | + |
| 39 | u16 ht_op_mode; |
| 40 | void (*scan_cb)(struct hostapd_iface *iface); |
| 41 | |
| 42 | --- a/src/ap/ieee802_11.c |
| 43 | @@ -1242,6 +1242,9 @@ static void handle_beacon(struct hostapd |
| 44 | sizeof(mgmt->u.beacon)), &elems, |
| 45 | 0); |
| 46 | |
| 47 | + if (!elems.ht_capabilities) |
| 48 | + hostapd_trigger_20mhz(hapd->iface); |
| 49 | + |
| 50 | ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); |
| 51 | } |
| 52 | |
| 53 | --- a/src/ap/ieee802_11.h |
| 54 | @@ -65,4 +65,17 @@ void hostapd_tx_status(struct hostapd_da |
| 55 | void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src, |
| 56 | int wds); |
| 57 | |
| 58 | +#ifdef CONFIG_IEEE80211N |
| 59 | +void hostapd_trigger_20mhz(struct hostapd_iface *iface); |
| 60 | +void hostapd_deinit_ht(struct hostapd_iface *iface); |
| 61 | + |
| 62 | +#else |
| 63 | +static inline void hostapd_deinit_ht(struct hostapd_iface *iface) |
| 64 | +{ |
| 65 | +} |
| 66 | +static inline void hostapd_trigger_20mhz(struct hostapd_iface *iface) |
| 67 | +{ |
| 68 | +} |
| 69 | +#endif /* CONFIG_IEEE80211N */ |
| 70 | + |
| 71 | #endif /* IEEE802_11_H */ |
| 72 | --- a/src/ap/ieee802_11_ht.c |
| 73 | @@ -70,12 +70,15 @@ u8 * hostapd_eid_ht_operation(struct hos |
| 74 | |
| 75 | oper->control_chan = hapd->iconf->channel; |
| 76 | oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode); |
| 77 | - if (hapd->iconf->secondary_channel == 1) |
| 78 | - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | |
| 79 | - HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; |
| 80 | - if (hapd->iconf->secondary_channel == -1) |
| 81 | - oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | |
| 82 | - HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; |
| 83 | + |
| 84 | + if (!hapd->iface->force_20mhz) { |
| 85 | + if (hapd->iconf->secondary_channel == 1) |
| 86 | + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE | |
| 87 | + HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; |
| 88 | + if (hapd->iconf->secondary_channel == -1) |
| 89 | + oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW | |
| 90 | + HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH; |
| 91 | + } |
| 92 | |
| 93 | pos += sizeof(*oper); |
| 94 | |
| 95 | @@ -265,3 +268,80 @@ void hostapd_get_ht_capab(struct hostapd |
| 96 | |
| 97 | neg_ht_cap->ht_capabilities_info = host_to_le16(cap); |
| 98 | } |
| 99 | + |
| 100 | +static int hostapd_set_force_20mhz(struct hostapd_iface *iface); |
| 101 | + |
| 102 | +static int hostapd_restore_40mhz(void *eloop_data, void *user_ctx) |
| 103 | +{ |
| 104 | + struct hostapd_iface *iface = eloop_data; |
| 105 | + struct os_time time; |
| 106 | + int timeout; |
| 107 | + |
| 108 | + if (!iface->last_20mhz_trigger.sec) |
| 109 | + return; |
| 110 | + |
| 111 | + os_get_time(&time); |
| 112 | + timeout = iface->last_20mhz_trigger.sec + iface->conf->dynamic_ht40 - |
| 113 | + time.sec; |
| 114 | + |
| 115 | + if (timeout > 0) { |
| 116 | + eloop_register_timeout(timeout, 0, hostapd_restore_40mhz, |
| 117 | + iface, NULL); |
| 118 | + return; |
| 119 | + } |
| 120 | + |
| 121 | + iface->last_20mhz_trigger.sec = 0; |
| 122 | + iface->last_20mhz_trigger.usec = 0; |
| 123 | + |
| 124 | + iface->force_20mhz = 0; |
| 125 | + hostapd_set_force_20mhz(iface); |
| 126 | +} |
| 127 | + |
| 128 | +static int hostapd_set_force_20mhz(struct hostapd_iface *iface) |
| 129 | +{ |
| 130 | + int secondary_channel; |
| 131 | + int i; |
| 132 | + |
| 133 | + ieee802_11_set_beacons(iface); |
| 134 | + |
| 135 | + for (i = 0; i < iface->num_bss; i++) { |
| 136 | + struct hostapd_data *hapd = iface->bss[i]; |
| 137 | + |
| 138 | + if (iface->force_20mhz) |
| 139 | + secondary_channel = 0; |
| 140 | + else |
| 141 | + secondary_channel = hapd->iconf->secondary_channel; |
| 142 | + |
| 143 | + if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, |
| 144 | + hapd->iconf->channel, |
| 145 | + hapd->iconf->ieee80211n, |
| 146 | + secondary_channel)) { |
| 147 | + wpa_printf(MSG_ERROR, "Could not set channel for " |
| 148 | + "kernel driver"); |
| 149 | + } |
| 150 | + } |
| 151 | +} |
| 152 | + |
| 153 | +void hostapd_deinit_ht(struct hostapd_iface *iface) |
| 154 | +{ |
| 155 | + eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL); |
| 156 | +} |
| 157 | + |
| 158 | +void hostapd_trigger_20mhz(struct hostapd_iface *iface) |
| 159 | +{ |
| 160 | + if (!iface->conf->dynamic_ht40) |
| 161 | + return; |
| 162 | + |
| 163 | + if (!iface->force_20mhz) { |
| 164 | + iface->force_20mhz = 1; |
| 165 | + hostapd_set_force_20mhz(iface); |
| 166 | + } |
| 167 | + |
| 168 | + if (!iface->last_20mhz_trigger.sec) { |
| 169 | + eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL); |
| 170 | + eloop_register_timeout(iface->conf->dynamic_ht40, 0, |
| 171 | + hostapd_restore_40mhz, iface, NULL); |
| 172 | + } |
| 173 | + |
| 174 | + os_get_time(&iface->last_20mhz_trigger); |
| 175 | +} |