Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: David Decotigny <decot@googlers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Decotigny and committed by
David S. Miller
025c6818 5f2d4724

+9 -1
+9 -1
net/netlink/af_netlink.c
··· 1033 1033 return 0; 1034 1034 } 1035 1035 1036 + static int netlink_ioctl(struct socket *sock, unsigned int cmd, 1037 + unsigned long arg) 1038 + { 1039 + /* try to hand this ioctl down to the NIC drivers. 1040 + */ 1041 + return -ENOIOCTLCMD; 1042 + } 1043 + 1036 1044 static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid) 1037 1045 { 1038 1046 struct sock *sock; ··· 2502 2494 .accept = sock_no_accept, 2503 2495 .getname = netlink_getname, 2504 2496 .poll = datagram_poll, 2505 - .ioctl = sock_no_ioctl, 2497 + .ioctl = netlink_ioctl, 2506 2498 .listen = sock_no_listen, 2507 2499 .shutdown = sock_no_shutdown, 2508 2500 .setsockopt = netlink_setsockopt,