[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
This commit is contained in:
Bernard Xiong authored and GitHub committed 2026-10-27 19:21:16 +08:00
1 parent f29b9ae21c
commit 9e7065c85a
1 file changed
+1 -1
+1 -1
View File
@@ -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))