sock_diag: do not broadcast raw socket destruction
[ Upstream commit 9a0fee2b552b1235fb1706ae1fc664ae74573be8 ]
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: eb4cb00852
("sock_diag: define destruction multicast groups")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
688feac489
commit
348a1cd82c
1 changed files with 6 additions and 0 deletions
|
@ -35,6 +35,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
|
||||||
{
|
{
|
||||||
switch (sk->sk_family) {
|
switch (sk->sk_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
if (sk->sk_type == SOCK_RAW)
|
||||||
|
return SKNLGRP_NONE;
|
||||||
|
|
||||||
switch (sk->sk_protocol) {
|
switch (sk->sk_protocol) {
|
||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
return SKNLGRP_INET_TCP_DESTROY;
|
return SKNLGRP_INET_TCP_DESTROY;
|
||||||
|
@ -44,6 +47,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk)
|
||||||
return SKNLGRP_NONE;
|
return SKNLGRP_NONE;
|
||||||
}
|
}
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
if (sk->sk_type == SOCK_RAW)
|
||||||
|
return SKNLGRP_NONE;
|
||||||
|
|
||||||
switch (sk->sk_protocol) {
|
switch (sk->sk_protocol) {
|
||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
return SKNLGRP_INET6_TCP_DESTROY;
|
return SKNLGRP_INET6_TCP_DESTROY;
|
||||||
|
|
Loading…
Add table
Reference in a new issue