Skip to content

Commit

Permalink
Bluetooth: Add option for disabling legacy ioctl interfaces
Browse files Browse the repository at this point in the history
The legacy ioctl interfaces are only useful for BR/EDR operation and
since Linux 3.4 no longer needed anyway. This options allows disabling
them alltogether and use only management interfaces for setup and
control.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Aug 30, 2017
1 parent 96a1c17 commit dbbccdc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,14 @@ config BT_DEBUGFS
Provide extensive information about internal Bluetooth states
in debugfs.

config BT_LEGACY_IOCTL
bool "Enable legacy ioctl interfaces"
depends on BT && BT_BREDR
default y
help
Enable support for legacy ioctl interfaces. This is only needed
for old and deprecated applications using direct ioctl calls for
controller management. Since Linux 3.4 all configuration and
setup is done via mgmt interface and this is no longer needed.

source "drivers/bluetooth/Kconfig"
6 changes: 6 additions & 0 deletions net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ static int hci_sock_release(struct socket *sock)
return 0;
}

#ifdef CONFIG_BT_LEGACY_IOCTL
static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg)
{
bdaddr_t bdaddr;
Expand Down Expand Up @@ -1049,6 +1050,7 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd,
release_sock(sk);
return err;
}
#endif

static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len)
Expand Down Expand Up @@ -1969,7 +1971,11 @@ static const struct proto_ops hci_sock_ops = {
.getname = hci_sock_getname,
.sendmsg = hci_sock_sendmsg,
.recvmsg = hci_sock_recvmsg,
#ifdef CONFIG_BT_LEGACY_IOCTL
.ioctl = hci_sock_ioctl,
#else
.ioctl = sock_no_ioctl,
#endif
.poll = datagram_poll,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
Expand Down

0 comments on commit dbbccdc

Please sign in to comment.