aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/bluetooth
Commit message (Collapse)AuthorAgeFilesLines
* ng_hci(4): Fix a typo in a source code commentGordon Bergling2025-12-131-1/+1
| | | | | | - s/depricated/deprecated/ MFC after: 3 days
* bluetooth: ng_ubt_rtl/rtlbtfw: remove duplicate entry in device tableBjoern A. Zeeb2025-10-171-3/+0
| | | | | | | | | | Remove the single 8822CU entry in all three places. It seems the only entry referencing a USB device. The same device is listed with the 8822CE devices. MFC after: 3 days Reviewed by: wulf Differential Revision: https://reviews.freebsd.org/D52324
* ng_btsocket_rfcomm: Mark a couple buffers as const in a helper functionMark Johnston2025-09-151-2/+2
| | | | Fixes: 680f9acc3657 ("ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *")
* ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *Christos Margiolis2025-09-151-1/+1
| | | | | | | | | | This is needed to address some compiler errors cleanly, where consumer functions want this address to be a const pointer. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D52310
* rtlbtfw(8): Sync device VID/PID list with Linux 6.15-rc4Vladimir Kondratyev2025-05-141-0/+20
| | | | | Sponsored by: Future Crew, LLC MFC after: 1 month
* Remove remaining mentions of pr_usrreq.Dag-Erling Smørgrav2025-05-083-5/+5
| | | | | | | | | | | | When struct pr_usrreq was folded into struct protosw and the function pointers it contained were renamed from pru_* to pr_* in 2022, a number of references to the old names in comments and error messages were missed. Chase them down and fix them. Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kevans, glebius Differential Revision: https://reviews.freebsd.org/D50190
* rtlbtfw(8): Add Mercusys MA530 VID/PID for Realtek 8761BUVVladimir Kondratyev2025-04-291-0/+1
| | | | | | Tested by: Yusuf Yaman <nxjoseph@protonmail.com> PR: 286369 MFC after: 1 week
* ng_hci: add support for Bluetooth Secure Simple PairingAndreas Kempe2025-01-273-0/+82
| | | | | | | | Add additional messages that allow for secure simple pairing. PR: 265066 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (review and commit)
* ng_ubt(4): do not attach Realtek 87XX/88XX adaptors in bootloader mode.Vladimir Kondratyev2024-11-063-0/+271
| | | | | | | | | | | | | Attempt to initialize FreeBSD bluetooth stack while such a device is in bootloader mode locks the adapter hardly so it requires power on/off cycle to restore. This change blocks ng_ubt attachment unless operational firmware is loaded thus preventing the lock up. Sponsored by: Future Crew LLC MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D46738
* ng_ubt_intel: Ignore unexpected HCI eventsVladimir Kondratyev2024-11-062-2/+30
| | | | | | | | | | | If Intel firmware is already in operational mode at boot that takes place at warm boot, BT adaptor can generate extra HCI events which interferes with firmware mode detection logic. Ignore them. Sponsored by: Future Crew LLC MFC after: 1 month Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D46736
* ng_ubt_intel: Allow to attach to 9260 bluetooth adaptorsVladimir Kondratyev2024-11-061-1/+68
| | | | | | | | | with operational mode firmware. Sponsored by: Future Crew LLC MFC after: 1 month Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D46734
* bluetooth(3): Fix two typos in source code commentsGordon Bergling2024-09-201-2/+2
| | | | | | - s/conficts/conflicts/ MFC after: 3 days
* ng_ubt: Add blacklist entries for MediaTek MT7925Kevin Lo2024-08-161-0/+4
| | | | | | | | This controller requires firmware patch downloading to operate, block ng_ubt attachment unless operational firmware is loaded. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D46302
* bluetooth socket sysinit: correct memset initializationRyan Libby2024-07-011-2/+1
| | | | | | | | | | | | | | gcc -Wmemset-elt-size diagnosed this. The code was only initializing the first 1/sizeof(long) bytes. On 64-bit systems, this would mean only events up to 0x20 were initialized. This effectively reverses the security policy for some events with higher ids, now permitting them on unprivileged sockets. Two that are defined are NG_HCI_EVENT_LE (0x3e) and NG_HCI_EVENT_BT_LOGO (0xfe). PR: 280039 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45707
* ng_hci: Add sockaddr validation to sendto()Mark Johnston2024-04-221-0/+11
| | | | | | | | | | | | | | | | ng_btsocket_hci_raw_send() wasn't verifying that the destination address specified by sendto() is large enough to fill a struct sockaddr_hci. Thus, when copying the socket address into an mbuf, ng_btsocket_hci_raw_send() may read past the end of the input sockaddr while copying. In practice this is effectively harmless since ng_btsocket_hci_raw_output() only uses the address to identify a netgraph node. Reported by: Oliver Sieber <oliver@secfault-security.com> MFC after: 1 week Sponsored by: The FreeBSD Foundation
* sockets: don't malloc/free sockaddr memory on getpeername/getsocknameGleb Smirnoff2023-11-3010-197/+105
| | | | | | | | | | | | | Just like it was done for accept(2) in cfb1e92912b4, use same approach for two simplier syscalls that return socket addresses. Although, these two syscalls aren't performance critical, this change generalizes some code between 3 syscalls trimming code size. Following example of accept(2), provide VNET-aware and INVARIANT-checking wrappers sopeeraddr() and sosockaddr() around protosw methods. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D42694
* sockets: don't malloc/free sockaddr memory on accept(2)Gleb Smirnoff2023-11-306-83/+117
| | | | | | | | | | | | | | Let the accept functions provide stack memory for protocols to fill it in. Generic code should provide sockaddr_storage, specialized code may provide smaller structure. While rewriting accept(2) make 'addrlen' a true in/out parameter, reporting required length in case if provided length was insufficient. Our manual page accept(2) and POSIX don't explicitly require that, but one can read the text as they do. Linux also does that. Update tests accordingly. Reviewed by: rscheff, tuexen, zlei, dchagin Differential Revision: https://reviews.freebsd.org/D42635
* sys: Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-163-3/+0
| | | | Remove /^\s*\$FreeBSD\$$\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1643-43/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1244-44/+44
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* ng_hci: handle NG_HCI_M_PULLUP failure in le_advertizing_reportEd Maste2022-11-011-0/+4
| | | | | | | | PR: 267396 Reported by: Robert Morris <rtm@lcs.mit.edu> Reviewed by: takawata Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37228
* protosw: refactor protosw and domain static declaration and loadGleb Smirnoff2022-08-172-125/+89
| | | | | | | | | | | | | | | | | | | o Assert that every protosw has pr_attach. Now this structure is only for socket protocols declarations and nothing else. o Merge struct pr_usrreqs into struct protosw. This was suggested in 1996 by wollman@ (see 7b187005d18ef), and later reiterated in 2006 by rwatson@ (see 6fbb9cf860dcd). o Make struct domain hold a variable sized array of protosw pointers. For most protocols these pointers are initialized statically. Those domains that may have loadable protocols have spacers. IPv4 and IPv6 have 8 spacers each (andre@ dff3237ee54ea). o For inetsw and inet6sw leave a comment noting that many protosw entries very likely are dead code. o Refactor pf_proto_[un]register() into protosw_[un]register(). o Isolate pr_*_notsupp() methods into uipc_domain.c Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36232
* protosw: change prototype for pr_controlGleb Smirnoff2022-08-129-10/+10
| | | | | | | | For some reason protosw.h is used during world complation and userland is not aware of caddr_t, a relic from the first version of C. Broken buildworld is good reason to get rid of yet another caddr_t in kernel. Fixes: 886fc1e80490fb03e72e306774766cbb2c733ac6
* ng_ubt(4): Probe USB Bluetooth per USB interface and not per USB device.Hans Petter Selasky2022-06-031-27/+40
| | | | | | PR: 264416 MFC after: 1 week Sponsored by: NVIDIA Networking
* sockbuf: merge two versions of sbcreatecontrol() into oneGleb Smirnoff2022-05-171-4/+4
| | | | No functional change.
* ng_ubt: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-094-8/+3
|
* bluetooth: don't assign NULL in C99 sparse initializerGleb Smirnoff2022-05-091-5/+0
|
* netgraph(4): Fix a typo in a source code commentGordon Bergling2022-04-091-5/+5
| | | | | | - s/peform/perform/ MFC after: 3 days
* ng_bt: Remove an unused variable.John Baldwin2022-04-081-4/+3
| | | | Leave a comment describing the field in the packet it represented.
* ng_btsocket(4): Fix a typo in an error messageGordon Bergling2022-04-061-1/+1
| | | | | | - s/mulitplexor/multiplexor/ MFC after: 5 days
* domains: make domain_init() initialize only global stateGleb Smirnoff2022-01-031-1/+1
| | | | | | | Now that each module handles its global and VNET initialization itself, there is no VNET related stuff left to do in domain_init(). Differential revision: https://reviews.freebsd.org/D33541
* protocols: init with standard SYSINIT(9) or VNET_SYSINITGleb Smirnoff2022-01-0310-40/+20
| | | | | | | | | | | | | | | The historical BSD network stack loop that rolls over domains and over protocols has no advantages over more modern SYSINIT(9). While doing the sweep, split global and per-VNET initializers. Getting rid of pr_init allows to achieve several things: o Get rid of ifdef's that protect against double foo_init() when both INET and INET6 are compiled in. o Isolate initializers statically to the module they init. o Makes code easier to understand and maintain. Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D33537
* ng_ubt(4): Add missing module dependency for _net_bluetooth sysctl node.Hans Petter Selasky2021-12-081-0/+1
| | | | | | | Differential Revision: https://reviews.freebsd.org/D33282 PR: 238235 MFC after: 1 week Sponsored by: NVIDIA Networking
* ng_ubt(4): Make net.bluetooth.usb_isoc_enable writable.Hans Petter Selasky2021-12-071-1/+1
| | | | | | | Differential Revision: https://reviews.freebsd.org/D33282 PR: 238235 MFC after: 1 week Sponsored by: NVIDIA Networking
* ng_ubt(4): Introduce net.bluetooth.usb_isoc_enable loader tunable to disableHans Petter Selasky2021-12-071-2/+8
| | | | | | | | | | | | | | | isochronous transfers. If users want to disable isochronous transfers, which cause high frequency periodic interrupts from the USB host controller, then net.bluetooth.usb_isoc_enable can be set to zero, either as a sysctl(8) or as a loader.conf(5) tunable. Differential Revision: https://reviews.freebsd.org/D33282 Submitted by: naito.yuichiro@gmail.com PR: 238235 MFC after: 1 week Sponsored by: NVIDIA Networking
* ng_ubt: Avoid attaching to several newer Intel controllersMark Johnston2021-12-051-0/+7
| | | | | | | | | | | | | Like other Intel controllers, these require firmware to be loaded, and generic ng_ubt attach causes them to lock up until a power cycle. However, their firmware interface for querying version info and loading operational firmware is different from that implemented by ng_ubt_intel and iwmbtfw, so they are not usable yet. Just disable attach for now to avoid stalls during USB device enumeration. PR: 260161 Sponsored by: The FreeBSD Foundation MFC after: 1 week
* bluetooth: complete removal of ng_h4Warner Losh2021-09-305-1376/+0
| | | | | | | | | | | The ng_h4 module was disconnected 13 years ago when the tty later was locked by Ed. It completely fails to compile, and has a number of false positives for Giant use. Remove it for lack of interest. Bluetooth has largely (completely?) moved on from bluetooth over UART transport. OK'd by: emax Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31846
* netgraph: pass return value from callout_stop() unmodified to callers ofGleb Smirnoff2021-09-102-5/+5
| | | | | | | | ng_uncallout. Most of them do not check it anyway, so very little node changes are required. Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D31476
* socket: Properly interlock when transitioning to a listening socketMark Johnston2021-09-072-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, most protocols implement pru_listen with something like the following: SOCK_LOCK(so); error = solisten_proto_check(so); if (error) { SOCK_UNLOCK(so); return (error); } solisten_proto(so); SOCK_UNLOCK(so); solisten_proto_check() fails if the socket is connected or connecting. However, the socket lock is not used during I/O, so this pattern is racy. The change modifies solisten_proto_check() to additionally acquire socket buffer locks, and the calling thread holds them until solisten_proto() or solisten_proto_abort() is called. Now that the socket buffer locks are preserved across a listen(2), this change allows socket I/O paths to properly interlock with listen(2). This fixes a large number of syzbot reports, only one is listed below and the rest will be dup'ed to it. Reported by: syzbot+9fece8a63c0e27273821@syzkaller.appspotmail.com Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31659
* socket: Implement SO_RERRORRoy Marples2021-07-281-0/+1
| | | | | | | | | | | | | | | | | | SO_RERROR indicates that receive buffer overflows should be handled as errors. Historically receive buffer overflows have been ignored and programs could not tell if they missed messages or messages had been truncated because of overflows. Since programs historically do not expect to get receive overflow errors, this behavior is not the default. This is really really important for programs that use route(4) to keep in sync with the system. If we loose a message then we need to reload the full system state, otherwise the behaviour from that point is undefined and can lead to chasing bogus bug reports. Reviewed by: philip (network), kbowling (transport), gbe (manpages) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26652
* Consistently use the SOLISTENING() macroMark Johnston2021-06-143-5/+3
| | | | | | | | | | Some code was using it already, but in many places we were testing SO_ACCEPTCONN directly. As a small step towards fixing some bugs involving synchronization with listen(2), make the kernel consistently use SOLISTENING(). No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* Fix a use-after-free in an error case.Takanori Watanabe2021-05-261-0/+1
| | | | | | PR: 255872 Submitted by: lylgood Differential Revision: https://reviews.freebsd.org/D30454
* ng_ubt: Block attachment of uninitialized Intel Wireless 7265Vladimir Kondratyev2021-04-153-28/+103
| | | | | | | | | As this controller requires firmware patch downloading to operate. "Intel Wireless 7265" support in iwmbtfw(8) is yet to be done. Tested by: arrowd et al PR: 228787 MFC after: 2 weeks
* ng_ubt: Use DEFINE_CLASS_1 macro for kobj inheritance.Vladimir Kondratyev2021-04-151-9/+2
| | | | MFC after: 2 weeks
* ng_ubt: Do not clear stall before receiving of HCI command response.Vladimir Kondratyev2021-04-151-2/+2
| | | | | | | | | | Unconditional execution of "clear feature" request at SETUP stage was workaround for probe failures on ng_ubt.ko re-kldloading which is unnecessary now. Reviewed by: hselasky MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29775
* Revert "SO_RERROR indicates that receive buffer overflows should be handled ↵Alexander V. Chernikov2021-02-081-1/+0
| | | | | | | | as errors." Wrong version of the change was pushed inadvertenly. This reverts commit 4a01b854ca5c2e5124958363b3326708b913af71.
* SO_RERROR indicates that receive buffer overflows should be handled as errors.Alexander V. Chernikov2021-02-081-0/+1
| | | | | | | | | | | | Historically receive buffer overflows have been ignored and programs could not tell if they missed messages or messages had been truncated because of overflows. Since programs historically do not expect to get receive overflow errors, this behavior is not the default. This is really really important for programs that use route(4) to keep in sync with the system. If we loose a message then we need to reload the full system state, otherwise the behaviour from that point is undefined and can lead to chasing bogus bug reports.
* pccard: Remove bt3c(4) driverWarner Losh2021-01-083-1447/+0
| | | | | | | | pccard is being removed, so remove bt3c driver since it only has PC Card attachment. Also remove bt3cfw(8) since it's the firmware for this driver. Relnotes: Yes
* net: clean up empty lines in .c and .h filesMateusz Guzik2020-09-0149-156/+76
| | | | Notes: svn path=/head/; revision=365071