Skip to content

Commit

Permalink
Parent synch fix and EAPOL synch fix
Browse files Browse the repository at this point in the history
EAPOL authenticator add now BT-IE to every message.

EAPOL parent synch is now done fully only first time otherwise it will be done just soft update.

Fixed FHSS default set write.

Change-Id: Ia03f628b2856e771e7f0bbc0860ce6c3be223b1a
  • Loading branch information
Juha Heiskanen committed Apr 2, 2019
1 parent 02942b0 commit f298cd3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
16 changes: 9 additions & 7 deletions source/6LoWPAN/ws/ws_bootstrap.c
Expand Up @@ -520,7 +520,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry

// Learning broadcast network configuration
if (neighbor_info->ws_neighbor->broadcast_shedule_info_stored) {
if (synch_req == WS_EAPOL_PARENT_SYNCH) {
if (synch_req != WS_EAPOL_PARENT_SYNCH) {
ws_fhss_set_defaults(cur, &fhss_configuration);
}
fhss_configuration.ws_bc_channel_function = (fhss_ws_channel_functions)neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_channel_function;
Expand All @@ -532,7 +532,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
fhss_configuration.fhss_bc_dwell_interval = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_dwell_interval;
fhss_configuration.fhss_broadcast_interval = neighbor_info->ws_neighbor->fhss_data.bc_timing_info.broadcast_interval;
fhss_configuration.broadcast_fixed_channel = cur->ws_info->fhss_bc_fixed_channel;

neighbor_info->ws_neighbor->synch_done = true;
}

ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);
Expand All @@ -544,9 +544,9 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
ws_bootstrap_llc_hopping_update(cur, &fhss_configuration);
}

void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info, ws_bs_ie_t *ws_bs_ie)
void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info)
{
if (neighbor_info->ws_neighbor->broadcast_shedule_info_stored || cur->ws_info->configuration_learned) {
if (cur->ws_info->configuration_learned || !neighbor_info->ws_neighbor->broadcast_shedule_info_stored || !neighbor_info->ws_neighbor->broadcast_timing_info_stored ) {
return;
}

Expand All @@ -555,9 +555,11 @@ void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur,
}

//Store Brodacst Shedule
ws_neighbor_class_neighbor_broadcast_schedule_set(neighbor_info->ws_neighbor, ws_bs_ie);

ws_bootstrap_primary_parent_set(cur, neighbor_info, WS_EAPOL_PARENT_SYNCH);
if (!neighbor_info->ws_neighbor->synch_done) {
ws_bootstrap_primary_parent_set(cur, neighbor_info, WS_EAPOL_PARENT_SYNCH);
} else {
ns_fhss_ws_set_parent(cur->ws_info->fhss_api, neighbor_info->neighbor->mac64, &neighbor_info->ws_neighbor->fhss_data.bc_timing_info, false);
}
}

static void ws_bootstrap_ll_address_validate(struct protocol_interface_info_entry *cur)
Expand Down
3 changes: 1 addition & 2 deletions source/6LoWPAN/ws/ws_bootstrap.h
Expand Up @@ -32,7 +32,6 @@ typedef enum {
#ifdef HAVE_WS

struct llc_neighbour_req;
struct ws_bs_ie;

int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode);

Expand Down Expand Up @@ -75,7 +74,7 @@ void ws_dhcp_client_address_delete(protocol_interface_info_entry_t *cur, uint8_t

bool ws_eapol_relay_state_active(protocol_interface_info_entry_t *cur);

void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, struct llc_neighbour_req *neighbor_info, struct ws_bs_ie *ws_bs_ie);
void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, struct llc_neighbour_req *neighbor_info);

#else

Expand Down
11 changes: 7 additions & 4 deletions source/6LoWPAN/ws/ws_llc_data_service.c
Expand Up @@ -539,18 +539,21 @@ static void ws_llc_mac_indication_cb(const mac_api_t *api, const mcps_data_ind_t
if (ws_wh_ea_read(ie_ext->headerIeList, ie_ext->headerIeListLength, auth_eui64)) {
ws_pae_controller_border_router_addr_write(base->interface_ptr, auth_eui64);
}
if (bs_ie_inline) {
ws_neighbor_class_neighbor_broadcast_schedule_set(neighbor_info.ws_neighbor, &ws_bs_ie);
}
}


//Update BT if it is part of message
ws_bt_ie_t ws_bt;
if (ws_wh_bt_read(ie_ext->headerIeList, ie_ext->headerIeListLength, &ws_bt)) {
ws_neighbor_class_neighbor_broadcast_time_info_update(neighbor_info.ws_neighbor, &ws_bt, data->timestamp);
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
// We have broadcast schedule set up set the broadcast parent schedule
ns_fhss_ws_set_parent(interface->ws_info->fhss_api, neighbor_info.neighbor->mac64, &neighbor_info.ws_neighbor->fhss_data.bc_timing_info, false);
} else if (ws_utt.message_type == WS_FT_EAPOL && bs_ie_inline) {
//Synch Broadcast Only 1 time when configuration is not learned
ws_bootstrap_eapol_parent_synch(interface, &neighbor_info, &ws_bs_ie);
} else if (ws_utt.message_type == WS_FT_EAPOL) {
ws_bootstrap_eapol_parent_synch(interface, &neighbor_info);
}
}

Expand Down Expand Up @@ -685,8 +688,8 @@ static void ws_llc_mpx_data_request(const mpx_api_t *api, const struct mcps_data
nested_wp_id.vp_ie = true;
}
} else if (user_id == MPX_KEY_MANAGEMENT_ENC_USER_ID) {
ie_header_mask.bt_ie = ws_eapol_relay_state_active(base->interface_ptr);
ie_header_mask.ea_ie = ws_eapol_handshake_first_msg(data->msdu, data->msduLength, base->interface_ptr);
ie_header_mask.bt_ie = ie_header_mask.ea_ie;
nested_wp_id.bs_ie = ie_header_mask.ea_ie;

}
Expand Down
1 change: 1 addition & 0 deletions source/6LoWPAN/ws/ws_neighbor_class.h
Expand Up @@ -31,6 +31,7 @@ typedef struct ws_neighbor_class_entry {
bool candidate_parent: 1;
bool broadcast_timing_info_stored: 1;
bool broadcast_shedule_info_stored: 1;
bool synch_done : 1;
} ws_neighbor_class_entry_t;

/**
Expand Down
2 changes: 1 addition & 1 deletion test/nanostack/unittest/stub/ws_bootstrap_stub.c
Expand Up @@ -116,7 +116,7 @@ bool ws_eapol_relay_state_active(protocol_interface_info_entry_t *cur)
return false;
}

void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info, ws_bs_ie_t *ws_bs_ie)
void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info)
{

}

0 comments on commit f298cd3

Please sign in to comment.