@@ -794,7 +794,7 @@ uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr,
794
794
msg_tr_ptr -> socket = dhcp_service -> dhcp_client_socket ;
795
795
msg_tr_ptr -> recv_resp_cb = receive_resp_cb ;
796
796
msg_tr_ptr -> delayed_tx = delay_tx ;
797
- msg_tr_ptr -> first_transmit_time = protocol_core_monotonic_time ;
797
+ msg_tr_ptr -> first_transmit_time = 0 ;
798
798
dhcp_tr_set_retry_timers (msg_tr_ptr , msg_tr_ptr -> msg_ptr [0 ]);
799
799
common_write_24_bit (msg_tr_ptr -> msg_tr_id , & msg_tr_ptr -> msg_ptr [1 ]);
800
800
@@ -852,8 +852,9 @@ void dhcp_service_send_message(msg_tr_t *msg_tr_ptr)
852
852
const uint32_t address_pref = SOCKET_IPV6_PREFER_SRC_6LOWPAN_SHORT ;
853
853
dhcp_options_msg_t elapsed_time ;
854
854
855
- if (libdhcpv6_message_option_discover ((msg_tr_ptr -> msg_ptr + 4 ), (msg_tr_ptr -> msg_len - 4 ), DHCPV6_ELAPSED_TIME_OPTION , & elapsed_time ) == 0 &&
855
+ if (msg_tr_ptr -> first_transmit_time && libdhcpv6_message_option_discover ((msg_tr_ptr -> msg_ptr + 4 ), (msg_tr_ptr -> msg_len - 4 ), DHCPV6_ELAPSED_TIME_OPTION , & elapsed_time ) == 0 &&
856
856
elapsed_time .len == 2 ) {
857
+
857
858
uint32_t t = protocol_core_monotonic_time - msg_tr_ptr -> first_transmit_time ; // time in 1/10s ticks
858
859
uint16_t cs ;
859
860
if (t > 0xffff / 10 ) {
@@ -926,6 +927,10 @@ void dhcp_service_send_message(msg_tr_t *msg_tr_ptr)
926
927
int16_t tc = 0 ;
927
928
socket_setsockopt (msg_tr_ptr -> socket , SOCKET_IPPROTO_IPV6 , SOCKET_IPV6_TCLASS , & tc , sizeof (tc ));
928
929
retval = socket_sendto (msg_tr_ptr -> socket , & msg_tr_ptr -> addr , msg_tr_ptr -> msg_ptr , msg_tr_ptr -> msg_len );
930
+ if (msg_tr_ptr -> first_transmit_time == 0 && retval == 0 ) {
931
+ //Mark first pushed message timestamp
932
+ msg_tr_ptr -> first_transmit_time = protocol_core_monotonic_time ? protocol_core_monotonic_time : 1 ;
933
+ }
929
934
}
930
935
}
931
936
if (retval != 0 ) {
0 commit comments