@@ -100,7 +100,7 @@ static void thread_bootstrap_client_router_id_release_cb(int8_t interface_id, in
100
100
static int thread_router_synch_accept_request_build (protocol_interface_info_entry_t * cur , mle_message_t * mle_msg , uint16_t shortAddress , uint8_t * challenge , uint8_t chalLen , uint8_t * tlvReq , uint8_t tlvReqLen );
101
101
static int thread_router_accept_to_endevice (protocol_interface_info_entry_t * cur , mle_message_t * mle_msg , uint8_t * challenge , uint8_t chalLen );
102
102
static int thread_router_accept_request_build (protocol_interface_info_entry_t * cur , mle_message_t * mle_msg , uint16_t shortAddress , uint8_t * challenge , uint8_t chalLen , uint8_t type , bool rssi_tlv , uint8_t rssi );
103
- static int thread_child_update_response (protocol_interface_info_entry_t * cur , uint8_t * dst_address , uint8_t mode , uint16_t short_address , uint32_t timeout , mle_tlv_info_t * addressRegisterTlv ,mle_tlv_info_t * tlvReq , mle_tlv_info_t * challengeTlv );
103
+ static int thread_child_update_response (protocol_interface_info_entry_t * cur , uint8_t * dst_address , uint8_t mode , uint16_t short_address , uint32_t timeout , mle_tlv_info_t * addressRegisterTlv ,mle_tlv_info_t * tlvReq , mle_tlv_info_t * challengeTlv , uint64_t active_timestamp , uint64_t pending_timestamp );
104
104
static int mle_build_and_send_data_response_msg (protocol_interface_info_entry_t * cur , uint8_t * dst_address , uint8_t * data_ptr , uint16_t data_len , mle_tlv_info_t * request_tlv , uint8_t mode );
105
105
static int thread_attach_parent_response_build (protocol_interface_info_entry_t * cur , uint8_t * dstAddress , uint8_t * challenge , uint16_t chalLen , uint8_t linkMargin , uint8_t scanMask , uint8_t mode );
106
106
static int mle_attach_child_id_response_build (protocol_interface_info_entry_t * cur , uint8_t * dstAddress ,thread_pending_child_id_req_t * child_req ,mle_neigh_table_entry_t * neigh_info );
@@ -681,16 +681,39 @@ static uint8_t *thread_tlv_add(protocol_interface_info_entry_t *cur, uint8_t *pt
681
681
return ptr ;
682
682
}
683
683
684
- static int thread_child_update_response (protocol_interface_info_entry_t * cur , uint8_t * dst_address , uint8_t mode , uint16_t short_address , uint32_t timeout , mle_tlv_info_t * addressRegisterTlv ,mle_tlv_info_t * tlvReq , mle_tlv_info_t * challengeTlv )
684
+ static int thread_child_update_response (protocol_interface_info_entry_t * cur , uint8_t * dst_address , uint8_t mode , uint16_t short_address , uint32_t timeout , mle_tlv_info_t * addressRegisterTlv ,mle_tlv_info_t * tlvReq , mle_tlv_info_t * challengeTlv , uint64_t active_timestamp , uint64_t pending_timestamp )
685
685
{
686
686
uint16_t i ;
687
687
uint16_t len = 64 ;
688
688
uint32_t keySequence ;
689
+ bool add_active_configuration = false;
690
+ bool add_pending_configuration = false;
691
+ uint64_t own_pending_timestamp = 0 ;
689
692
uint8_t * ptr ;
690
693
if (!thread_info (cur )) {
691
694
return -1 ;
692
695
}
696
+ link_configuration_s * link_configuration ;
697
+ link_configuration = thread_joiner_application_get_config (cur -> id );
698
+
699
+ if (!link_configuration ) {
700
+ return -1 ;
701
+ }
693
702
703
+ len += 10 ; // active timestamp tlv size
704
+ len += thread_pending_timestamp_tlv_size (cur );
705
+
706
+ if (!active_timestamp || active_timestamp != link_configuration -> timestamp ) {
707
+ len += thread_active_operational_dataset_size (cur );
708
+ add_active_configuration = true;
709
+ }
710
+ own_pending_timestamp = thread_joiner_application_pending_config_timestamp_get (cur -> id );
711
+ // if pending config is not in sync from requested device
712
+ if (!pending_timestamp ||
713
+ (own_pending_timestamp && own_pending_timestamp != pending_timestamp )) {
714
+ len += thread_pending_operational_dataset_size (cur );
715
+ add_pending_configuration = true;
716
+ }
694
717
if (tlvReq && tlvReq -> tlvLen ) {
695
718
mle_tlv_ignore (tlvReq -> dataPtr , tlvReq -> tlvLen , MLE_TYPE_LL_FRAME_COUNTER );
696
719
len += thread_tlv_len (cur , tlvReq -> dataPtr , tlvReq -> tlvLen , mode );
@@ -743,6 +766,16 @@ static int thread_child_update_response(protocol_interface_info_entry_t *cur, ui
743
766
if (mle_tlv_requested (tlvReq -> dataPtr , tlvReq -> tlvLen , MLE_TYPE_ADDRESS16 )) {
744
767
ptr = mle_tlv_write_short_address (ptr , short_address );
745
768
}
769
+ if (mle_tlv_requested (tlvReq -> dataPtr , tlvReq -> tlvLen , MLE_TYPE_NETWORK_DATA )) {
770
+ ptr = thread_active_timestamp_write (cur ,ptr );
771
+ ptr = thread_pending_timestamp_write (cur ,ptr );
772
+ if (add_active_configuration ) {
773
+ ptr = thread_active_operational_dataset_write (cur , ptr );
774
+ }
775
+ if (add_pending_configuration ) {
776
+ ptr = thread_pending_operational_dataset_write (cur , ptr );
777
+ }
778
+ }
746
779
}
747
780
748
781
if (mle_service_update_length_by_ptr (bufId ,ptr )!= 0 ) {
@@ -1826,6 +1859,8 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
1826
1859
uint8_t mode ;
1827
1860
uint8_t status ;
1828
1861
uint32_t timeout = 0 ;
1862
+ uint64_t active_timestamp = 0 ;
1863
+ uint64_t pending_timestamp = 0 ;
1829
1864
mle_tlv_info_t addressRegisterTlv = {0 };
1830
1865
mle_tlv_info_t challengeTlv = {0 };
1831
1866
mle_tlv_info_t tlv_req = {0 };
@@ -1859,6 +1894,8 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
1859
1894
1860
1895
addressRegisterTlv .tlvType = MLE_TYPE_UNASSIGNED ;
1861
1896
mle_tlv_read_tlv (MLE_TYPE_ADDRESS_REGISTRATION , mle_msg -> data_ptr , mle_msg -> data_length , & addressRegisterTlv );
1897
+ mle_tlv_read_64_bit_tlv (MLE_TYPE_ACTIVE_TIMESTAMP , mle_msg -> data_ptr , mle_msg -> data_length , & active_timestamp );
1898
+ mle_tlv_read_64_bit_tlv (MLE_TYPE_PENDING_TIMESTAMP , mle_msg -> data_ptr , mle_msg -> data_length , & pending_timestamp );
1862
1899
1863
1900
mle_tlv_read_tlv (MLE_TYPE_TLV_REQUEST , mle_msg -> data_ptr , mle_msg -> data_length , & tlv_req );
1864
1901
@@ -1881,7 +1918,7 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
1881
1918
1882
1919
tr_debug ("Keep-Alive -->Respond Child" );
1883
1920
//Response
1884
- thread_child_update_response (cur , mle_msg -> packet_src_address , mode , entry_temp -> short_adr , timeout , & addressRegisterTlv , & tlv_req , & challengeTlv );
1921
+ thread_child_update_response (cur , mle_msg -> packet_src_address , mode , entry_temp -> short_adr , timeout , & addressRegisterTlv , & tlv_req , & challengeTlv , active_timestamp , pending_timestamp );
1885
1922
1886
1923
}
1887
1924
break ;
0 commit comments