History log of /netbsd-current/sys/netbt/hci_event.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.26 28-Sep-2019 plunky

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506

https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.25 21-Aug-2018 plunky

branches: 1.25.4;

Result of audit to check that mbuf length is checked before m_copydata()
and that any data supposedly copied out is valid before use.

prompted by maxv@, I have checked every usage of m_copydata() and made
the following corrections

hci_event.c:
hci_event_command_compl()
check that the packet does contain enough data for there to
be a status code before noting possible failures.

hci_event_num_compl_pkts()
check that the packet does contain data to cover the
stated number of handle/num pairs

l2cap_signal.c:
l2cap_recv_signal()
just ignore packets with not enough data rather than
trying to reject them (may not have cmd.ident)

l2cap_recv_command_rej()
check we have a valid reason and/or data before use


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.24 28-Nov-2015 plunky

branches: 1.24.10; 1.24.16; 1.24.18;
add version and extended feature flags defined in 4.2 specification,
add cache for page 2 of extended features and return this in
the SIOCGBTFEAT ioctl (no change in size)


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.23 27-Jul-2011 plunky

branches: 1.23.12; 1.23.28; 1.23.30; 1.23.32; 1.23.36;

cleanup some DIAGNOSTIC and KASSERT code

- remove #ifdef DIAGNOSTIC, so that we won't act
differently

- handle the cases where a Bluetooth adapter
sends invalid packet data (I've not seen this,
but it is not impossible)

- use KASSERT for actual impossible situations
(to catch bad future development)


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.22 22-Nov-2010 plunky

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)


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.21 12-Sep-2009 plunky

branches: 1.21.4;
slight reordering, plus only deal with ACL links


# 1.20 24-Aug-2009 plunky

add devices seen in "Extended Inquiry Result" to the cache


# 1.19 20-Aug-2009 plunky

add a per-unit master setting, to control requesting the master role
when accepting connections.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.18 24-Apr-2008 ad

branches: 1.18.2;
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@.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.17 17-Mar-2008 plunky

branches: 1.17.2;
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.


# 1.16 16-Mar-2008 plunky

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.


# 1.15 06-Mar-2008 plunky

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.


Revision tags: nick-net80211-sync-base mjf-devfs-base hpcarm-cleanup-base
# 1.14 10-Feb-2008 plunky

branches: 1.14.2; 1.14.6;
add HCI definitions from the Bluetooth 2.1 spec


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.13 30-Dec-2007 plunky

request and keep a mask of supported commands per unit in order
to block unsupported HCI commands sent by unprivileged users
reaching the device.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.12 28-Nov-2007 plunky

branches: 1.12.6;
[experimentally] report failing commands

this does happen sometimes and I would like to see if it happens
more often than I know of.


# 1.11 28-Nov-2007 plunky

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


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.10 10-Nov-2007 plunky

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.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.9 16-Sep-2007 plunky

branches: 1.9.4; 1.9.6;
improve memo taking of known bluetooth devices

- centralise creation of new memo into function
hci_memo_new(), when a memo exists for that address,
just update the timestamp.

- all results of inquiry/rssi result are processed; even
if no memo can be allocated, we may update a timestamp.

- for new connections, query the clock offset of the remote
device, in order that we can use it to facilitate future
reconnections

- as a connection is removed, make a memo of the clock offset


Revision tags: nick-csl-alignment-base5
# 1.8 07-Sep-2007 plunky

add event processing for "Inquiry result with RSSI", and modify the memo
contents so that this will fit.


Revision tags: matt-mips64-base
# 1.7 19-Jul-2007 plunky

branches: 1.7.4; 1.7.6; 1.7.8;
not necessary to cast to (void *) (from caddr_t removal)


Revision tags: nick-csl-alignment-base yamt-idlelwp-base8 mjf-ufs-trans-base
# 1.6 21-Apr-2007 plunky

branches: 1.6.2;
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.

- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)

- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.

- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.

- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)

- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options

- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)


Revision tags: thorpej-atomic-base
# 1.5 05-Apr-2007 plunky

remove default setting of bluetooth_debug, since 'options BLUETOOTH_DEBUG'
causes it to fail


# 1.4 15-Mar-2007 plunky

remove C++ style comments


# 1.3 04-Mar-2007 christos

branches: 1.3.2; 1.3.4; 1.3.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base netbsd-4-base
# 1.2 11-Sep-2006 plunky

branches: 1.2.4; 1.2.6; 1.2.10;
Endian issues:

hci_event.c:
- Convert memo->response.clock_offset to host-endian.

hci_ioctl.c:
- printf format tweak (size_t)

hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.

l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.

from scw@


Revision tags: abandoned-netbsd-4-base rpaulo-netinet-merge-pcb-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-base chap-midi-nbase
# 1.1 19-Jun-2006 gdamore

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.14;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.25 21-Aug-2018 plunky

Result of audit to check that mbuf length is checked before m_copydata()
and that any data supposedly copied out is valid before use.

prompted by maxv@, I have checked every usage of m_copydata() and made
the following corrections

hci_event.c:
hci_event_command_compl()
check that the packet does contain enough data for there to
be a status code before noting possible failures.

hci_event_num_compl_pkts()
check that the packet does contain data to cover the
stated number of handle/num pairs

l2cap_signal.c:
l2cap_recv_signal()
just ignore packets with not enough data rather than
trying to reject them (may not have cmd.ident)

l2cap_recv_command_rej()
check we have a valid reason and/or data before use


Revision tags: pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.24 28-Nov-2015 plunky

branches: 1.24.16;
add version and extended feature flags defined in 4.2 specification,
add cache for page 2 of extended features and return this in
the SIOCGBTFEAT ioctl (no change in size)


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.23 27-Jul-2011 plunky

branches: 1.23.12; 1.23.30;

cleanup some DIAGNOSTIC and KASSERT code

- remove #ifdef DIAGNOSTIC, so that we won't act
differently

- handle the cases where a Bluetooth adapter
sends invalid packet data (I've not seen this,
but it is not impossible)

- use KASSERT for actual impossible situations
(to catch bad future development)


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.22 22-Nov-2010 plunky

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)


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.21 12-Sep-2009 plunky

branches: 1.21.4;
slight reordering, plus only deal with ACL links


# 1.20 24-Aug-2009 plunky

add devices seen in "Extended Inquiry Result" to the cache


# 1.19 20-Aug-2009 plunky

add a per-unit master setting, to control requesting the master role
when accepting connections.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.18 24-Apr-2008 ad

branches: 1.18.2;
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@.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.17 17-Mar-2008 plunky

branches: 1.17.2;
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.


# 1.16 16-Mar-2008 plunky

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.


# 1.15 06-Mar-2008 plunky

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.


Revision tags: nick-net80211-sync-base mjf-devfs-base hpcarm-cleanup-base
# 1.14 10-Feb-2008 plunky

branches: 1.14.2; 1.14.6;
add HCI definitions from the Bluetooth 2.1 spec


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.13 30-Dec-2007 plunky

request and keep a mask of supported commands per unit in order
to block unsupported HCI commands sent by unprivileged users
reaching the device.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.12 28-Nov-2007 plunky

branches: 1.12.6;
[experimentally] report failing commands

this does happen sometimes and I would like to see if it happens
more often than I know of.


# 1.11 28-Nov-2007 plunky

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


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.10 10-Nov-2007 plunky

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.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.9 16-Sep-2007 plunky

branches: 1.9.4; 1.9.6;
improve memo taking of known bluetooth devices

- centralise creation of new memo into function
hci_memo_new(), when a memo exists for that address,
just update the timestamp.

- all results of inquiry/rssi result are processed; even
if no memo can be allocated, we may update a timestamp.

- for new connections, query the clock offset of the remote
device, in order that we can use it to facilitate future
reconnections

- as a connection is removed, make a memo of the clock offset


Revision tags: nick-csl-alignment-base5
# 1.8 07-Sep-2007 plunky

add event processing for "Inquiry result with RSSI", and modify the memo
contents so that this will fit.


Revision tags: matt-mips64-base
# 1.7 19-Jul-2007 plunky

branches: 1.7.4; 1.7.6; 1.7.8;
not necessary to cast to (void *) (from caddr_t removal)


Revision tags: nick-csl-alignment-base yamt-idlelwp-base8 mjf-ufs-trans-base
# 1.6 21-Apr-2007 plunky

branches: 1.6.2;
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.

- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)

- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.

- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.

- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)

- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options

- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)


Revision tags: thorpej-atomic-base
# 1.5 05-Apr-2007 plunky

remove default setting of bluetooth_debug, since 'options BLUETOOTH_DEBUG'
causes it to fail


# 1.4 15-Mar-2007 plunky

remove C++ style comments


# 1.3 04-Mar-2007 christos

branches: 1.3.2; 1.3.4; 1.3.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base netbsd-4-base
# 1.2 11-Sep-2006 plunky

branches: 1.2.4; 1.2.6; 1.2.10;
Endian issues:

hci_event.c:
- Convert memo->response.clock_offset to host-endian.

hci_ioctl.c:
- printf format tweak (size_t)

hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.

l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.

from scw@


Revision tags: abandoned-netbsd-4-base rpaulo-netinet-merge-pcb-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-base chap-midi-nbase
# 1.1 19-Jun-2006 gdamore

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.14;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.24 28-Nov-2015 plunky

add version and extended feature flags defined in 4.2 specification,
add cache for page 2 of extended features and return this in
the SIOCGBTFEAT ioctl (no change in size)


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.23 27-Jul-2011 plunky

branches: 1.23.30;

cleanup some DIAGNOSTIC and KASSERT code

- remove #ifdef DIAGNOSTIC, so that we won't act
differently

- handle the cases where a Bluetooth adapter
sends invalid packet data (I've not seen this,
but it is not impossible)

- use KASSERT for actual impossible situations
(to catch bad future development)


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base
# 1.22 22-Nov-2010 plunky

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)


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 jym-xensuspend-nbase
# 1.21 12-Sep-2009 plunky

branches: 1.21.4;
slight reordering, plus only deal with ACL links


# 1.20 24-Aug-2009 plunky

add devices seen in "Extended Inquiry Result" to the cache


# 1.19 20-Aug-2009 plunky

add a per-unit master setting, to control requesting the master role
when accepting connections.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.18 24-Apr-2008 ad

branches: 1.18.2;
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@.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.17 17-Mar-2008 plunky

branches: 1.17.2;
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.


# 1.16 16-Mar-2008 plunky

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.


# 1.15 06-Mar-2008 plunky

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.


Revision tags: nick-net80211-sync-base mjf-devfs-base hpcarm-cleanup-base
# 1.14 10-Feb-2008 plunky

branches: 1.14.2; 1.14.6;
add HCI definitions from the Bluetooth 2.1 spec


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.13 30-Dec-2007 plunky

request and keep a mask of supported commands per unit in order
to block unsupported HCI commands sent by unprivileged users
reaching the device.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.12 28-Nov-2007 plunky

branches: 1.12.6;
[experimentally] report failing commands

this does happen sometimes and I would like to see if it happens
more often than I know of.


# 1.11 28-Nov-2007 plunky

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


Revision tags: bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.10 10-Nov-2007 plunky

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.


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.9 16-Sep-2007 plunky

branches: 1.9.4; 1.9.6;
improve memo taking of known bluetooth devices

- centralise creation of new memo into function
hci_memo_new(), when a memo exists for that address,
just update the timestamp.

- all results of inquiry/rssi result are processed; even
if no memo can be allocated, we may update a timestamp.

- for new connections, query the clock offset of the remote
device, in order that we can use it to facilitate future
reconnections

- as a connection is removed, make a memo of the clock offset


Revision tags: nick-csl-alignment-base5
# 1.8 07-Sep-2007 plunky

add event processing for "Inquiry result with RSSI", and modify the memo
contents so that this will fit.


Revision tags: matt-mips64-base
# 1.7 19-Jul-2007 plunky

branches: 1.7.4; 1.7.6; 1.7.8;
not necessary to cast to (void *) (from caddr_t removal)


Revision tags: nick-csl-alignment-base yamt-idlelwp-base8 mjf-ufs-trans-base
# 1.6 21-Apr-2007 plunky

branches: 1.6.2;
Add 'service level' security for L2CAP and RFCOMM connections, following
the Linux (BlueZ) API.

- L2CAP or RFCOMM connections can require the baseband radio link
mode be any of:
authenticated (devices are paired)
encrypted (implies authentication)
secured (encryption, plus generate new link key)

- for sockets, the mode is set using setsockopt(2) and the socket
connection will be aborted if the mode change fails.

- mode settings will be applied during connection establishment, and
for safety, we enter a wait state and will only proceed when the mode
settings are successfuly set.

- It is possible to change the mode on already open connections, but
not possible to guarantee that data already queued (from either end)
will not be delivered. (this is a feature, not a bug)

- bthidev(4) and rfcomm_sppd(1) support "auth", "encrypt" and
"secure" options

- btdevctl(8) by default enables "auth" for HIDs, and "encrypt" for
keyboards (which are required to support it)


Revision tags: thorpej-atomic-base
# 1.5 05-Apr-2007 plunky

remove default setting of bluetooth_debug, since 'options BLUETOOTH_DEBUG'
causes it to fail


# 1.4 15-Mar-2007 plunky

remove C++ style comments


# 1.3 04-Mar-2007 christos

branches: 1.3.2; 1.3.4; 1.3.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base netbsd-4-base
# 1.2 11-Sep-2006 plunky

branches: 1.2.4; 1.2.6; 1.2.10;
Endian issues:

hci_event.c:
- Convert memo->response.clock_offset to host-endian.

hci_ioctl.c:
- printf format tweak (size_t)

hci_link.c:
- Convert memo->response.clock_offset from host-endian.
- Tweak a DIAGNOSTIC message.

l2cap_signal.c:
- In l2cap_recv_config_req(), rp->scid is little-endian so make sure
we convert from host-endian.

from scw@


Revision tags: abandoned-netbsd-4-base rpaulo-netinet-merge-pcb-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-base chap-midi-nbase
# 1.1 19-Jun-2006 gdamore

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12; 1.1.14;
Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@,
NetBSD Foundation Membership still pending.) This stack was written by
Iain under sponsorship from Itronix Inc.

The stack includes support for rfcomm networking (networking via your
bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.

Drivers for both PCMCIA and USB bluetooth controllers are included.