[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B7053@saturn3.aculab.com>
Date: Thu, 18 Oct 2012 13:03:55 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Eric Dumazet" <eric.dumazet@...il.com>
Cc: <netdev@...r.kernel.org>
Subject: RE: sock_getsockopt() not exported
> On Thu, 2012-10-18 at 10:11 +0100, David Laight wrote:
> > 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
Powered by blists - more mailing lists