diff mbox series

netdev: loosen parsing requirements on STA_INFO

Message ID 20240920113636.201189-1-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series netdev: loosen parsing requirements on STA_INFO | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood Sept. 20, 2024, 11:36 a.m. UTC
If one of the nested attributes in STA_INFO isn't exactly what we
expect in terms of length or content skip it rather than fatally
return. Each of the diagnostic info members uses a bool to indicate
if it was found, so if one is unable to parse it just won't be
present in the diagnostic message.
---
 src/netdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/netdev.c b/src/netdev.c
index d95a2a1e..995918ab 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -581,7 +581,7 @@  static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 		switch (type) {
 		case NL80211_STA_INFO_SIGNAL:
 			if (len != 1)
-				return false;
+				continue;
 
 			info->cur_rssi = *(const int8_t *) data;
 			info->have_cur_rssi = true;
@@ -589,7 +589,7 @@  static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 			break;
 		case NL80211_STA_INFO_SIGNAL_AVG:
 			if (len != 1)
-				return false;
+				continue;
 
 			info->avg_rssi = *(const int8_t *) data;
 			info->have_avg_rssi = true;
@@ -597,12 +597,12 @@  static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 			break;
 		case NL80211_STA_INFO_RX_BITRATE:
 			if (!l_genl_attr_recurse(attr, &nested))
-				return false;
+				continue;
 
 			if (!netdev_parse_bitrate(&nested, &info->rx_mcs_type,
 							&info->rx_bitrate,
 							&info->rx_mcs))
-				return false;
+				continue;
 
 			info->have_rx_bitrate = true;
 
@@ -613,12 +613,12 @@  static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 
 		case NL80211_STA_INFO_TX_BITRATE:
 			if (!l_genl_attr_recurse(attr, &nested))
-				return false;
+				continue;
 
 			if (!netdev_parse_bitrate(&nested, &info->tx_mcs_type,
 							&info->tx_bitrate,
 							&info->tx_mcs))
-				return false;
+				continue;
 
 			info->have_tx_bitrate = true;
 
@@ -629,7 +629,7 @@  static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 
 		case NL80211_STA_INFO_EXPECTED_THROUGHPUT:
 			if (len != 4)
-				return false;
+				continue;
 
 			info->expected_throughput = l_get_u32(data);
 			info->have_expected_throughput = true;