band: return -ENOTSUP when RSSI is too low for rate estimation
PATCH 1/3 band: return -ENOTSUP when RSSI is too low for rate estimation
This was overlooked in a prior patch and causes the rate estimation to return -ENETUNREACH if the RSSI is too low to support the various capabilities. This return was unhandled and was treated as if the IE was invalid which then printed a warning.
The low RSSI case should just be ignored, similar to if the IE was not provided at all. In this case return -ENOTSUP so the caller moves on to the next capability set.
Note: this does result in most of the estimation functions only
returning 0 or -ENOTSUP as they do little to no validation on the frame, but rather just test bits. Additional validation could be added in the future which would be handled by this patch.
--- src/band.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
src/band.c +4 -4
@@ -121,7 +121,7 @@ int band_estimate_nonht_rate(const struct band *band, }if (!max_rate) -return -ENETUNREACH ; +return -ENOTSUP ; *out_data_rate = max_rate *500000 ;return 0 ;
@@ -319,7 +319,7 @@ int band_estimate_ht_rx_rate(const struct band *band, rssi, sgi, out_data_rate))return 0 ; -return -ENETUNREACH ; +return -ENOTSUP ; } static bool find_best_mcs_vht(uint8_t max_index, enum ofdm_channel_width width,
@@ -502,7 +502,7 @@ try_vht80: rssi, nss, sgi, out_data_rate))return 0 ; -return -ENETUNREACH ; +return -ENOTSUP ; }/*
@@ -678,7 +678,7 @@ int band_estimate_he_rx_rate(const struct band *band, const uint8_t *hec, }if (!rate) -return -EBADMSG ; +return -ENOTSUP ; *out_data_rate = rate;
Signature · 1 line
2.34.1
PATCH 2/3 scan: replace -ENETUNREACH with -ENOTSUP for rate estimation return
The rate estimation functions now just return 0 or -ENOTSUP for success or if no estimation could be made due to missing IEs. Only in the case of other errors (such as malformed IEs) should a warning be printed.
--- src/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/scan.c +1 -1
@@ -1608,7 +1608,7 @@ static struct scan_bss *scan_parse_attr_bss(struct l_genl_attr *attr, ret =wiphy_estimate_data_rate (wiphy, ies, ies_len, bss, &bss->data_rate); -if (ret <0 && ret != -ENETUNREACH ) +if (ret <0 && ret != -ENOTSUP )l_warn ("wiphy_estimate_data_rate() failed" ); }
Signature · 1 line
2.34.1
PATCH 3/3 wiphy: include MAC of BSS with invalid HE capabilities
In reply to James PrestwoodThe prior print was not very descriptive, and now will log the MAC of the offending BSS.
--- src/wiphy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/wiphy.c +2 -1
@@ -1039,7 +1039,8 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,break ;case IE_TYPE_HE_CAPABILITIES :if (!ie_validate_he_capabilities (iter.data, iter.len)) { -l_warn ("invalid HE capabilities" ); +l_warn ("invalid HE capabilities for " MAC , +MAC_STR (bss->addr));continue ; }
Signature · 1 line
2.34.1
Hi James,
Quoted 8 lines · James Prestwood
This was overlooked in a prior patch and causes the rate estimation to return
-ENETUNREACHif the RSSI is too low to support the various capabilities. This return was unhandled and was treated as if the IE was invalid which then printed a warning.The low RSSI case should just be ignored, similar to if the IE was not provided at all. In this case return
-ENOTSUPso the caller moves on to the next capability set.
Err, why? Just handle the error code.
Quoted 9 lines
Note: this does result in most of the estimation functions only
returning 0 or-ENOTSUPas they do little to no validation on the frame, but rather just test bits. Additional validation could be added in the future which would be handled by this patch.--- src/band.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Hmm, this set is failing CI for some reason?
Regards,
-Denis
Hi Denis,
Quoted 8 lines · Denis Kenzior
Hi James,
Quoted 5 lines · James Prestwood
This was overlooked in a prior patch and causes the rate estimation to return
-ENETUNREACHif the RSSI is too low to support the various capabilities. This return was unhandled and was treated as if the IE was invalid which then printed a warning.
Quoted 5 lines
Quoted 3 lines
The low RSSI case should just be ignored, similar to if the IE was not provided at all. In this case return
-ENOTSUPso the caller moves on to the next capability set.Err, why? Just handle the error code.
Seemed better to do this than checking for 2 return codes. And IMO "Not Supported" actually describes the situation better than "Network is unreachable".
But I don't have a strong preference either way, if you prefer checking both we can do that too.
Quoted 11 lines
Quoted 10 lines
Note: this does result in most of the estimation functions only returning 0 or
-ENOTSUPas they do little to no validation on the frame, but rather just test bits. Additional validation could be added in the future which would be handled by this patch.
---
src/band.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 1 line
Hmm, this set is failing CI for some reason?
Ah, good catch CI :) its because test-band was expecting -EBADMSG when all MCS' were unsupported. Really this is a valid IE so we shouldn't expect -EBADMSG there but we do. I'll have to change this, or check for -ENETUNREACH if we go back to that.
Quoted 3 lines
Regards,
-Denis
Hi James,
Quoted 2 lines
Seemed better to do this than checking for 2 return codes. And IMO "Not Supported" actually describes the situation better than "Network is unreachable".
Well, it is supported, just not reachable ;)
Quoted 2 lines
But I don't have a strong preference either way, if you prefer checking both we can do that too.
I rather we check both, since unit tests in particular would probably use the extra information.
Quoted 2 lines
Quoted 1 line
Hmm, this set is failing CI for some reason?
Ah, good catch CI :) its because test-band was expecting
-EBADMSGwhen all MCS' were unsupported. Really this is a valid IE so we shouldn't expect-EBADMSGthere but we do. I'll have to change this, or check for-ENETUNREACHif we go back to that.
Heh :)
Regards,
-Denis