summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2026-10-27 19:21:16 +0800
committerGitHub <[email protected]>2026-10-27 19:21:16 +0800
commit9e7065c85af89b207b8b63d40641a3b3fdcbc96c (patch)
treec7a428540ac3a2d920dfc65f78faa6f58b46e318 /components
parentf29b9ae21ccd70e749324b3f13cba6d843fc642d (diff)
[net][sal] validate RAW socket protocol (#11888)
* [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 * [net][sal] fix clang-format alignment - align the macro continuation after the RAW protocol check - no functional change
Diffstat (limited to 'components')
-rw-r--r--components/net/sal/src/sal_socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/net/sal/src/sal_socket.c b/components/net/sal/src/sal_socket.c
index 509da973e2..2367e1441c 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))