summaryrefslogtreecommitdiffhomepage
path: root/lib/nl80211.c
AgeCommit message (Collapse)Author
2024-07-11nl80211: gracefully handle illegal netlink error codeJo-Philipp Wich
Some generic netlink commands, e.g. `HWSIM_CMD_NEW_RADIO` might reply with a bogus netlink error message containing a positive error code, leading to an infinite loop in `uc_nl_request()`. Gracefully deal with such occurrences by remapping the error code to `NLE_RANGE` with a custom message. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2024-07-09nl80211: add wiphy multi-radio supportFelix Fietkau
Support new attributes that describe multiple radios belonging to a single wiphy. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-07nl80211: add support for multi-attribute arraysFelix Fietkau
For newly added attributes, the kernel prefers to no longer add a nesting container attribute. Instead, an attribute with the element type is simply added multiple times within the outer container. Add support for this array style, which will be used in the pending wiphy multi radio support. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-07nl80211: move access to tb array out of uc_nl_convert_attr and belowFelix Fietkau
Only one place needs access to another attribute from the tb array (HE MCS rates). In order to make that access possible, add a flag to indicate a second attribute dependency via auxdata. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-12-14nl80211: fix decoding of NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET attributeJo-Philipp Wich
- The expected length was incorrect - An incorrect MCS MAP index was accessed - The maximum MCS index number were wrong Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-12-14nl80211: fix parsing of NL80211_BAND_ATTR_VHT_MCS_SET attributeJo-Philipp Wich
The length constraint of 16 byte was incorrect, the attribute is 8 bytes long; two bytes for the RX MCS set, two bytes for the highest RX rate, two bytes for the TX MCS set and two bytes for the highest TX rate. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-12-11nl80211: fix datatype of NL80211_BAND_IFTYPE_ATTR_HE_CAP_{MAC,PHY} attrsJo-Philipp Wich
The attributes are arrays of 6 and 11 u8 values respectively. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-11-01nl80211: fix maybe uninitialized variableJo-Philipp Wich
When compiling with optimizations, gcc reports: .../nl80211.c: In function ‘uc_nl_convert_rta_vht_mcs’: .../nl80211.c:1310:31: error: ‘max_idx’ may be used uninitialized [-Werror=maybe-uninitialized] 1310 | for (j = 0; j <= max_idx; j++) | ~~^~~~~~~~~~ Slightly refactor the code to avoid this issue. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-09treewide: consolidate platform specific code in platform.cJo-Philipp Wich
Get rid of most __APPLE__ guards by introducing a central platform.c unit providing drop-in replacements for missing APIs. Also move system signal definitions into the new platform file to be able to share them with the upcoming debug library. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-06-05nl80211: add constants for iftypesFelix Fietkau
Useful for adding/removing interfaces Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-13nl80211: add missing ucv_get() callsFelix Fietkau
Arguments stored in the registry need an extra reference Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-12nl80211: fix NL80211_ATTR_SURVEY_INFOAndre Heider
This is the last attribute, adapt .nattr to include it so it gets parsed. Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-01-19nl80211: add support for registering an uloop based listenerFelix Fietkau
Can be used to capture nl80211 messages in an event driven program Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-01-19nl80211: refactor command bitmask handlingFelix Fietkau
- add missing overflow check - make array size dynamic - set all bits if command id is not specified - add helper function for filling command bits Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-01-09nl80211: add support for NL80211_ATTR_MPATH_INFOJohn Crispin
Signed-off-by: John Crispin <john@phrozen.org>
2022-06-27nl80211: fix NL80211_SURVEY_INFO_NOISE datatypeJo-Philipp Wich
Report the noise value as signed integer to calling ucode. Reported-by: John Crispin <john@phrozen.org> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-06-17nl80211: recognize further NL80211_STA_INFO_* NLAsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-03-14nl80211: add missing attributes and correct some attribute flagsJo-Philipp Wich
Suggested-by: John Crispin <john@phrozen.org> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-01-18lib: replace usages of vasprintf() with xvasprintf()Jo-Philipp Wich
This avoid triggering -Werror=unused-result compilation failures with certain toolchains. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-01-04treewide: rework numeric value handlingJo-Philipp Wich
- Parse integer literals as unsigned numeric values in order to be able to represent the entire unsigned 64bit value range - Stop parsing minus-prefixed integer literals as negative numbers but treat them as separate minus operator followed by a positive integer instead - Only store unsigned numeric constants in bytecode - Rework numeric comparison logic to be able to handle full 64bit unsigned integers - If possible, yield unsigned 64 bit results for additions - Simplify numeric value conversion API - Compile code with -fwrapv for defined signed overflow semantics Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-11-05nl80211: fix premature netlink reply receive abortJo-Philipp Wich
The nl_recvmsgs() logic in uc_nl_request() incorrectly stopped reading the socket before the netlink ACK message was handled for non-multipart replies. This caused subsequent requests to incorrectly receive the ACK of the previous request, leading to a failure to receive the actual reply. Fix this issue by continue reading the socket until either the finish callback for multipart (dump) messages or the ack callback for non- multipart messages was received. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-11-02nl80211: fix wiphy dump reply merge logicJo-Philipp Wich
Extract the wiphy index from the response message and use it to select the item to merge the fragment information into. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-22nl80211: fix issues spotted by static code analyzerJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-21nl80211: treat signal attr values as signed integersJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-21nl80211: expose sta_info attributesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-21lib: introduce Linux 802.11 netlink bindingJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>