Commit 025c6818 authored by David Decotigny's avatar David Decotigny Committed by David S. Miller

netlink: add support for NIC driver ioctls

By returning -ENOIOCTLCMD, sock_do_ioctl() falls back to calling
dev_ioctl(), which provides support for NIC driver ioctls, which
includes ethtool support. This is similar to the way ioctls are handled
in udp.c or tcp.c.

This removes the requirement that ethtool for example be tied to the
support of a specific L3 protocol (ethtool uses an AF_INET socket
today).
Signed-off-by: default avatarDavid Decotigny <decot@googlers.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f2d4724
...@@ -1033,6 +1033,14 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr, ...@@ -1033,6 +1033,14 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr,
return 0; return 0;
} }
static int netlink_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg)
{
/* try to hand this ioctl down to the NIC drivers.
*/
return -ENOIOCTLCMD;
}
static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid) static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)
{ {
struct sock *sock; struct sock *sock;
...@@ -2494,7 +2502,7 @@ static const struct proto_ops netlink_ops = { ...@@ -2494,7 +2502,7 @@ static const struct proto_ops netlink_ops = {
.accept = sock_no_accept, .accept = sock_no_accept,
.getname = netlink_getname, .getname = netlink_getname,
.poll = datagram_poll, .poll = datagram_poll,
.ioctl = sock_no_ioctl, .ioctl = netlink_ioctl,
.listen = sock_no_listen, .listen = sock_no_listen,
.shutdown = sock_no_shutdown, .shutdown = sock_no_shutdown,
.setsockopt = netlink_setsockopt, .setsockopt = netlink_setsockopt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment