diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2010-12-07 17:21:07 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2010-12-07 20:03:39 -0500 |
commit | a40c406cbdd28dcca3483065bc2ba794cf5aaab7 (patch) | |
tree | 30c0242aea1c7a5acdaab1e7a4493ff5245e98fa /net/bluetooth/hci_sock.c | |
parent | 0381101fd6a73c7d6b545044dc1472d019fc64e3 (diff) |
Bluetooth: Make hci_send_to_sock usable for management control sockets
In order to send data to management control sockets the function should:
- skip checks intended for raw HCI data and stack internal events
- make sure RAW HCI data or stack internal events don't go to
management control sockets
In order to accomplish this the patch adds a new member to the bluetooth
skb private data to flag skb's that are destined for management control
sockets.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_sock.c')
-rw-r--r-- | net/bluetooth/hci_sock.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 207be7abda9f..f6c18abab797 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -104,6 +104,12 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
104 | if (skb->sk == sk) | 104 | if (skb->sk == sk) |
105 | continue; | 105 | continue; |
106 | 106 | ||
107 | if (bt_cb(skb)->channel != hci_pi(sk)->channel) | ||
108 | continue; | ||
109 | |||
110 | if (bt_cb(skb)->channel == HCI_CHANNEL_CONTROL) | ||
111 | goto clone; | ||
112 | |||
107 | /* Apply filter */ | 113 | /* Apply filter */ |
108 | flt = &hci_pi(sk)->filter; | 114 | flt = &hci_pi(sk)->filter; |
109 | 115 | ||
@@ -127,12 +133,14 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
127 | continue; | 133 | continue; |
128 | } | 134 | } |
129 | 135 | ||
136 | clone: | ||
130 | nskb = skb_clone(skb, GFP_ATOMIC); | 137 | nskb = skb_clone(skb, GFP_ATOMIC); |
131 | if (!nskb) | 138 | if (!nskb) |
132 | continue; | 139 | continue; |
133 | 140 | ||
134 | /* Put type byte before the data */ | 141 | /* Put type byte before the data */ |
135 | memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1); | 142 | if (bt_cb(skb)->channel == HCI_CHANNEL_RAW) |
143 | memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1); | ||
136 | 144 | ||
137 | if (sock_queue_rcv_skb(sk, nskb)) | 145 | if (sock_queue_rcv_skb(sk, nskb)) |
138 | kfree_skb(nskb); | 146 | kfree_skb(nskb); |