Skip to contentSkip to conversation

sock_diag: do not broadcast raw socket destruction

PATCH In review Willem de Bruijn 2 participants 2 messages Jun 24, 2016 – Jun 28, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sock_diag: do not broadcast raw socket destruction

From: Willem de Bruijn <[email protected]>

Diag intends to broadcast tcp_sk and udp_sk socket destruction. Testing sk->sk_protocol for IPPROTO_TCP/IPPROTO_UDP alone is not sufficient for this. Raw sockets can have the same type.

Add a test for sk->sk_type.

Fixes eb4cb008529c ("sock_diag: define destruction multicast groups")
---
 include/linux/sock_diag.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/sock_diag.h +6 -0
index 4018b48..a0596ca0 100644
@@ -36,6 +36,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
 {
 	switch (sk->sk_family) {
 	case AF_INET:
+		if (sk->sk_type == SOCK_RAW)
+			return SKNLGRP_NONE;
+
 		switch (sk->sk_protocol) {
 		case IPPROTO_TCP:
 			return SKNLGRP_INET_TCP_DESTROY;
@@ -45,6 +48,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
 			return SKNLGRP_NONE;
 		}
 	case AF_INET6:
+		if (sk->sk_type == SOCK_RAW)
+			return SKNLGRP_NONE;
+
 		switch (sk->sk_protocol) {
 		case IPPROTO_TCP:
 			return SKNLGRP_INET6_TCP_DESTROY;
Signature · 1 line
2.8.0.rc3.226.g39d4020
maintainer
#1 lore raw

From: Willem de Bruijn <[email protected]>
Date: Fri, 24 Jun 2016 16:02:35 -0400

Quoted 10 lines

From: Willem de Bruijn <[email protected]>

Diag intends to broadcast tcp_sk and udp_sk socket destruction. Testing sk->sk_protocol for IPPROTO_TCP/IPPROTO_UDP alone is not sufficient for this. Raw sockets can have the same type.

Add a test for sk->sk_type.

Fixes eb4cb008529c ("sock_diag: define destruction multicast groups")

Applied and queued up for -stable, thanks.