Skip to content

Commit 025c681

Browse files
David Decotignydavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5f2d472 commit 025c681

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

net/netlink/af_netlink.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,14 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr,
10331033
return 0;
10341034
}
10351035

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+
10361044
static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)
10371045
{
10381046
struct sock *sock;
@@ -2494,7 +2502,7 @@ static const struct proto_ops netlink_ops = {
24942502
.accept = sock_no_accept,
24952503
.getname = netlink_getname,
24962504
.poll = datagram_poll,
2497-
.ioctl = sock_no_ioctl,
2505+
.ioctl = netlink_ioctl,
24982506
.listen = sock_no_listen,
24992507
.shutdown = sock_no_shutdown,
25002508
.setsockopt = netlink_setsockopt,

0 commit comments

Comments
 (0)