Skip to contentSkip to conversation

selinux: handle ICMPv6 consistently with ICMP

PATCH Applied Stephen Smalley 2 participants 2 messages Dec 8, 2016 – Dec 9, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: handle ICMPv6 consistently with ICMP

commit 79c8b348f215 ("selinux: support distinctions among all network address families") mapped datagram ICMP sockets to the new icmp_socket security class, but left ICMPv6 sockets unchanged. This change fixes that oversight to handle both kinds of sockets consistently.

---
 security/selinux/hooks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/selinux/hooks.c +2 -1
index 8a90a0b..b508a5a 100644
@@ -1295,7 +1295,8 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
 		case SOCK_DGRAM:
 			if (default_protocol_dgram(protocol))
 				return SECCLASS_UDP_SOCKET;
-			else if (extsockclass && protocol == IPPROTO_ICMP)
+			else if (extsockclass && (protocol == IPPROTO_ICMP ||
+						  protocol == IPPROTO_ICMPV6))
 				return SECCLASS_ICMP_SOCKET;
 			else
 				return SECCLASS_RAWIP_SOCKET;
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 9 lines · Stephen Smalley

commit 79c8b348f215 ("selinux: support distinctions among all network address families") mapped datagram ICMP sockets to the new icmp_socket security class, but left ICMPv6 sockets unchanged. This change fixes that oversight to handle both kinds of sockets consistently.

---
 security/selinux/hooks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Merged, thanks for fixing this.

Quoted 17 lines
security/selinux/hooks.c +2 -2
index 8a90a0b..b508a5a 100644
@@ -1295,7 +1295,8 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
                case SOCK_DGRAM:
                        if (default_protocol_dgram(protocol))
                                return SECCLASS_UDP_SOCKET;
-                       else if (extsockclass && protocol == IPPROTO_ICMP)
+                       else if (extsockclass && (protocol == IPPROTO_ICMP ||
+                                                 protocol == IPPROTO_ICMPV6))
                                return SECCLASS_ICMP_SOCKET;
                        else
                                return SECCLASS_RAWIP_SOCKET;
--

2.7.4

Signature · 2 lines
paul moore
www.paul-moore.com