Skip to content

Commit

Permalink
Rename some parameters which will help integration to new neighbor ta…
Browse files Browse the repository at this point in the history
…ble.

Change-Id: Idccaa012f4593585885316a4a5b320d5c7178774
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Jun 25, 2018
1 parent fde5104 commit 7a0aaa5
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ int8_t protocol_6lowpan_neighbor_address_state_synch(protocol_interface_info_ent
mle_entry->short_adr = common_read_16_bit(iid);
}
if ((mle_entry->mode & MLE_DEV_MASK) == MLE_RFD_DEV) {
if (mle_entry->handshakeReady) {
if (mle_entry->connected_device) {
mle_entry_timeout_refresh(mle_entry);
}
ret_val = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static uint8_t *mle_table_set_neighbours(int8_t interface_id, uint8_t *ptr)

loop_list = false;

if ((cur->handshakeReady) && (cur->link_q_adv_sent == false)) {
if ((cur->connected_device) && (cur->link_q_adv_sent == false)) {

// If looping list, stops adding entries when at first sent entry again
if (first_entry_ptr == cur) {
Expand Down Expand Up @@ -1086,7 +1086,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml

incoming_idr = mle_calculate_idr(interface_id, mle_msg, entry_temp);

if (entry_temp && entry_temp->handshakeReady) {
if (entry_temp && entry_temp->connected_device) {
response_type = MLE_COMMAND_ACCEPT;
} else {
response_type = MLE_COMMAND_ACCEPT_AND_REQUEST;
Expand Down Expand Up @@ -1128,7 +1128,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml

//Response state set now timeout know positive state
mle_service_set_msg_response_true(responseId);
entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;

mac_data_poll_protocol_poll_mode_decrement(cur);

Expand Down Expand Up @@ -1221,7 +1221,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
//UPDATE
mle_neigh_entry_update_by_mle_tlv_list(cur->id,entry_temp, mle_msg->data_ptr, mle_msg->data_length, cur->mac, own_mac16);
mle_neigh_entry_frame_counter_update(entry_temp, mle_msg->data_ptr, mle_msg->data_length, cur, security_headers->KeyIndex);
if (entry_temp->handshakeReady) {
if (entry_temp->connected_device) {
mle_entry_timeout_refresh(entry_temp);
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/MAC/mac_pairwise_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int mac_pairwise_key_add(int8_t interface_id, uint32_t valid_life_time, const ui
return -1;
}

mle_entry->thread_commission = true;
mle_entry->trusted_device = true;
mle_entry->short_adr = 0xffff;
mle_entry->ttl = 20;

Expand Down
6 changes: 3 additions & 3 deletions source/6LoWPAN/Thread/thread_host_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ static int thread_end_device_synch_response_validate(protocol_interface_info_ent
*/
entry_temp->short_adr = srcAddress;
entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;
entry_temp->priorityFlag = true; // Make this our parent
common_write_16_bit(entry_temp->short_adr, shortAddress);

Expand Down Expand Up @@ -845,7 +845,7 @@ static void thread_mle_child_request_receive_cb(int8_t interface_id, mle_message
//Update possible reed address by real router address
scan_result->shortAddress = entry_temp->short_adr;

entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;
entry_temp->priorityFlag = true;

mac_helper_coordinator_address_set(cur, ADDR_802_15_4_SHORT, shortAddress);
Expand Down Expand Up @@ -964,7 +964,7 @@ void thread_endevice_synch_start(protocol_interface_info_entry_t *cur)
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);

entry_temp->short_adr = cur->thread_info->thread_endnode_parent->shortAddress;
entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;

// In case we don't get response to sync; use temporary timeout here,
// Child ID Response handler will set correct value later
Expand Down
8 changes: 4 additions & 4 deletions source/6LoWPAN/Thread/thread_mle_message_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static bool thread_router_leader_data_process(protocol_interface_info_entry_t *c
int leaderDataUpdate = thread_leader_data_validation(cur, leaderData, routeTlv);

if (leaderDataUpdate == 1) {
if (neighbor && neighbor->handshakeReady == 1) {
if (neighbor && neighbor->connected_device == 1) {
// Request network data if we have a 2-way link
tr_debug("Request New Network Data from %s", trace_ipv6(src_address));
thread_network_data_request_send(cur, src_address, true);
Expand Down Expand Up @@ -486,10 +486,10 @@ static void thread_parse_accept(protocol_interface_info_entry_t *cur, mle_messag

if (thread_i_am_router(cur) && thread_is_router_addr(entry_temp->short_adr)) {
// If we both are routers, mark the link as 2-way
entry_temp->handshakeReady = 1;
tr_debug("Marked link as 2-way, handshakeReady=%d", entry_temp->handshakeReady);
entry_temp->connected_device = 1;
tr_debug("Marked link as 2-way, handshakeReady=%d", entry_temp->connected_device);
} else {
tr_debug("Marked link as 1-way, handshakeReady=%d", entry_temp->handshakeReady);
tr_debug("Marked link as 1-way, handshakeReady=%d", entry_temp->connected_device);
}

blacklist_update(mle_msg->packet_src_address, true);
Expand Down
12 changes: 6 additions & 6 deletions source/6LoWPAN/Thread/thread_router_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ static void thread_router_synch_receive_cb(int8_t interface_id, mle_message_t *m
}

if (thread_is_router_addr(shortAddress)) {
entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;
}

entry_temp->mode |= MLE_THREAD_REQ_FULL_DATA_SET;
Expand Down Expand Up @@ -1331,7 +1331,7 @@ void thread_router_bootstrap_child_id_handler(protocol_interface_info_entry_t *c

mle_entry_timeout_update(entry_temp, req->timeout);
entry_temp->mode = req->mode;
entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;
mle_service_frame_counter_entry_add(cur->id, entry_temp->attribute_index, req->mleFrameCounter);

if (req->shortAddressReq) {
Expand Down Expand Up @@ -1747,7 +1747,7 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
*
*/

if (entry_temp && entry_temp->handshakeReady) {
if (entry_temp && entry_temp->connected_device) {
mle_entry_timeout_refresh(entry_temp);
thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->attribute_index,linkMargin, false);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->attribute_index);
Expand Down Expand Up @@ -1785,7 +1785,7 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
update_mac_mib = true;
entry_temp->short_adr = shortAddress; // short address refreshed

if (entry_temp->handshakeReady) {
if (entry_temp->connected_device) {
if (mle_tlv_read_tlv(MLE_TYPE_ADDRESS_REGISTRATION, mle_msg->data_ptr, mle_msg->data_length, &addressRegisteredTlv)) {
if (thread_rfd_device(entry_temp->mode)) {
thread_address_registration_tlv_parse(addressRegisteredTlv.dataPtr, addressRegisteredTlv.tlvLen, cur, entry_temp->short_adr, entry_temp->mac64);
Expand Down Expand Up @@ -1886,7 +1886,7 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
}

if (thread_is_router_addr(shortAddress)) {
entry_temp->handshakeReady = 1;
entry_temp->connected_device = 1;
}

entry_temp->mode |= MLE_THREAD_REQ_FULL_DATA_SET;
Expand Down Expand Up @@ -2282,7 +2282,7 @@ int thread_router_bootstrap_route_tlv_push(protocol_interface_info_entry_t *cur,

/* XXX Is short_src_adr ever reset? Is it undefined if info not in msg? */
/* Don't add routing link if MLE link is NOT bi-directional (i.e. we can only hear) */
if (entry->handshakeReady) {
if (entry->connected_device) {
thread_routing_add_link(cur, entry->short_adr, linkMargin, route_id_seq, router_id_mask, route_data, false);
}

Expand Down
6 changes: 3 additions & 3 deletions source/6LoWPAN/adaptation_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ buffer_t * lowpan_adaptation_data_process_tx_preprocess(protocol_interface_info_
//Validate neighbour
if (!buf->options.ll_security_bypass_tx && mle_entry) {

if (mle_entry->handshakeReady || mle_entry->thread_commission) {
if (mle_entry->connected_device || mle_entry->trusted_device) {

} else {
//tr_warn("Drop TX to unassociated %s", trace_sockaddr(&buf->dst_sa, true));
Expand All @@ -651,7 +651,7 @@ buffer_t * lowpan_adaptation_data_process_tx_preprocess(protocol_interface_info_

if (!buf->link_specific.ieee802_15_4.requestAck ) {
buf->link_specific.ieee802_15_4.key_id_mode = B_SECURITY_KEY_ID_MODE_DEFAULT;
} else if (ws_info(cur) || (mle_entry && !mle_entry->thread_commission)) {
} else if (ws_info(cur) || (mle_entry && !mle_entry->trusted_device)) {
buf->link_specific.ieee802_15_4.key_id_mode = B_SECURITY_KEY_ID_MODE_DEFAULT;
} else {
buf->link_specific.ieee802_15_4.key_id_mode = B_SECURITY_KEY_ID_IMPLICIT;
Expand Down Expand Up @@ -1165,7 +1165,7 @@ static bool mcps_data_indication_neighbor_validate(int8_t interface_id, const so
return true;
}
mle_neigh_table_entry_t *mle_entry = mle_class_get_by_link_address(interface_id, addr->address + 2, addr->addr_type);
if (mle_entry && (mle_entry->handshakeReady || mle_entry->thread_commission)) {
if (mle_entry && (mle_entry->connected_device || mle_entry->trusted_device)) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion source/MLE/mle.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ static void mle_refresh_entry(mle_neigh_table_entry_t *neig_info, bool dataPollC
if (!neig_info) {
return;
}
if (!neig_info->handshakeReady) {
if (!neig_info->connected_device) {
tr_debug("refresh:Link Handshake not ready yet");
return;
}
Expand Down
6 changes: 3 additions & 3 deletions source/MLE/mle.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ typedef struct mle_neigh_table_entry_t {
uint16_t short_adr;
uint8_t mode;
unsigned link_q_adv_sent: 1;
unsigned medium_ttl_challenge: 1;
unsigned priority_child_flag: 1; /* Is using our node as preferred parent */
unsigned second_priority_flag: 1; /* Is secondary parent */
unsigned thread_commission: 1;
unsigned priorityFlag: 1;
unsigned handshakeReady: 1;
unsigned medium_ttl_challenge: 1;
unsigned trusted_device: 1; /*!< True mean use normal group key, false for enable pairwise key */
unsigned connected_device: 1; /*!< True Link is connected and data rx is accepted , False RX data is not accepted */
ns_list_link_t link;
} mle_neigh_table_entry_t ;

Expand Down

0 comments on commit 7a0aaa5

Please sign in to comment.