Skip to content

Commit

Permalink
Thread dev conf taken use (ARMmbed#1503)
Browse files Browse the repository at this point in the history
move ext_mac and ml_eid from link conf to dev conf
  • Loading branch information
Kari Severinkangas authored Dec 5, 2017
1 parent 5d5b239 commit ea93c1f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
2 changes: 0 additions & 2 deletions nanostack/thread_management_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ typedef struct link_configuration {
uint8_t master_key[16]; /**< Master key of the thread network*/
uint8_t PSKc[16]; /**< PSKc value that is calculated from commissioning credentials credentials,XPANID and network name*/
uint8_t mesh_local_ula_prefix[8]; /**< Mesh local ula prefix*/
uint8_t mesh_local_eid[8]; /**< Mesh local extented id*/
uint8_t extented_pan_id[8]; /**< Extended pan id*/
uint8_t extended_random_mac[8]; /**< Extended random mac which is generated during commissioning*/
uint8_t channel_mask[8]; /**< channel page and mask only supported is page 0*/
uint8_t channel_page;/**< channel page supported pages 0*/
char *PSKc_ptr; /**< Commissioning credentials. TODO! think if we need the actual credentials*/
Expand Down
12 changes: 0 additions & 12 deletions source/6LoWPAN/Thread/thread_joiner_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@ static void link_configuration_copy(link_configuration_s *this, link_configurati
if (!this || !configuration_ptr) {
return;
}

memcpy(this->extended_random_mac, configuration_ptr->extended_random_mac, 8);
memcpy(this->mesh_local_eid, configuration_ptr->mesh_local_eid,5);
memcpy(this->name, configuration_ptr->name, 16);
memcpy(this->PSKc, configuration_ptr->PSKc, 16);
memcpy(this->master_key, configuration_ptr->master_key, 16);
Expand Down Expand Up @@ -871,32 +868,23 @@ void thread_joiner_application_nvm_delete_callback(int status, void *context)

static void thread_joiner_application_validate_settings(thread_joiner_t *this)
{
if (memcmp(this->device_configuration_ptr->extended_random_mac,ADDR_UNSPECIFIED, 8) == 0) {
memcpy(this->device_configuration_ptr->extended_random_mac,this->configuration_ptr->extended_random_mac,8);
}
if (memcmp(this->device_configuration_ptr->extended_random_mac,ADDR_UNSPECIFIED, 8) == 0) {
randLIB_get_n_bytes_random(this->device_configuration_ptr->extended_random_mac, 8);
this->device_configuration_ptr->extended_random_mac[0] |= 2; //Set Local Bit
this->device_configuration_ptr->extended_random_mac[0] &= ~1; //Clear multicast bit
tr_info("Generating Random MAC");
memcpy(this->configuration_ptr->extended_random_mac,this->device_configuration_ptr->extended_random_mac,8);
}
if (memcmp(this->device_configuration_ptr->mesh_local_eid,ADDR_UNSPECIFIED,8)==0){
memcpy(this->device_configuration_ptr->mesh_local_eid,this->configuration_ptr->mesh_local_eid,8);
}
while (addr_iid_reserved(this->device_configuration_ptr->mesh_local_eid) ||
memcmp(this->device_configuration_ptr->mesh_local_eid, ADDR_SHORT_ADR_SUFFIC,6) == 0 ) {
// addr_iid_reserved checks the all zeroes case.
randLIB_get_n_bytes_random(this->device_configuration_ptr->mesh_local_eid, 8);
tr_info("Generating Random ML-EID");
memcpy(this->configuration_ptr->mesh_local_eid,this->device_configuration_ptr->mesh_local_eid,8);
}
if (this->configuration_ptr->key_rotation < 3600) {
this->configuration_ptr->key_rotation = 3600;
}
}


int thread_joiner_application_init(int8_t interface_id, device_configuration_s *device_configuration_ptr, link_configuration_s *default_configuration_ptr)
{
thread_joiner_t *this;
Expand Down

0 comments on commit ea93c1f

Please sign in to comment.