mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 23:39:18 +00:00
sock_diag: do not broadcast raw socket destruction
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") Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ab8ed95108
commit
9a0fee2b55
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user