Commit Graph

107 Commits

Author SHA1 Message Date
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
rmind 3d12d00f76 G/C M_EMULDATA 2011-04-27 00:36:47 +00:00
plunky 2e4ce7a95f use C99 style for variadic macro arguments 2011-03-16 21:35:30 +00:00
plunky 590bad2347 respond to L2CAP Information requests 2011-02-06 18:50:59 +00:00
plunky dcea4289ad add (SOL_SOCKET, SO_TIMESTAMP) messages if requested 2011-01-30 17:23:23 +00:00
plunky 2c6dc8c043 upon device initialisation, query and cache the device features,
and cache the maximum ACL/SCO packet buffers.

provide an additional SIOCGBTFEAT ioctl to retrieve the cached
features, and add the max values to the SIOC?BTINFO results.

(btreq does not change size)
2010-11-22 19:56:51 +00:00
plunky 7d794dc7da do not produce an error when connections are closed normally
for L2CAP sockets, this solves an irritating error message from sdpd(8),
which can now differentiate between normal closure and error.
2010-11-17 20:19:25 +00:00
plunky 38be6befc7 Some Broadcom controllers emit empty ACL packets during connection
setup, using the handle that they have not yet told us for the
connection-to-be. Disconnecting can cause problems so just ignore
zero length ACL packets on unknown connection handles.

fixes a problem reported by Nick Hudson
2010-10-14 07:05:03 +00:00
pooka a183ecd06c Remove unused opt_bluetooth.h
plunky: "feel free"
2010-03-26 18:15:15 +00:00
plunky 1e2b8c6e0e prevent local socket address from being changed after socket is
in use (connect or listen)
2010-01-04 19:20:05 +00:00
plunky 260c1d53a9 when receiving a MCC PN response, the max frame size that the remote
party requests must be less than the one we asked for which will not
be greater than the max acceptable value so no need to test for that
but make sure that it is not smaller than minimum acceptable value.
2010-01-03 16:38:15 +00:00
mbalmer 0ae57f90dd more s/the the/the/ 2009-11-22 19:09:15 +00:00
plunky 34ca69b754 When the special L2CAP_PSM_ANY value is used for listening sockets,
select the next unused PSM from the dynamic range (0x1001->)
2009-09-25 19:44:57 +00:00
plunky 00f86b84ea Only accept incoming ACL connections when there is potential
L2CAP listener available.
2009-09-24 19:35:09 +00:00
pooka fbd53556dc Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
2009-09-13 18:45:10 +00:00
plunky 0ae8e53b57 slight reordering, plus only deal with ACL links 2009-09-12 18:31:46 +00:00
plunky 003e844b73 add feature bits from 3.0 specification 2009-09-11 18:35:50 +00:00
plunky 7216fe5048 update/correct specification IDs according to recently published
Assigned Numbers documents at www.bluetooth.com
2009-09-01 18:02:44 +00:00
plunky dab1b7f787 add devices seen in "Extended Inquiry Result" to the cache 2009-08-24 20:37:36 +00:00
plunky b7dec17fbf add a per-unit master setting, to control requesting the master role
when accepting connections.
2009-08-20 21:40:59 +00:00
plunky 4f6ac13367 reduce the number of KAUTH_DEVICE_BLUETOOTH_SEND/RECV requests
by passing the packet type as an argument rather than having
a different request for each type.

(from a suggestion by mrg)
2009-08-10 20:22:06 +00:00
plunky 80c6ec5db1 remove last usage of KAUTH_ISSUSER in bluetooth code by adding
some requests to the device scope:

	KAUTH_DEVICE_BLUETOOTH_SEND_COMMAND
	KAUTH_DEVICE_BLUETOOTH_RECV_COMMAND
	KAUTH_DEVICE_BLUETOOTH_RECV_EVENT
	KAUTH_DEVICE_BLUETOOTH_RECV_DATA

and a listener tied to the HCI protocol that will approve the basic
minimum to be sent and received.

handle the requests in the bsd44_suser listener by approving all
when the credential is root.
2009-08-10 18:25:20 +00:00
plunky 4a0feb42e7 add const to unchanged argument 2009-05-14 15:34:38 +00:00
elad fda35a52f4 Add a bluetooth action to the device scope and use it in netbt as a
replacement for KAUTH_GENERIC_ISSUSER.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/25/msg004905.html

Bluetooth-specific authorization wrapper might come later.
2009-05-03 17:21:12 +00:00
gmcgarry 0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
plunky fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
plunky c5ce5d1afa adjust message for previous change 2008-08-05 13:08:31 +00:00
plunky 516804fedf drop packets that exceed the negotiated MTU 2008-08-05 13:02:10 +00:00
plunky d7fdc240c9 do not hold bt_lock while detaching bthub, as devices may need to aquire
it in order to detach cleanly.
2008-06-26 14:17:27 +00:00
ad 387c23dfb9 PRU_CONTROL: acquire bt_lock manually. 2008-04-29 18:41:06 +00:00
ad 15e29e981b Merge the socket locking patch:
- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
2008-04-24 11:38:36 +00:00
plunky a09c132d77 move the updating of num_cmd_pkts to its own function, mostly so that
pending commands will be output on the device in the order that they
were queued.
2008-03-17 09:16:17 +00:00
plunky 5f997830fe we always know the bdaddr and type of a link when creating it, so
pass them to the _alloc() function and let it set them.
2008-03-16 23:28:10 +00:00
plunky 0b1dda7d78 insert new links at the tail of the queue so that if a create_connection
command fails to start we can find the relevant link, since it will be
the first one with the pending flag set.
2008-03-16 23:14:24 +00:00
plunky d0e804ff6e a "Create Connection" command can sometimes fail to start for whatever
reason and the command_status event returns failure but we get no
indication of which connection failed (for instance in the case where
we tried to open too many connections all at once)

So, keep a flag on the link to indicate pending status until the
command_status event is returned to help us decide which should
be failed.
2008-03-06 20:56:26 +00:00
plunky 7acc9392e5 add HCI definitions from the Bluetooth 2.1 spec 2008-02-10 17:40:54 +00:00
plunky 6f45ff2e8b do not destroy session callout until the session is definitely finished
with, otherwise trying to stop it will cause a panic
2008-01-31 19:30:23 +00:00
plunky aeab3db895 request and keep a mask of supported commands per unit in order
to block unsupported HCI commands sent by unprivileged users
reaching the device.
2007-12-30 18:26:42 +00:00
plunky 2f47a8f906 remove unused def for btr_uclass 2007-12-29 11:30:27 +00:00
plunky 87914664c7 [experimentally] report failing commands
this does happen sometimes and I would like to see if it happens
more often than I know of.
2007-11-28 21:46:52 +00:00
plunky 736a9db087 Clean up the way that bluetooth drivers attach to the bluetooth stack,
to remove the frobbing that drivers must do in the hci_unit structure.

- driver provides a static const interface descriptor
- hci_unit is allocated by hci_attach() rather than part of softc
- statistics are compiled by driver and provided on request
- driver provides output methods and is responsible for output queue
- stack provides input methods and is responsible for input queue
- mutex is used to arbitrate device queue access
2007-11-28 20:16:11 +00:00
plunky 166b860e06 allow listening to channel RFCOMM_CHANNEL_ANY, which means that
we should allocate the first available channel at the given
device address.
2007-11-20 20:25:57 +00:00
plunky fb5c91f9fc when listening, don't attach to the 'any' address unless
we wanted to listen to the 'any' address.
2007-11-20 20:19:24 +00:00
plunky cd286130a6 don't explicitly list unused and NULL entries in the domain declaration 2007-11-20 20:18:00 +00:00
plunky 176a9c6143 include <sys/device.h> for device_t 2007-11-12 19:08:29 +00:00
plunky 0b799668fb use more device_t and device_xxx() accessors
make bluetooth stack keep device_t instead of softc pointer as
device is not necessarily part of softc, and pass device_t to
driver callbacks. hci_devname is no longer required.
2007-11-10 23:12:22 +00:00
plunky fb65dc6e6b 'struct device *' -> 'device-t' 2007-11-10 12:33:21 +00:00
plunky d43f6db858 struct callout => callout_t 2007-11-03 17:39:14 +00:00
plunky 644e69cd47 "struct callout" -> callout_t
don't use callout_reset()
do use callout_destroy()
2007-11-03 17:20:17 +00:00
plunky b9a4fe408b constify hci_devname 2007-11-02 20:27:14 +00:00