Message ID | 20240930181145.1043048-1-dylan.eskew@candelatech.com |
---|---|
Headers | show |
Series | iw: scan: ie parsing restructure | expand |
On Mon, 2024-09-30 at 11:11 -0700, Dylan Eskew wrote: > Formerly, ie ids were hardcoded. This change will improve > readability of logic which may explicitly reference an ie id. I've applied this, with some changes. johannes
On Mon, 2024-09-30 at 11:11 -0700, Dylan Eskew wrote: > Prevent needing to reparse the ie buffer by passing > the ieee80211_elems struct containing the alias ie > pointers. > I think I see why you'd want the previous and this patch, and it's OK for certain elements (such as the VHT capability or HE capability where you'd need it), but in general it can't work this way. We could either make the parsing even more generic to be able to deal with elements occurring multiple times, or, perhaps more plausibly, have a context with only what we need (VHT capability seen here, HE capability for EHT, ...) filled by a pre-parsing step, and then pass that context around. In practice for HE/EHT we could also just pass a context around and say it's an error if e.g. the EHT capabilities element is in the list _before_ the HE capabilities element, since by spec that's not supposed to happen. So we could just have the HE capabilities parsing fill the context with the necessary information about HE (and set a validity flag) and then check that it was already found when we get to EHT later. However, that doesn't work for the case with capabilities/VHT ... where the parsing of the capabilities element is actually referencing the VHT element _later_ in the frame. johannes
Thanks for the feedback. I didn't necessarily realize that elements might appear multiple times in a frame, but that information paired with your implementation advice gives me plenty to figure something better. -- Dylan On 11/7/24 6:22 AM, Johannes Berg wrote: > On Mon, 2024-09-30 at 11:11 -0700, Dylan Eskew wrote: >> Prevent needing to reparse the ie buffer by passing >> the ieee80211_elems struct containing the alias ie >> pointers. >> > I think I see why you'd want the previous and this patch, and it's OK > for certain elements (such as the VHT capability or HE capability where > you'd need it), but in general it can't work this way. > > We could either make the parsing even more generic to be able to deal > with elements occurring multiple times, or, perhaps more plausibly, have > a context with only what we need (VHT capability seen here, HE > capability for EHT, ...) filled by a pre-parsing step, and then pass > that context around. > > In practice for HE/EHT we could also just pass a context around and say > it's an error if e.g. the EHT capabilities element is in the list > _before_ the HE capabilities element, since by spec that's not supposed > to happen. So we could just have the HE capabilities parsing fill the > context with the necessary information about HE (and set a validity > flag) and then check that it was already found when we get to EHT later. > > However, that doesn't work for the case with capabilities/VHT ... where > the parsing of the capabilities element is actually referencing the VHT > element _later_ in the frame. > > johannes