RE: sock_getsockopt() not exported
flat view
From: David Laight <hidden>
Date: 2012-10-18 12:09:11
On Thu, 2012-10-18 at 10:11 +0100, David Laight wrote:quoted
I've noticed that net/core/sock.c contains an EXPORT_SYMBOL(sock_setsockopt) but is missing the corresponding EXPORT_SYMBOL(sock_getsockopt) In-kernel users of sockets probably manage without needing to read SOL_SOCKET options. (They do need to set SO_REUSADDR and SO_KEEPALIVE.)sock_setsockopt() is exported because sunrpc needs it, and sunrpc can be a module sock_getsockopt() is not exported because no module needs it yet. The day one user needs it, we'll add the EXPORT_SYMBOL()
The problem is that it might be needed by an 'out of tree' driver.
We already have the function:
static int
do_getsockopt(struct socket *sock, int level, int name, void *val, int len)
{
mm_segment_t prevfs = get_fs();
int rval;
set_fs(KERNEL_DS);
if (level == SOL_SOCKET) {
/* There is no EXPORT_SYMBOL(sock_getsockopt) in net/core/sock.c */
rval = -EINVAL; // sock_getsockopt(sock, level, name, val, &len);
} else {
rval = sock->ops->getsockopt(sock, level, name, val, &len);
}
set_fs(prevfs);
return rval;
}
We need to get options (for SCTP) fortunately they aren't
SOL_SOCKET ones.
David