04 Aug, 2015
1 commit
-
commit 781f899f2f9d8b71e35225a087f90052059486c5 upstream.
During the initial setup stage of a controller, the low-level transport
is actually active. This means that HCI_UP is true. To avoid toggling
the transport off and back on again for normal operation the kernel
holds a grace period with HCI_AUTO_OFF that will turn the low-level
transport off in case no user is present.The idea of the grace period is important to avoid having to initialize
all of the controller twice. So legacy ioctl and the new management
interface knows how to clear this grace period and then start normal
operation.For the user channel operation this grace period has not been taken into
account which results in the problem that HCI_UP and HCI_AUTO_OFF are
set and the kernel will return EBUSY. However from a system point of
view the controller is ready to be grabbed by either the ioctl, the
management interface or the user channel.This patch brings the user channel to the same level as the other two
entries for operating a controller.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
Signed-off-by: Greg Kroah-Hartman
31 Mar, 2015
1 commit
-
In order to shrink the size of bt_skb_cb, this patch moves the HCI
request related variables into their own req_ctrl struct. Additionall
the L2CAP and HCI request structs are placed inside the same union since
they will never be used at the same time for the same skb.Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann
18 Mar, 2015
2 commits
-
The mgmt.c file should be reserved purely for HCI_CHANNEL_CONTROL. The
mgmt_control() function in it is already completely generic and has a
single user in hci_sock.c. This patch moves the function there and
renames it a bit more appropriately to hci_mgmt_cmd() (as it's a command
dispatcher).Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann -
We'll need to have access to which HCI channel a socket is bound to, in
order to manage pending mgmt commands in clean way. This patch adds a
helper for the purpose.Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann
15 Mar, 2015
8 commits
-
Changes to the global configuration updates like settings, class of
device, name etc. can be received by every user. They are allowed to
read them in the first place so provide the updates via events as
well. Otherwise untrusted users start polling for updates and that
is not a desired behavior.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Until now the management interface was restricted to CAP_NET_ADMIN. With
this change every user can open the management socket. However the list
of commands is heavily restricted to getting basic information about the
attached controllers. No access for configuration or other operation is
provided. The events are also limited. This is done so that no keys can
leak or untrusted users can mess with the Bluetooth configuration.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The management interface will need access to the socket flags and so
provide a helper function for checking them.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
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
Signed-off-by: Johan Hedberg -
Providing a global trusted flag for management control sockets provides
an easy way for identifying sockets and imposing restriction on it. For
now all management sockets are trusted since they require CAP_NET_ADMIN.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
For sending Index Added, Index Removed, Unconfigured Index Added and
Unconfigured Index Removed managment events the new helper functions
allows taking into account if these events are enabled for a certain
management socket or not.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The hci_send_to_flagged_channel helper function can be used to send
packets to all channels that have a certain HCI socket flag set.This is especially useful for managment events that are limited to
sockets that have first enabled certain functionality. This allows
for filtering of events without confusing existing users.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
To filter out certain actions for certain HCI sockets introcuce a flags
field that allows to configure specific settings on individual sockets.Since the hci_pinfo structure is private in hci_sock.c, provide helper
functions for setting and clearing a given flag.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
13 Mar, 2015
3 commits
-
Instead of manually coding test_and_set_bit on hdev->dev_flags all the
time, use hci_dev_test_and_set_flag helper macro.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Instead of manually coding clear_bit on hdev->dev_flags all the time,
use hci_dev_clear_flag helper macro.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Instead of manually coding test_bit on hdev->dev_flags all the time,
use hci_dev_test_flag helper macro.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
07 Mar, 2015
2 commits
-
This patch converts the existing mgmt code to use the newly introduced
generic API for registering HCI channels with mgmt-like semantics.Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann -
This patch adds an API for registering HCI channels with mgmt-like
semantics. For now the only user will be HCI_CHANNEL_CONTROL, but e.g.
6lowpan is intended to use this as well in the future.Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann
03 Mar, 2015
2 commits
-
…etooth/bluetooth-next
Johan Hedberg says:
====================
pull request: bluetooth-next 2015-03-02Here's the first bluetooth-next pull request targeting the 4.1 kernel:
- ieee802154/6lowpan cleanups
- SCO routing to host interface support for the btmrvl driver
- AMP code cleanups
- Fixes to AMP HCI init sequence
- Refactoring of the HCI callback mechanism
- Added shutdown routine for Intel controllers in the btusb driver
- New config option to enable/disable Bluetooth debugfs information
- Fix for early data reception on L2CAP fixed channelsPlease let me know if there are any issues pulling. Thanks.
====================Signed-off-by: David S. Miller <davem@davemloft.net>
-
After TIPC doesn't depend on iocb argument in its internal
implementations of sendmsg() and recvmsg() hooks defined in proto
structure, no any user is using iocb argument in them at all now.
Then we can drop the redundant iocb argument completely from kinds of
implementations of both sendmsg() and recvmsg() in the entire
networking stack.Cc: Christoph Hellwig
Suggested-by: Al Viro
Signed-off-by: Ying Xue
Signed-off-by: David S. Miller
02 Mar, 2015
2 commits
-
Convert boolean fields incoming and req_start to bit fields and move
force_active in order save space in bt_skb_cb in an effort to use
a portion of skb->cb[] for storing skb->dropcount.Signed-off-by: Eyal Birger
Signed-off-by: David S. Miller -
struct hci_req_ctrl is never used outside of struct bt_skb_cb;
Inlining it frees 8 bytes on a 64 bit system in skb->cb[] allowing
the addition of more ancillary data.Signed-off-by: Eyal Birger
Reviewed-by: Shmulik Ladkani
Signed-off-by: David S. Miller
28 Feb, 2015
1 commit
-
gcc5 warns about passing a const array to hci_test_bit which takes a
non-const pointer:
net/bluetooth/hci_sock.c: In function ‘hci_sock_sendmsg’:
net/bluetooth/hci_sock.c:955:8: warning: passing argument 2 of ‘hci_test_bit’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers]
&hci_sec_filter.ocf_mask[ogf])) &&
^
net/bluetooth/hci_sock.c:49:19: note: expected ‘void *’ but argument is of type ‘const __u32 (*)[4] {aka const unsigned int (*)[4]}’
static inline int hci_test_bit(int nr, void *addr)
^So make 'addr' 'const void *'.
Signed-off-by: Jiri Slaby
Signed-off-by: Marcel Holtmann
Cc: Gustavo Padovan
Cc: Johan Hedberg
21 Feb, 2015
2 commits
-
Now that there's the general purpose hci_send_to_channel() API it will
do the exact same thing as queue_monitor_skb() when passed the monitor
HCI channel. This patch removes queue_monitor_skb() and replaces any
users of it with calls to hci_send_to_channel().Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann -
The hci_send_to_control() can be made more general purpose with a small
change of passing the desired HCI channel as a parameter to it. This
allows using it for the monitor channel as well as e.g. 6lowpan in the
future.Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann
12 Jan, 2015
4 commits
-
The send_monitor_event function is essentially the same as the newly
introduced queue_monitor_skb. So instead of having duplicated code,
replace send_monitor_event with queue_monitor_skb.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The hci_send_to_monitor function contains generic code for queueing the
packet into the receive queue of every monitor client. To avoid code
duplication, create a generic queue_monitor_skb function to interate
over all monitor sockets.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Within the monitor functionality, the global atomic variable called
monitor_promisc ensures that no memory allocation happend when there
is actually no client listening. This means it is safe to just create
a copy of the skb since it is guaranteed that at least one client
exists. No extra checks needed.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
This adds an extra check for ensuring that the size of sockaddr_hci
does not grow larger than sockaddr.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
24 Nov, 2014
1 commit
-
Signed-off-by: Al Viro
11 Nov, 2014
1 commit
-
…inville/wireless-next
John W. Linville says:
====================
pull request: wireless-next 2014-11-07Please pull this batch of updates intended for the 3.19 stream!
For the mac80211 bits, Johannes says:
"This relatively large batch of changes is comprised of the following:
* large mac80211-hwsim changes from Ben, Jukka and a bit myself
* OCB/WAVE/11p support from Rostislav on behalf of the Czech Technical
University in Prague and Volkswagen Group Research
* minstrel VHT work from Karl
* more CSA work from Luca
* WMM admission control support in mac80211 (myself)
* various smaller fixes, spelling corrections, and minor API additions"For the Bluetooth bits, Johan says:
"Here's the first bluetooth-next pull request for 3.19. The vast majority
of patches are for ieee802154 from Alexander Aring with various fixes
and cleanups. There are also several LE/SMP fixes as well as improved
support for handling LE devices that have lost their pairing information
(the patches from Alfonso). Jukka provides a couple of stability fixes
for 6lowpan and Szymon conformance fixes for RFCOMM. For the HCI drivers
we have one new USB ID for an Acer controller as well as a reset
handling fix for H5."For the Atheros bits, Kalle says:
"Major changes are:
o ethtool support (Ben)
o print dev string prefix with debug hex buffers dump (Michal)
o debugfs file to read calibration data from the firmware verification
purposes (me)o fix fw_stats debugfs file, now results are more reliable (Michal)
o firmware crash counters via debugfs (Ben&me)
o various tracing points to debug firmware (Rajkumar)
o make it possible to provide firmware calibration data via a file (me)
And we have quite a lot of smaller fixes and clean up."
For the iwlwifi bits, Emmanuel says:
"The big new thing here is netdetect which allows the
firmware to wake up the platform when a specific network
is detected. Along with that I have fixes for d3 operation.
The usual amount of rate scaling stuff - we now support STBC.
The other commit that stands out is Johannes's work on
devcoredump. He basically starts to use the standard
infrastructure he built."Along with that are the usual sort of updates and such for ath9k,
brcmfmac, wil6210, and a handful of other bits here and there...Please let me know if there are problems!
====================Signed-off-by: David S. Miller <davem@davemloft.net>
06 Nov, 2014
1 commit
-
This encapsulates all of the skb_copy_datagram_iovec() callers
with call argument signature "skb, offset, msghdr->msg_iov, length".When we move to iov_iters in the networking, the iov_iter object will
sit in the msghdr.Having a helper like this means there will be less places to touch
during that transformation.Based upon descriptions and patch from Al Viro.
Signed-off-by: David S. Miller
29 Oct, 2014
1 commit
-
Fix spelling errors in comments.
Signed-off-by: Stephen Hemminger
Signed-off-by: Marcel Holtmann
11 Jul, 2014
3 commits
-
There exists no external user of struct hci_pinfo and hci_pi and thus
move it into the one place that is actually using it.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
The hci_sec_filter socket filter details do not change. They are fixed
and with that they can also be delcared as const.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
There is only single location using struct hci_sec_filter and with
that there is no point in putting this declaration into a global
header file. So move it right next to its user and make the code
a lot more simpler.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
09 Jul, 2014
1 commit
-
We already have several lists with struct bdaddr_list entries, and there
will be more in the future. Since the operations for adding, removing,
looking up and clearing entries in these lists are exactly the same it
doesn't make sense to define new functions for every single list. This
patch unifies the functions by passing the list_head to them instead of
a hci_dev pointer.Signed-off-by: Johan Hedberg
Signed-off-by: Marcel Holtmann
06 Jul, 2014
1 commit
-
When the external configuration triggers the switch to a configured
controller, it means the setup needs to be run. Controllers that start
out unconfigured have only run limited set of HCI commands. This is
not enough for complete operation and thus run the setup procedure
before announcing the new controller index.This introduces HCI_CONFIG flag as companion to HCI_SETUP flag. The
HCI_SETUP flag is only used once for the initial setup procedure. And
during that procedure hdev->setup driver callback is called. With the
new HCI_CONFIG the switch from unconfigured to configured state is
triggering the same setup procedure just without hdev->setup. This
is required since bringing a controller back to unconfigured state
from configured state is possible.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg
03 Jul, 2014
3 commits
-
When a controller is in unconfigured state it is currently hidden
from the management interface. This change now announces the new
controller with an Unconfigured Index Added event and allows clients
to easily detect the controller.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
With the new unconfigured controller state it is possible to provide a
fully functional HCI transport, but disable the higher level operations
that would normally happen. This way userspace can try to configure the
controller before releases the unconfigured state.The internal state is represented by HCI_UNCONFIGURED. This replaces the
HCI_QUIRK_RAW_DEVICE quirk as internal state representation. This is now
a real state and drivers can use the quirk to actually trigger this
state. In the future this will allow a more fine grained switching from
unconfigured state to configured state for controller inititialization.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg -
Bluetooth controllers that are marked for raw-only usage can only be
used with user channel access. Any other operation should be rejected.This simplifies the whole raw-only support since it now depends on
the fact that the controller is marked with HCI_QUIRK_RAW_DEVICE and
runtime raw access is restricted to user channel operation.The kernel internal processing of HCI commands and events is designed
around the case that either the kernel has full control over the device
or that the device is driven from userspace. This now makes a clear
distinction between these two possible operation modes.Signed-off-by: Marcel Holtmann
Signed-off-by: Johan Hedberg