From 7053bb2d28bda190040e4cca1236612e6b0926b3 Mon Sep 17 00:00:00 2001 From: bernard Date: Sun, 18 Oct 2026 19:33:53 +0800 Subject: [PATCH 1/2] [net][sal] validate RAW socket protocol - replace the IPPROTO_RAW-only check with VALID_PROTOCOL() - allow RAW sockets for protocols such as ICMP - keep the existing domain and type validation unchanged --- components/net/sal/src/sal_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/net/sal/src/sal_socket.c b/components/net/sal/src/sal_socket.c index 509da973e2bb..728263d16f02 100644 --- a/components/net/sal/src/sal_socket.c +++ b/components/net/sal/src/sal_socket.c @@ -49,7 +49,7 @@ (((domain) == AF_INET || (domain) == AF_INET6) && \ (((type) == SOCK_STREAM && ((protocol) == 0 || (protocol) == IPPROTO_TCP)) || \ ((type) == SOCK_DGRAM && ((protocol) == 0 || (protocol) == IPPROTO_UDP)) || \ - ((type) == SOCK_RAW && ((protocol) == IPPROTO_RAW)))) || \ + ((type) == SOCK_RAW && VALID_PROTOCOL(protocol)))) || \ ((domain) == AF_UNIX && ((type) == SOCK_STREAM || (type) == SOCK_DGRAM) && (protocol) == 0) || \ ((domain) == AF_NETLINK && (type) == SOCK_RAW && (protocol) == 0)) From 0df286465f0f75e567e60cefe094ebdeef0b33b8 Mon Sep 17 00:00:00 2001 From: bernard Date: Sun, 18 Oct 2026 20:41:30 +0800 Subject: [PATCH 2/2] [net][sal] fix clang-format alignment - align the macro continuation after the RAW protocol check - no functional change --- components/net/sal/src/sal_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/net/sal/src/sal_socket.c b/components/net/sal/src/sal_socket.c index 728263d16f02..2367e1441ca4 100644 --- a/components/net/sal/src/sal_socket.c +++ b/components/net/sal/src/sal_socket.c @@ -49,7 +49,7 @@ (((domain) == AF_INET || (domain) == AF_INET6) && \ (((type) == SOCK_STREAM && ((protocol) == 0 || (protocol) == IPPROTO_TCP)) || \ ((type) == SOCK_DGRAM && ((protocol) == 0 || (protocol) == IPPROTO_UDP)) || \ - ((type) == SOCK_RAW && VALID_PROTOCOL(protocol)))) || \ + ((type) == SOCK_RAW && VALID_PROTOCOL(protocol)))) || \ ((domain) == AF_UNIX && ((type) == SOCK_STREAM || (type) == SOCK_DGRAM) && (protocol) == 0) || \ ((domain) == AF_NETLINK && (type) == SOCK_RAW && (protocol) == 0))