summaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-03-14 19:27:59 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-15 09:56:41 +0200
commitc08b1a1dba524c1cdef331c1f169db3a1b37bb4c (patch)
treee4b2abbdb127002e22ae36b1c1a124cfaae7bf5f /net/bluetooth/mgmt.c
parent50ebc055fa758c731e6e1ce174608327aab07aec (diff)
downloadlinux-exynos-c08b1a1dba524c1cdef331c1f169db3a1b37bb4c.tar.gz
linux-exynos-c08b1a1dba524c1cdef331c1f169db3a1b37bb4c.tar.bz2
linux-exynos-c08b1a1dba524c1cdef331c1f169db3a1b37bb4c.zip
Bluetooth: Consolidate socket channel sending function back into one
With the introduction of trusted socket flag for control and monitor channels, it is now possible to use a single function for sending packets to these sockets. And with that consolidate the handling. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ff636bd9523b..1e5afa76e371 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -224,7 +224,7 @@ static u8 mgmt_status(u8 hci_status)
static int mgmt_send_event(u16 event, struct hci_dev *hdev,
unsigned short channel, void *data, u16 data_len,
- struct sock *skip_sk)
+ int flag, struct sock *skip_sk)
{
struct sk_buff *skb;
struct mgmt_hdr *hdr;
@@ -247,44 +247,24 @@ static int mgmt_send_event(u16 event, struct hci_dev *hdev,
/* Time stamp */
__net_timestamp(skb);
- hci_send_to_channel(channel, skb, skip_sk);
+ hci_send_to_channel(channel, skb, flag, skip_sk);
kfree_skb(skb);
return 0;
}
-static int mgmt_index_event(u16 event, struct hci_dev *hdev,
- void *data, u16 data_len, int flag)
+static int mgmt_index_event(u16 event, struct hci_dev *hdev, void *data,
+ u16 len, int flag)
{
- struct sk_buff *skb;
- struct mgmt_hdr *hdr;
-
- skb = alloc_skb(sizeof(*hdr) + data_len, GFP_KERNEL);
- if (!skb)
- return -ENOMEM;
-
- hdr = (void *) skb_put(skb, sizeof(*hdr));
- hdr->opcode = cpu_to_le16(event);
- hdr->index = cpu_to_le16(hdev->id);
- hdr->len = cpu_to_le16(data_len);
-
- if (data)
- memcpy(skb_put(skb, data_len), data, data_len);
-
- /* Time stamp */
- __net_timestamp(skb);
-
- hci_send_to_flagged_channel(HCI_CHANNEL_CONTROL, skb, flag);
- kfree_skb(skb);
-
- return 0;
+ return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len,
+ flag, NULL);
}
static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 len,
struct sock *skip_sk)
{
return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len,
- skip_sk);
+ HCI_SOCK_TRUSTED, skip_sk);
}
static int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)