diff --git a/src/cntlr_tlv.c b/src/cntlr_tlv.c index a3e81b415b1572f8e22d3ff462bcb40b90a6cc3f..c926dae8f2d08ff0fbe98cd6fe8e6ade510b72cd 100644 --- a/src/cntlr_tlv.c +++ b/src/cntlr_tlv.c @@ -727,11 +727,26 @@ int cntlr_gen_backhaul_steer_req(struct controller *c, struct cmdu_buff *frm, return 0; } +static int cntlr_get_opc_ch_bssid(struct controller *c, + uint8_t *bssid, uint8_t *opc, uint8_t *ch) +{ + struct netif_radio *radio = NULL; + + radio = find_radio_by_bssid(c, bssid); + if (!radio) + return -1; + + *opc = radio->radio_el->cur_opclass.opclass[0].id; + *ch = radio->radio_el->cur_opclass.opclass[0].channel[0].channel; + + return 0; +} + int cntlr_gen_tlv_steer_request(struct controller *c, struct cmdu_buff *frm, uint8_t tlv_type, uint8_t *bssid, uint32_t steer_timeout, uint32_t sta_nr, uint8_t sta_id[][6], - uint32_t bssid_nr, uint8_t target_bbsid[][6], + uint32_t bssid_nr, uint8_t target_bssid[][6], uint32_t request_mode) { int ret, offset = 0; @@ -780,17 +795,21 @@ int cntlr_gen_tlv_steer_request(struct controller *c, } if (request_mode == 1) { + uint8_t opclass = 0, channel = 0; + t->data[offset++] = (uint8_t) bssid_nr; /* BSSID list count */ for (i = 0; i < bssid_nr; i++) { dbg("%s %d target_bssid " MACFMT "\n", - __func__, __LINE__, MAC2STR(target_bbsid[i])); + __func__, __LINE__, MAC2STR(target_bssid[i])); - memcpy(&t->data[offset], target_bbsid[i], 6); /* bssid */ + memcpy(&t->data[offset], target_bssid[i], 6); /* bssid */ dbg("%s %d\n", __func__, __LINE__); offset += 6; - t->data[offset++] = 0x00; /* bss opclass */ - t->data[offset++] = 0x00; /* bss channel */ + + cntlr_get_opc_ch_bssid(c, target_bssid[i], &channel, &opclass); + t->data[offset++] = opclass; /* bss opclass */ + t->data[offset++] = channel; /* bss channel */ if (tlv_type == MAP_TLV_PROFILE2_STEERING_REQ) t->data[offset++] = 0x00; /* reason code */