Skip to content

Commit

Permalink
Set interface index from incoming message if not set in TLS peer
Browse files Browse the repository at this point in the history
This commit handles the case where the connection is initialized
by IoTivity-Lite (oc_tls_init_connection).

Example: Cloud Manager
  • Loading branch information
jkralik authored and Daniel Adam committed Nov 10, 2023
1 parent 621b8bf commit aa5f4d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions security/oc_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3020,6 +3020,13 @@ oc_tls_recv_message(oc_message_t *message)
u, message->length, (void *)peer);
#endif /* OC_DBG_IS_ENABLED */

// Set the interface index from the incoming message if the network interface
// is not set in the peer. This case occurs when the connection is initialized
// by IoTivity-Lite (oc_tls_init_connection). Example: Cloud Manager
if (peer->endpoint.interface_index == 0) {
peer->endpoint.interface_index = message->endpoint.interface_index;
}

oc_list_add(peer->recv_q, message);
peer->timestamp = oc_clock_time_monotonic();
oc_tls_handler_schedule_read(peer);
Expand Down

0 comments on commit aa5f4d7

Please sign in to comment.