[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKD1Yr2qyKCmfo75+OpsfqrUoFquXiA_GqwVr_BsU1AW5MmPbQ@mail.gmail.com>
Date: Thu, 3 Dec 2015 00:18:10 +0900
From: Lorenzo Colitti <lorenzo@...gle.com>
To: Tom Herbert <tom@...bertland.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Eric Dumazet <eric.dumazet@...il.com>,
Erik Kline <ek@...gle.com>,
Maciej Żenczykowski <zenczykowski@...il.com>
Subject: Re: Add a SOCK_DESTROY operation to close sockets from userspace
On Tue, Dec 1, 2015 at 11:53 AM, Tom Herbert <tom@...bertland.com> wrote:
> This is awesome! The only thing I would suggest is to make
> sock_destroy a proto_op so that it can be called from within the
> kernel. This should be preferred to externally calling tcp_done
> (hopefully we can unexport that symbol then).
I'm not sure there is value in making it a proto op. The sock_diag
code that finds the socket based on the netlink diag request is
specific to both the protocol family (e.g., the sock_diag structures
for inet and unix differ) and protocol (e.g., TCP, UDPv4 and UDPv6 use
different hash tables).
So even if we add a proto_op (or struct proto function pointer) to
destroy a socket, we can't just have a generic function (or even an
inet-specific function) that just finds a socket and does "return
sk->sk_prot->diag_destroy(sk)" regardless of what protocol that socket
is.
The code does look better if the protocol-specific code is moved to a
new tcp_abort function that just takes a pointer to the sk.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists