mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-19 03:14:05 -05:00
Allow fragmentation/RTS threshold to be disabled explicitly
hostapd configuration parameters fragm_threshold and rts_threshold were documented to disable the threshold with value -1 and not change driver configuration if the parameter is not included. However, -1 was mapped into not changing the driver value, so the explicit disabling part did not work. Replace the default values for these to be -2 so that explicitly set configuration value -1 can be distinguished from the case of not including the parameter. Map the -1 value to a driver request to disable the threshold. Ignore any error from this operation just in case to avoid breaking functionality should some drivers not accept the (u32) -1 value as a threshold value request to disable the mechanism. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
abaa0893f0
commit
bf0021ede3
@ -200,8 +200,8 @@ struct hostapd_config * hostapd_config_defaults(void)
|
|||||||
conf->num_bss = 1;
|
conf->num_bss = 1;
|
||||||
|
|
||||||
conf->beacon_int = 100;
|
conf->beacon_int = 100;
|
||||||
conf->rts_threshold = -1; /* use driver default: 2347 */
|
conf->rts_threshold = -2; /* use driver default: 2347 */
|
||||||
conf->fragm_threshold = -1; /* user driver default: 2346 */
|
conf->fragm_threshold = -2; /* user driver default: 2346 */
|
||||||
/* Set to invalid value means do not add Power Constraint IE */
|
/* Set to invalid value means do not add Power Constraint IE */
|
||||||
conf->local_pwr_constraint = -1;
|
conf->local_pwr_constraint = -1;
|
||||||
|
|
||||||
|
@ -1883,15 +1883,17 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hapd->iconf->rts_threshold > -1 &&
|
if (hapd->iconf->rts_threshold >= -1 &&
|
||||||
hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
|
hostapd_set_rts(hapd, hapd->iconf->rts_threshold) &&
|
||||||
|
hapd->iconf->rts_threshold >= -1) {
|
||||||
wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
|
wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
|
||||||
"kernel driver");
|
"kernel driver");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hapd->iconf->fragm_threshold > -1 &&
|
if (hapd->iconf->fragm_threshold >= -1 &&
|
||||||
hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) {
|
hostapd_set_frag(hapd, hapd->iconf->fragm_threshold) &&
|
||||||
|
hapd->iconf->fragm_threshold != -1) {
|
||||||
wpa_printf(MSG_ERROR, "Could not set fragmentation threshold "
|
wpa_printf(MSG_ERROR, "Could not set fragmentation threshold "
|
||||||
"for kernel driver");
|
"for kernel driver");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -6166,7 +6166,7 @@ static int i802_set_rts(void *priv, int rts)
|
|||||||
int ret;
|
int ret;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
if (rts >= 2347)
|
if (rts >= 2347 || rts == -1)
|
||||||
val = (u32) -1;
|
val = (u32) -1;
|
||||||
else
|
else
|
||||||
val = rts;
|
val = rts;
|
||||||
@ -6194,7 +6194,7 @@ static int i802_set_frag(void *priv, int frag)
|
|||||||
int ret;
|
int ret;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
if (frag >= 2346)
|
if (frag >= 2346 || frag == -1)
|
||||||
val = (u32) -1;
|
val = (u32) -1;
|
||||||
else
|
else
|
||||||
val = frag;
|
val = frag;
|
||||||
|
Loading…
Reference in New Issue
Block a user