Skip to content

drivers/modem: Need to store offloaded TLS options before offload connect #55713

@coran21

Description

@coran21

Is your enhancement proposal related to a problem? Please describe.
When offloading socket and TLS to the modem, the modem drivers create the socket in the modem during offloaded connect function, but the socket is created in the system and all the TLS options are set before actual offloaded connectfunction. Modem driver needs to store TLS options somewhere that it can set the options in the modem after the socket is created in the modem during offloaded connect function.

Describe the solution you'd like
The first thing which came to my mind is to extend modem_socket structure and add TLS options there, something like this:

__net_socket struct modem_socket {
	sa_family_t family;
	enum net_sock_type type;
	int ip_proto;
	struct sockaddr src;
	struct sockaddr dst;

	/** The number identifying the socket handle inside the modem */
	int id;

	/** The file descriptor identifying the socket in the fdtable */
	int sock_fd;

	/** packet data */
	uint16_t packet_sizes[CONFIG_MODEM_SOCKET_PACKET_COUNT];
	uint16_t packet_count;

	/** data ready semaphore */
	struct k_sem sem_data_ready;
	/** data ready poll signal */
	struct k_poll_signal sig_data_ready;

	/** socket state */
	bool is_connected;
	bool is_waiting;

	/** temporary socket data */
	void *data;

#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
	/** Secure tag, a reference to TLS credential */
	sec_tag_t sec_tag;
	/** Hostname for TLS hostname check */
	char hostname[255];
	/** Peer verification level. */
	uint8_t peer_verify_level;
#endif
};

I don't know if this is the right approach and appreciate any ideas or comment to solve this issue.

Describe alternatives you've considered
I considered also to create some static structure to keep this TLS options only inside the driver, but because it's related to the given socket, it would be more difficult to manage it.

Metadata

Metadata

Labels

EnhancementChanges/Updates/Additions to existing featuresarea: Modem

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions