aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth
Commit message (Collapse)AuthorAgeFilesLines
* Merge latest changes from google kernel/common.gitRoman Shaposhnikov2012-06-131-0/+1
| | | | | | | Kernel version updated to 3.0.31 Change-Id: Ifbd7150801f3beeec9cbaa566f249d8019ef9348 Signed-off-by: Roman Shaposhnikov <x0166637@ti.com>
* Bluetooth: Add support for returning the encryption key sizeVinicius Costa Gomes2011-07-111-0/+1
| | | | | | | | | This will be useful when userspace wants to restrict some kinds of operations based on the length of the key size used to encrypt the link. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add support for storing the key sizeVinicius Costa Gomes2011-07-111-1/+2
| | | | | | | | | | | | | | | | | In some cases it will be useful having the key size used for encrypting the link. For example, some profiles may restrict some operations depending on the key length. The key size is stored in the key that is passed to userspace using the pin_length field in the key structure. For now this field is only valid for LE controllers. 3.0+HS controllers define the Read Encryption Key Size command, this field is intended for storing the value returned by that command. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Remove unused field in hci_connVinicius Costa Gomes2011-07-111-1/+0
| | | | | Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add functions to manipulate the link key list for SMPVinicius Costa Gomes2011-07-111-0/+5
| | | | | | | | | | | | As the LTK (the new type of key being handled now) has more data associated with it, we need to store this extra data and retrieve the keys based on that data. Methods for searching for a key and for adding a new LTK are introduced here. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add new structures for supporting SM key distributionVinicius Costa Gomes2011-07-113-0/+22
| | | | | | | | | We need these changes because SMP keys may have more information associated with them, for example, in the LTK case, it has an encrypted diversifier (ediv) and a random number (rand). Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add support for SMP phase 3 (key distribution)Vinicius Costa Gomes2011-07-111-0/+1
| | | | | | | | | | | | | This adds support for generating and distributing all the keys specified in the third phase of SMP. This will make possible to re-establish secure connections, resolve private addresses and sign commands. For now, the values generated are random. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Remove L2CAP busy queueMat Martineau2011-07-111-4/+0
| | | | | | | | The ERTM receive buffer is now handled in a way that does not require the busy queue and the associated polling code. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Use event-driven approach for handling ERTM receive bufferMat Martineau2011-07-111-0/+2
| | | | | | | | | | | | | | | | | | | This change moves most L2CAP ERTM receive buffer handling out of the L2CAP core and in to the socket code. It's up to the higher layer (the socket code, in this case) to tell the core when its buffer is full or has space available. The recv op should always accept incoming ERTM data or else the connection will go down. Within the socket layer, an skb that does not fit in the socket receive buffer will be temporarily stored. When the socket is read from, that skb will be placed in the receive buffer if possible. Once adequate buffer space becomes available, the L2CAP core is informed and the ERTM local busy state is cleared. Receive buffer management for non-ERTM modes is unchanged. Signed-off-by: Mat Martineau <mathewm@codeaurora.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add lmp_host_le_capable() macroAndre Guedes2011-07-112-0/+6
| | | | | | | | Since we have the extended LMP features properly implemented, we should check the LMP_HOST_LE bit to know if the host supports LE. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add enable_le module parameterAndre Guedes2011-07-111-0/+1
| | | | | | | | This patch adds a new module parameter to enable/disable host LE support. By default host LE support is disabled. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Write LE Host Supported commandAndre Guedes2011-07-111-0/+6
| | | | | | | | | | This patch adds a handler to Write LE Host Supported command complete events. Once this commands has completed successfully, we should read the extended LMP features and update the extfeatures field in hci_dev. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add extfeatures to struct hci_devAndre Guedes2011-07-112-0/+5
| | | | | | | | | This new field holds the extended LMP features value. Some LE mechanism such as discovery procedure needs to read the extended LMP features to work properly. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Clean up unused struct hci_conn itemsGustavo F. Padovan2011-07-111-2/+0
| | | | | | priv and lock are never used Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add bt_printkJoe Perches2011-07-111-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a local logging function to emit bluetooth specific messages. Using vsprintf extension %pV saves code/text space. Convert the current BT_INFO and BT_ERR macros to use bt_printk. Remove __func__ from BT_ERR macro (and the uses). Prefix "Bluetooth: " to BT_ERR Remove __func__ from BT_DBG as function can be prefixed when using dynamic_debug. With allyesconfig: text data bss dec hex filename 129956 8632 36096 174684 2aa5c drivers/bluetooth/built-in.o.new2 134402 8632 36064 179098 2bb9a drivers/bluetooth/built-in.o.old 14778 1012 3408 19198 4afe net/bluetooth/bnep/built-in.o.new2 15067 1012 3408 19487 4c1f net/bluetooth/bnep/built-in.o.old 346595 19163 86080 451838 6e4fe net/bluetooth/built-in.o.new2 353751 19163 86064 458978 700e2 net/bluetooth/built-in.o.old 18483 1172 4264 23919 5d6f net/bluetooth/cmtp/built-in.o.new2 18927 1172 4264 24363 5f2b net/bluetooth/cmtp/built-in.o.old 19237 1172 5152 25561 63d9 net/bluetooth/hidp/built-in.o.new2 19581 1172 5152 25905 6531 net/bluetooth/hidp/built-in.o.old 59461 3884 14464 77809 12ff1 net/bluetooth/rfcomm/built-in.o.new2 61206 3884 14464 79554 136c2 net/bluetooth/rfcomm/built-in.o.old with x86 defconfig (and just bluetooth): $ size net/bluetooth/built-in.o.defconfig.* text data bss dec hex filename 66358 933 100 67391 1073f net/bluetooth/built-in.o.defconfig.new 66643 933 100 67676 1085c net/bluetooth/built-in.o.defconfig.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Rename function bt_err to bt_to_errnoJoe Perches2011-07-111-1/+1
| | | | | | | Make it easier to use more normal logging styles later. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Use bit operations on conn_stateGustavo F. Padovan2011-07-111-12/+14
| | | | | | | Instead of setting bits manually we use set_bit, test_bit, etc. Also remove L2CAP_ prefix from macros. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: use bit operation on conf_stateGustavo F. Padovan2011-07-111-9/+11
| | | | | | | Instead of making the bit operations manually, we now use set_bit, test_bit, etc. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add blacklisting support for mgmt interfaceAntti Julku2011-07-111-0/+10
| | | | | | | Management interface commands for blocking and unblocking devices. Signed-off-by: Antti Julku <antti.julku@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Move blacklisting functions to hci_coreAntti Julku2011-07-111-0/+2
| | | | | | | | Move blacklisting functions to hci_core.c, so that they can be used by both management interface and hci socket interface. Signed-off-by: Antti Julku <antti.julku@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add key size checks for SMPVinicius Costa Gomes2011-07-112-0/+4
| | | | | | | | | | | This patch implements a check in smp cmd pairing request and pairing response to verify if encryption key maximum size is compatible in both slave and master when SMP Pairing is requested. Keys are also masked to the correct negotiated size. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add support for SMP timeoutVinicius Costa Gomes2011-07-111-0/+2
| | | | | | | | | | | | This patch adds support for disconnecting the link when SMP procedure takes more than 30 seconds. SMP begins when either the Pairing Request command is sent or the Pairing Response is received, and it ends when the link is encrypted (or terminated). Vol 3, Part H Section 3.4. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Update the security level when link is encryptedVinicius Costa Gomes2011-07-111-0/+3
| | | | | | | | | | | | If the pending security level is greater than the current security level and the link is now encrypted, we should update the link security level. This is only useful for LE links, when the only event generated when SMP is sucessful in the Encrypt Change event. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add support for LE Start EncryptionVinicius Costa Gomes2011-07-112-0/+40
| | | | | | | | | This adds support for starting SMP Phase 2 Encryption, when the initial SMP negotiation is successful. This adds the LE Start Encryption and LE Long Term Key Request commands and related events. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add SMP confirmation checks methodsAnderson Briglia2011-07-111-0/+1
| | | | | | | | | This patch includes support for generating and sending the random value used to produce the confirmation value. Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add SMP confirmation structsAnderson Briglia2011-07-111-0/+5
| | | | | | | | | This patch adds initial support for verifying the confirmation value that the remote side has sent. Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add support for using the crypto subsystemVinicius Costa Gomes2011-07-111-0/+2
| | | | | | | | | | | | | This will allow using the crypto subsystem for encrypting data. As SMP (Security Manager Protocol) is implemented almost entirely on the host side and the crypto module already implements the needed methods (AES-128), it makes sense to use it. There's now a new module option to enable/disable SMP support. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add simple SMP pairing negotiationAnderson Briglia2011-07-111-0/+17
| | | | | | | | | This implementation only exchanges SMP messages between the Host and the Remote. No keys are being generated. TK and STK generation will be provided in further patches. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Implement the first SMP commandsAnderson Briglia2011-07-111-0/+26
| | | | | | | | | | These simple commands will allow the SMP procedure to be started and terminated with a not supported error. This is the first step toward something useful. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: keep reference if any ERTM timer is enabledGustavo F. Padovan2011-07-111-6/+9
| | | | | | | ERTM use the generic L2CAP timer functions to keep a reference to the channel. This is useful for avoiding crashes. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Make timer functions genericGustavo F. Padovan2011-07-111-0/+2
| | | | | | | We now plan to use l2cap_set_timer and l2cap_clear_timer in ERTM timers. Change-Id: Ie62b01e003f8885ae89c73e2e64195c21cbadddd Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add refcnt to struct l2cap_chanGustavo F. Padovan2011-07-111-0/+2
| | | | | | | struct l2cap_chan has now its own refcnt that is compatible with the socket refcnt, i.e., we won't see sk_refcnt = 0 and chan->refcnt > 0. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add state tracking to struct l2cap_chanGustavo F. Padovan2011-07-111-0/+3
| | | | | | | | | Now socket state is tracked by struct sock and channel state is tracked by chan->state. At this point both says the same, but this is going to change when we add AMP Support for example. Change-Id: Idbf873f5e8dd94f5b2482ba960c52193d28ce5dd Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: add close() callback to l2cap_chan_opsGustavo F. Padovan2011-07-111-2/+1
| | | | | | close() calls l2cap_sock_kill() on l2cap_sock.c Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: add recv() callback to l2cap_chan_opsGustavo F. Padovan2011-07-111-0/+1
| | | | | | | This abstracts the call to sock_queue_recv_skb() into l2cap_chan_ops->recv(). Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add l2cap_chan_ops abstractionGustavo F. Padovan2011-07-111-3/+9
| | | | | | | | Add an abstraction layer between L2CAP core and its users (only l2cap_sock.c now). The first function implemented is new_connection() that replaces calls to l2cap_sock_alloc() in l2cap_core.c Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Clean up some code style issuesWaldemar Rymarkiewicz2011-07-113-20/+35
| | | | | | | | Fix lines longer than 80 chars in length. Change-Id: I448077965c5f7723a4a9537977bfa664cfe104fd Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add BT_POWER L2CAP socket option.Jaikumar Ganesh2011-07-113-1/+10
| | | | | | | | | | | | | | | | | | | | | | | Add BT_POWER socket option used to control the power characteristics of the underlying ACL link. When the remote end has put the link in sniff mode and the host stack wants to send data we need need to explicitly exit sniff mode to work well with certain devices (For example, A2DP on Plantronics Voyager 855). However, this causes problems with HID devices. Hence, moving into active mode when sending data, irrespective of who set the sniff mode has been made as a socket option. By default, we will move into active mode. HID devices can set the L2CAP socket option to prevent this from happening. Currently, this has been implemented for L2CAP sockets. This has been tested with incoming and outgoing L2CAP sockets for HID and A2DP. Based on discussions on linux-bluetooth and patches submitted by Andrei Emeltchenko. Signed-off-by: Jaikumar Ganesh <jaikumar@google.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add 'dst_type' field to struct hci_connAndre Guedes2011-07-111-0/+1
| | | | | | | | | | | | | | | This patch adds a new field (dst_type) to the struct hci_conn which holds the type of the destination address (bdaddr_t dst). This approach is needed in order to use the struct hci_conn as an abstraction of LE connections in HCI Layer. For non-LE this field is ignored. This patch also set properly the 'dst_type' field after initializing LE hci_conn structures. Change-Id: I1e363bb6de263fdb1fe976a5a16ed5debc9b8c0c Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Fix auth_complete_evt for legacy unitsWaldemar Rymarkiewicz2011-07-111-0/+1
| | | | | | | | | | Legacy devices don't re-authenticate the link properly if a link key already exists. Thus, don't update sec_level for this case even if hci_auth_complete_evt indicates success. Otherwise the sec_level will not reflect a real security on the link. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Advertising entries lifetimeAndre Guedes2011-07-111-0/+2
| | | | | | | | | | | | | | This patch adds a timer to clear 'adv_entries' after three minutes. After some amount of time, the advertising entries cached during the last LE scan should be considered expired and they should be removed from the advertising cache. It was chosen a three minutes timeout as an initial attempt. This value might change in future. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Clear advertising cache before scanningAndre Guedes2011-07-111-0/+6
| | | | | | | | | The LE advertising cache should be cleared before performing a LE scanning. This will force the cache to contain only fresh advertising entries. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: LE advertising cacheAndre Guedes2011-07-111-0/+13
| | | | | | | | | | | | This patch implements the LE advertising cache. It stores sensitive information (bdaddr and bdaddr_type so far) gathered from LE advertising report events. Only advertising entries from connectables devices are added to the cache. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add advertising report meta event structsAnderson Briglia2011-07-111-0/+19
| | | | | | | | This patch adds definitions and a new struct for Advertising Report Event from LE and Dual Mode controllers. Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Rename __l2cap_chan_close() to l2cap_chan_close()Gustavo F. Padovan2011-07-111-1/+1
| | | | | | To make it consistent with the rest of the API. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Remove export of l2cap_chan_clear_timer()Gustavo F. Padovan2011-07-111-1/+0
| | | | | | | | | The call to l2cap_chan_clear_timer() is not really needed in l2cap_sock.c. This patch also adds a call to l2cap_chan_clear_timer() to the only place in __l2cap_sock_close() that wasn't calling it. It's safe call it there because l2cap_chan_clear_timer() check first for timer_peding(). Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: create channel timer to replace sk_timerGustavo F. Padovan2011-07-111-2/+3
| | | | | | | | The new timer does not belong to struct sock, tought it still touch some sock things, but this will be sorted out soon. Change-Id: I55dc122657f3b8e80e76acf8c479e2d5c9889af5 Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Add chan->chan_type struct memberGustavo F. Padovan2011-07-111-0/+5
| | | | | | | chan_type says if our chan is raw(direclty access to HCI), connection less or connection oriented. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Create l2cap_chan_send()Gustavo F. Padovan2011-07-111-8/+1
| | | | | | | | This move all the sending logic to l2cap_core.c, but we still have a socket dependence there, struct msghdr. It will be removed in some of the further commits. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
* Bluetooth: Create __l2cap_chan_close()Gustavo F. Padovan2011-07-111-4/+1
| | | | | | | | This is actually __l2cap_sock_close() renamed to __l2cap_chan_close(). At a first look it may not make sense, but with the further cleanups that will come it will. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>