From 61dfdf1d60075785f926ae8f21374fe04222fb6f Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Thu, 7 Apr 2022 20:14:46 +0200 Subject: [PATCH] modem: sim7080: 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 and TCP on top of IPv4 and IPv6. Signed-off-by: Marcin Niestroj --- drivers/modem/simcom-sim7080.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/modem/simcom-sim7080.c b/drivers/modem/simcom-sim7080.c index 2a843ab77e2..f5637062634 100644 --- a/drivers/modem/simcom-sim7080.c +++ b/drivers/modem/simcom-sim7080.c @@ -746,6 +746,21 @@ static struct net_if_api api_funcs = { static bool offload_is_supported(int family, int type, int proto) { + 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) { + return false; + } + return true; }