diff options
Diffstat (limited to 'lib/nl80211.c')
-rw-r--r-- | lib/nl80211.c | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/lib/nl80211.c b/lib/nl80211.c index feebaeb..34a3e92 100644 --- a/lib/nl80211.c +++ b/lib/nl80211.c @@ -330,7 +330,7 @@ static const uc_nl_nested_spec_t nl80211_mesh_setup_nla = { static const uc_nl_nested_spec_t nl80211_mntr_flags_nla = { .headsize = 0, - .nattrs = 6, + .nattrs = 7, .attrs = { { NL80211_MNTR_FLAG_FCSFAIL, "fcsfail", DT_FLAG, 0, NULL }, { NL80211_MNTR_FLAG_PLCPFAIL, "plcpfail", DT_FLAG, 0, NULL }, @@ -338,6 +338,7 @@ static const uc_nl_nested_spec_t nl80211_mntr_flags_nla = { { NL80211_MNTR_FLAG_OTHER_BSS, "other_bss", DT_FLAG, 0, NULL }, { NL80211_MNTR_FLAG_COOK_FRAMES, "cook_frames", DT_FLAG, 0, NULL }, { NL80211_MNTR_FLAG_ACTIVE, "active", DT_FLAG, 0, NULL }, + { NL80211_MNTR_FLAG_SKIP_TX, "skip_tx", DT_FLAG, 0, NULL }, } }; @@ -588,7 +589,7 @@ static const uc_nl_nested_spec_t nl80211_wiphy_bands_rates_nla = { static const uc_nl_nested_spec_t nl80211_wiphy_bands_iftype_data_nla = { .headsize = 0, - .nattrs = 7, + .nattrs = 9, .attrs = { { NL80211_BAND_IFTYPE_ATTR_IFTYPES, "iftypes", DT_NESTED, 0, &nl80211_ifcomb_limit_types_nla }, { NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC, "he_cap_mac", DT_U8, DF_ARRAY, NULL }, @@ -597,6 +598,8 @@ static const uc_nl_nested_spec_t nl80211_wiphy_bands_iftype_data_nla = { { NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE, "he_cap_ppe", DT_U8, DF_ARRAY, NULL }, { NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA, "he_6ghz_capa", DT_U16, 0, NULL }, { NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS, "vendor_elems", DT_STRING, DF_BINARY, NULL }, + { NL80211_BAND_IFTYPE_ATTR_EHT_CAP_MAC, "eht_cap_mac", DT_U8, DF_ARRAY, NULL }, + { NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY, "eht_cap_phy", DT_U8, DF_ARRAY, NULL }, } }; @@ -693,7 +696,7 @@ static const uc_nl_nested_spec_t nl80211_bss_nla = { static const uc_nl_nested_spec_t nl80211_sta_info_bitrate_nla = { .headsize = 0, - .nattrs = 18, + .nattrs = 22, .attrs = { { NL80211_RATE_INFO_BITRATE, "bitrate", DT_U16, 0, NULL }, { NL80211_RATE_INFO_BITRATE32, "bitrate32", DT_U32, 0, NULL }, @@ -707,10 +710,14 @@ static const uc_nl_nested_spec_t nl80211_sta_info_bitrate_nla = { { NL80211_RATE_INFO_HE_GI, "he_gi", DT_U8, 0, NULL }, { NL80211_RATE_INFO_HE_DCM, "he_dcm", DT_U8, 0, NULL }, { NL80211_RATE_INFO_HE_RU_ALLOC, "he_ru_alloc", DT_U8, 0, NULL }, + { NL80211_RATE_INFO_EHT_MCS, "eht_mcs", DT_U8, 0, NULL }, + { NL80211_RATE_INFO_EHT_NSS, "eht_nss", DT_U8, 0, NULL }, + { NL80211_RATE_INFO_EHT_GI, "eht_gi", DT_U8, 0, NULL }, { NL80211_RATE_INFO_40_MHZ_WIDTH, "width_40", DT_FLAG, 0, NULL }, { NL80211_RATE_INFO_80_MHZ_WIDTH, "width_80", DT_FLAG, 0, NULL }, { NL80211_RATE_INFO_80P80_MHZ_WIDTH, "width_80p80", DT_FLAG, 0, NULL }, { NL80211_RATE_INFO_160_MHZ_WIDTH, "width_160", DT_FLAG, 0, NULL }, + { NL80211_RATE_INFO_320_MHZ_WIDTH, "width_320", DT_FLAG, 0, NULL }, { NL80211_RATE_INFO_10_MHZ_WIDTH, "width_10", DT_FLAG, 0, NULL }, { NL80211_RATE_INFO_5_MHZ_WIDTH, "width_5", DT_FLAG, 0, NULL }, } @@ -844,17 +851,18 @@ static const uc_nl_nested_spec_t nl80211_radio_freq_range_nla = { static const uc_nl_nested_spec_t nl80211_wiphy_radio_nla = { .headsize = 0, - .nattrs = 3, + .nattrs = 4, .attrs = { { NL80211_WIPHY_RADIO_ATTR_INDEX, "index", DT_U32, 0, NULL }, { NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE, "freq_ranges", DT_NESTED, DF_REPEATED, &nl80211_radio_freq_range_nla }, { NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION, "interface_combinations", DT_NESTED, DF_REPEATED, &nl80211_ifcomb_nla }, + { NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK, "antenna_mask", DT_U32, 0, NULL }, } }; static const uc_nl_nested_spec_t nl80211_msg = { .headsize = 0, - .nattrs = 128, + .nattrs = 130, .attrs = { { NL80211_ATTR_4ADDR, "4addr", DT_U8, 0, NULL }, { NL80211_ATTR_AIRTIME_WEIGHT, "airtime_weight", DT_U16, 0, NULL }, @@ -881,6 +889,7 @@ static const uc_nl_nested_spec_t nl80211_msg = { { NL80211_ATTR_DFS_REGION, "dfs_region", DT_U8, 0, NULL }, { NL80211_ATTR_DTIM_PERIOD, "dtim_period", DT_U32, 0, NULL }, { NL80211_ATTR_DURATION, "duration", DT_U32, 0, NULL }, + { NL80211_ATTR_EXT_FEATURES, "extended_features", DT_U8, DF_ARRAY, NULL }, { NL80211_ATTR_FEATURE_FLAGS, "feature_flags", DT_U32, 0, NULL }, { NL80211_ATTR_FRAME, "frame", DT_STRING, DF_BINARY, NULL }, { NL80211_ATTR_FRAME_MATCH, "frame_match", DT_STRING, DF_BINARY, NULL }, @@ -984,6 +993,7 @@ static const uc_nl_nested_spec_t nl80211_msg = { { NL80211_ATTR_MAX_AP_ASSOC_STA, "max_ap_assoc", DT_U16, 0, NULL }, { NL80211_ATTR_SURVEY_INFO, "survey_info", DT_NESTED, 0, &nl80211_survey_info_nla }, { NL80211_ATTR_WIPHY_RADIOS, "radios", DT_NESTED, DF_MULTIPLE|DF_AUTOIDX, &nl80211_wiphy_radio_nla }, + { NL80211_ATTR_VIF_RADIO_MASK, "vif_radio_mask", DT_U32, 0, NULL }, } }; @@ -2014,7 +2024,8 @@ typedef struct { reply_state_t state; uc_vm_t *vm; uc_value_t *res; - bool merge; + bool merge_phy_info; + bool single_phy_info; const uc_nl_nested_spec_t *spec; } request_state_t; @@ -2122,14 +2133,23 @@ cb_reply(struct nl_msg *msg, void *arg) if (rv) { if (hdr->nlmsg_flags & NLM_F_MULTI) { - if (!s->res) - s->res = ucv_array_new(s->vm); - - if (s->merge) { + if (s->merge_phy_info && s->single_phy_info) { + if (!s->res) { + s->res = o; + } + else { + deep_merge_object(s->res, o); + ucv_put(o); + } + } + else if (s->merge_phy_info) { idx = ucv_object_get(o, "wiphy", NULL); i = idx ? ucv_int64_get(idx) : -1; if (i >= 0) { + if (!s->res) + s->res = ucv_array_new(s->vm); + idx = ucv_array_get(s->res, i); if (idx) { @@ -2142,6 +2162,9 @@ cb_reply(struct nl_msg *msg, void *arg) } } else { + if (!s->res) + s->res = ucv_array_new(s->vm); + ucv_array_push(s->res, o); } } @@ -2598,9 +2621,19 @@ uc_nl_request(uc_vm_t *vm, size_t nargs) cid -= HWSIM_CMD_OFFSET; st.spec = &hwsim_msg; } + else if (cid == NL80211_CMD_GET_WIPHY) { + id = uc_nl_find_family_id("nl80211"); + st.spec = &nl80211_msg; + st.merge_phy_info = true; + + if (ucv_object_get(payload, "wiphy", NULL) != NULL) + st.single_phy_info = true; + + if (ucv_is_truish(ucv_object_get(payload, "split_wiphy_dump", NULL))) + flagval |= NLM_F_DUMP; + } else { id = uc_nl_find_family_id("nl80211"); - st.merge = (cid == NL80211_CMD_GET_WIPHY); st.spec = &nl80211_msg; } |