Skip to content

Commit a428ba7

Browse files
author
Juha Heiskanen
committed
wi-sun LLC update
EAPOL data flow request will add EA-IE and BT-IE only for EAP Request Indentify, FWK MSG 1 and GWK MSG 1. This will save a band. Change-Id: Ib07bf666b6227cd6b9a15dc8dd31679a1b50121b
1 parent 5ad1743 commit a428ba7

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

source/6LoWPAN/ws/ws_llc_data_service.c

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "6LoWPAN/ws/ws_llc.h"
3737
#include "6LoWPAN/ws/ws_mpx_header.h"
3838
#include "6LoWPAN/ws/ws_pae_controller.h"
39+
#include "Security/PANA/pana_eap_header.h"
40+
#include "Security/eapol/eapol_helper.h"
3941
#include "Service_Libs/etx/etx.h"
4042
#include "fhss_ws_extension.h"
4143

@@ -617,6 +619,37 @@ static uint16_t ws_mpx_header_size_get(llc_data_base_t *base, uint16_t user_id)
617619
return header_size;
618620
}
619621

622+
static bool ws_eapol_handshake_first_msg(uint8_t *pdu, uint16_t length, protocol_interface_info_entry_t *cur)
623+
{
624+
if (!ws_eapol_relay_state_active(cur)) {
625+
return false;
626+
}
627+
628+
eapol_pdu_t eapol_pdu;
629+
uint8_t kmp_type = *pdu++;
630+
length--;
631+
if (!eapol_parse_pdu_header(pdu, length, &eapol_pdu)) {
632+
return false;
633+
}
634+
if (eapol_pdu.packet_type == EAPOL_EAP_TYPE) {
635+
if (eapol_pdu.msg.eap.eap_code == EAP_REQ && eapol_pdu.msg.eap.type == EAP_IDENTITY) {
636+
return true;
637+
}
638+
} else {
639+
640+
uint8_t key_mask = eapol_pdu_key_mask_get(&eapol_pdu);
641+
if (kmp_type == 6 && key_mask == KEY_INFO_KEY_ACK) {
642+
//FWK first message validation
643+
return true;
644+
} else if (kmp_type == 7 && key_mask == (KEY_INFO_KEY_ACK | KEY_INFO_KEY_MIC | KEY_INFO_SECURED_KEY_FRAME)) {
645+
//GWK first message validation
646+
return true;
647+
}
648+
}
649+
650+
return false;
651+
}
652+
620653
static void ws_llc_mpx_data_request(const mpx_api_t *api, const struct mcps_data_req_s *data, uint16_t user_id)
621654
{
622655
llc_data_base_t *base = ws_llc_discover_by_mpx(api);
@@ -646,12 +679,8 @@ static void ws_llc_mpx_data_request(const mpx_api_t *api, const struct mcps_data
646679
nested_wp_id.vp_ie = true;
647680
}
648681
} 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-
682+
ie_header_mask.ea_ie = ws_eapol_handshake_first_msg(data->msdu, data->msduLength, base->interface_ptr);
683+
ie_header_mask.bt_ie = ie_header_mask.ea_ie;
655684
}
656685

657686
nested_wp_id.us_ie = true;

0 commit comments

Comments
 (0)