提交 9a0fee2b 编写于 作者: W Willem de Bruijn 提交者: David S. Miller

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: eb4cb008 ("sock_diag: define destruction multicast groups")
Signed-off-by: NWillem de Bruijn <willemb@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ab8ed951
...@@ -36,6 +36,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk) ...@@ -36,6 +36,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;
...@@ -45,6 +48,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk) ...@@ -45,6 +48,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册