Skip to content

Commit b86f885

Browse files
author
Juha Heiskanen
committed
EAPOL data flow IE update
Fixd Broken broadcast add before device is synched. Added EA-IE header information element to KMP-ID 1 message flow. Added Parse / Write for Auhtenticator EUI-64 EA-IE support. Change-Id: I1a72740db60d6ad46332d2e2c1c6940225971b60
1 parent 65472de commit b86f885

File tree

6 files changed

+77
-9
lines changed

6 files changed

+77
-9
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,15 @@ void ws_dhcp_client_address_delete(protocol_interface_info_entry_t *cur, uint8_t
17441744
dhcp_client_global_address_delete(cur->id, NULL, prefix);
17451745
}
17461746

1747+
bool ws_eapol_relay_state_active(protocol_interface_info_entry_t *cur)
1748+
{
1749+
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER || cur->nwk_bootstrap_state == ER_BOOTSRAP_DONE) {
1750+
return true;
1751+
}
1752+
1753+
return false;
1754+
}
1755+
17471756
static void ws_rpl_prefix_callback(prefix_entry_t *prefix, void *handle, uint8_t *parent_link_local)
17481757
{
17491758
protocol_interface_info_entry_t *cur = (protocol_interface_info_entry_t *) handle;
@@ -2150,6 +2159,9 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
21502159
uint8_t ll_addr[16];
21512160
addr_interface_get_ll_address(cur, ll_addr, 1);
21522161

2162+
//SET EAPOL authenticator EUI64
2163+
ws_pae_controller_border_router_addr_write(cur, cur->mac);
2164+
21532165
// Set EAPOL relay to port 10255 and authenticator relay to 10253 (and to own ll address)
21542166
ws_eapol_relay_start(cur, BR_EAPOL_RELAY_SOCKET_PORT, ll_addr, EAPOL_RELAY_SOCKET_PORT);
21552167

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ void ws_dhcp_client_address_request(protocol_interface_info_entry_t *cur, uint8_
7070

7171
void ws_dhcp_client_address_delete(protocol_interface_info_entry_t *cur, uint8_t *prefix);
7272

73+
bool ws_eapol_relay_state_active(protocol_interface_info_entry_t *cur);
74+
7375
#else
7476

7577
#define ws_bootstrap_init(interface_id, bootstrap_mode) (-1)

source/6LoWPAN/ws/ws_llc_data_service.c

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
#include "6LoWPAN/MAC/mac_ie_lib.h"
3232
#include "6LoWPAN/ws/ws_common_defines.h"
3333
#include "6LoWPAN/ws/ws_common.h"
34+
#include "6LoWPAN/ws/ws_bootstrap.h"
3435
#include "6LoWPAN/ws/ws_ie_lib.h"
3536
#include "6LoWPAN/ws/ws_llc.h"
3637
#include "6LoWPAN/ws/ws_mpx_header.h"
38+
#include "6LoWPAN/ws/ws_pae_controller.h"
3739
#include "Service_Libs/etx/etx.h"
3840
#include "fhss_ws_extension.h"
3941

@@ -282,6 +284,10 @@ static uint16_t ws_wh_headers_length(wh_ie_sub_list_t requested_list, llc_ie_par
282284
length += WH_IE_ELEMENT_HEADER_LENGTH + params->vendor_header_length;
283285
}
284286

287+
if (requested_list.ea_ie) {
288+
length += WH_IE_ELEMENT_HEADER_LENGTH + 8;
289+
}
290+
285291
return length;
286292
}
287293

@@ -521,6 +527,15 @@ static void ws_llc_mac_indication_cb(const mac_api_t *api, const mcps_data_ind_t
521527
if (us_ie_inline) {
522528
ws_neighbor_class_neighbor_unicast_schedule_set(neighbor_info.ws_neighbor, &us_ie);
523529
}
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+
524539
//Update BT if it is part of message
525540
ws_bt_ie_t ws_bt;
526541
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
620635
wp_nested_ie_sub_list_t nested_wp_id;
621636
memset(&nested_wp_id, 0, sizeof(wp_nested_ie_sub_list_t));
622637
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-
}
627638

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+
630655
}
631656

632657
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
681706
//Write UTT
682707

683708
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+
}
685712

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+
}
688723
}
689724

725+
726+
690727
message->ie_vector_list[0].iovLen = ie_header_length;
691728
message->ie_ext.headerIeVectorList = &message->ie_vector_list[0];
692729
message->ie_ext.headerIovLength = 1;

test/nanostack/unittest/6LoWPAN/ws_llc_data_service/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ TEST_SRC_FILES = \
2828
../../stub/adaptation_interface_stub.c \
2929
../../stub/mac_ie_lib_stub.c \
3030
../../stub/ws_ie_lib_stub.c \
31+
../../stub/ws_bootstrap_stub.c \
3132
../../stub/ws_mpx_header_stub.c \
3233
../../stub/ws_neighbour_class_stub.c \
34+
../../stub/ws_pae_controller_stub.c \
3335
../../stub/mac_neighbor_table_stub.c \
3436
../../stub/iphc_decompress_stub.c \
3537
../../stub/fhss_config_stub.c \

test/nanostack/unittest/stub/ws_bootstrap_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ void ws_secondary_parent_update(protocol_interface_info_entry_t *interface)
6666
{
6767

6868
}
69+
70+
bool ws_eapol_relay_state_active(protocol_interface_info_entry_t *cur)
71+
{
72+
return false;
73+
}

test/nanostack/unittest/stub/ws_pae_controller_stub.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,13 @@ void ws_pae_controller_timer(uint16_t ticks)
4343
{
4444

4545
}
46+
47+
int8_t ws_pae_controller_border_router_addr_write(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64)
48+
{
49+
return 0;
50+
}
51+
52+
int8_t ws_pae_controller_border_router_addr_read(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64)
53+
{
54+
return 0;
55+
}

0 commit comments

Comments
 (0)