|
31 | 31 | #include "6LoWPAN/MAC/mac_ie_lib.h"
|
32 | 32 | #include "6LoWPAN/ws/ws_common_defines.h"
|
33 | 33 | #include "6LoWPAN/ws/ws_common.h"
|
| 34 | +#include "6LoWPAN/ws/ws_bootstrap.h" |
34 | 35 | #include "6LoWPAN/ws/ws_ie_lib.h"
|
35 | 36 | #include "6LoWPAN/ws/ws_llc.h"
|
36 | 37 | #include "6LoWPAN/ws/ws_mpx_header.h"
|
| 38 | +#include "6LoWPAN/ws/ws_pae_controller.h" |
37 | 39 | #include "Service_Libs/etx/etx.h"
|
38 | 40 | #include "fhss_ws_extension.h"
|
39 | 41 |
|
@@ -282,6 +284,10 @@ static uint16_t ws_wh_headers_length(wh_ie_sub_list_t requested_list, llc_ie_par
|
282 | 284 | length += WH_IE_ELEMENT_HEADER_LENGTH + params->vendor_header_length;
|
283 | 285 | }
|
284 | 286 |
|
| 287 | + if (requested_list.ea_ie) { |
| 288 | + length += WH_IE_ELEMENT_HEADER_LENGTH + 8; |
| 289 | + } |
| 290 | + |
285 | 291 | return length;
|
286 | 292 | }
|
287 | 293 |
|
@@ -521,6 +527,15 @@ static void ws_llc_mac_indication_cb(const mac_api_t *api, const mcps_data_ind_t
|
521 | 527 | if (us_ie_inline) {
|
522 | 528 | ws_neighbor_class_neighbor_unicast_schedule_set(neighbor_info.ws_neighbor, &us_ie);
|
523 | 529 | }
|
| 530 | + |
| 531 | + if (ws_utt.message_type == WS_FT_EAPOL) { |
| 532 | + uint8_t auth_eui64[8]; |
| 533 | + //Discover and write Auhtenticator EUI-64 |
| 534 | + if (ws_wh_ea_read(ie_ext->headerIeList, ie_ext->headerIeListLength, auth_eui64)) { |
| 535 | + ws_pae_controller_border_router_addr_write(base->interface_ptr, auth_eui64); |
| 536 | + } |
| 537 | + } |
| 538 | + |
524 | 539 | //Update BT if it is part of message
|
525 | 540 | ws_bt_ie_t ws_bt;
|
526 | 541 | if (ws_wh_bt_read(ie_ext->headerIeList, ie_ext->headerIeListLength, &ws_bt)) {
|
@@ -620,13 +635,23 @@ static void ws_llc_mpx_data_request(const mpx_api_t *api, const struct mcps_data
|
620 | 635 | wp_nested_ie_sub_list_t nested_wp_id;
|
621 | 636 | memset(&nested_wp_id, 0, sizeof(wp_nested_ie_sub_list_t));
|
622 | 637 | ie_header_mask.utt_ie = true;
|
623 |
| - ie_header_mask.bt_ie = true; |
624 |
| - if (base->ie_params.vendor_header_length && user_id == MPX_LOWPAN_ENC_USER_ID) { |
625 |
| - ie_header_mask.vh_ie = true; |
626 |
| - } |
627 | 638 |
|
628 |
| - if (base->ie_params.vendor_payload_length && user_id == MPX_LOWPAN_ENC_USER_ID) { |
629 |
| - nested_wp_id.vp_ie = true; |
| 639 | + if (user_id == MPX_LOWPAN_ENC_USER_ID) { |
| 640 | + ie_header_mask.bt_ie = true; |
| 641 | + if (base->ie_params.vendor_header_length) { |
| 642 | + ie_header_mask.vh_ie = true; |
| 643 | + } |
| 644 | + |
| 645 | + if (base->ie_params.vendor_payload_length) { |
| 646 | + nested_wp_id.vp_ie = true; |
| 647 | + } |
| 648 | + } else if (user_id == MPX_KEY_MANAGEMENT_ENC_USER_ID) { |
| 649 | + |
| 650 | + if (*data->msdu == 1) { //Only when KMP_ID is 1 |
| 651 | + ie_header_mask.ea_ie = ws_eapol_relay_state_active(base->interface_ptr); |
| 652 | + ie_header_mask.bt_ie = ie_header_mask.ea_ie; |
| 653 | + } |
| 654 | + |
630 | 655 | }
|
631 | 656 |
|
632 | 657 | nested_wp_id.us_ie = true;
|
@@ -681,12 +706,24 @@ static void ws_llc_mpx_data_request(const mpx_api_t *api, const struct mcps_data
|
681 | 706 | //Write UTT
|
682 | 707 |
|
683 | 708 | ptr = ws_wh_utt_write(ptr, message->messsage_type);
|
684 |
| - ptr = ws_wh_bt_write(ptr); |
| 709 | + if (ie_header_mask.bt_ie) { |
| 710 | + ptr = ws_wh_bt_write(ptr); |
| 711 | + } |
685 | 712 |
|
686 |
| - if (user_id == MPX_LOWPAN_ENC_USER_ID && ie_header_mask.vh_ie) { |
687 |
| - ptr = ws_wh_vh_write(ptr, base->ie_params.vendor_header_data, base->ie_params.vendor_header_length); |
| 713 | + if (user_id == MPX_LOWPAN_ENC_USER_ID ) { |
| 714 | + if (ie_header_mask.vh_ie) { |
| 715 | + ptr = ws_wh_vh_write(ptr, base->ie_params.vendor_header_data, base->ie_params.vendor_header_length); |
| 716 | + } |
| 717 | + } else if (user_id == MPX_KEY_MANAGEMENT_ENC_USER_ID) { |
| 718 | + if (ie_header_mask.ea_ie) { |
| 719 | + uint8_t eapol_auth_eui64[8]; |
| 720 | + ws_pae_controller_border_router_addr_read(base->interface_ptr, eapol_auth_eui64); |
| 721 | + ptr = ws_wh_ea_write(ptr, eapol_auth_eui64); |
| 722 | + } |
688 | 723 | }
|
689 | 724 |
|
| 725 | + |
| 726 | + |
690 | 727 | message->ie_vector_list[0].iovLen = ie_header_length;
|
691 | 728 | message->ie_ext.headerIeVectorList = &message->ie_vector_list[0];
|
692 | 729 | message->ie_ext.headerIovLength = 1;
|
|
0 commit comments