modem: ublox-sara-r4: implement 'is_supported' socket offload cb

Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP, TCP and TLS on top of IPv4 and IPv6.
TLS seems to be supported only in 1.2 version, so allow just that
version.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This commit is contained in:
Marcin Niestroj 2022-04-07 19:53:49 +02:00 committed by Marti Bolivar
parent 011739ae68
commit a0c5c176a0

View file

@ -1947,7 +1947,22 @@ static const struct socket_op_vtable offload_socket_fd_op_vtable = {
static bool offload_is_supported(int family, int type, int proto)
{
/* TODO offloading always enabled for now. */
if (family != AF_INET &&
family != AF_INET6) {
return false;
}
if (type != SOCK_DGRAM &&
type != SOCK_STREAM) {
return false;
}
if (proto != IPPROTO_TCP &&
proto != IPPROTO_UDP &&
proto != IPPROTO_TLS_1_2) {
return false;
}
return true;
}