From f9e2fad7e317dcea0bc22563a9397e20ae733a4e Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Thu, 7 Apr 2022 20:21:11 +0200 Subject: [PATCH] modem: quectel-bg9x: 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 TCP on top of IPv4 and IPv6. Signed-off-by: Marcin Niestroj --- drivers/modem/quectel-bg9x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/modem/quectel-bg9x.c b/drivers/modem/quectel-bg9x.c index acd50af34c4..fcae3c6b193 100644 --- a/drivers/modem/quectel-bg9x.c +++ b/drivers/modem/quectel-bg9x.c @@ -1085,6 +1085,19 @@ 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_STREAM) { + return false; + } + + if (proto != IPPROTO_TCP) { + return false; + } + return true; }