aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/bluetooth/include
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
* 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
* ng_hci: add support for Bluetooth Secure Simple PairingAndreas Kempe2025-01-271-0/+78
| | | | | | | | Add additional messages that allow for secure simple pairing. PR: 265066 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (review and commit)
* sockets: don't malloc/free sockaddr memory on getpeername/getsocknameGleb Smirnoff2023-11-304-11/+9
| | | | | | | | | | | | | 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-303-3/+3
| | | | | | | | | | | | | | 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 .h patternWarner Losh2023-08-169-9/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-129-9/+9
| | | | | | | | | 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
* protosw: change prototype for pr_controlGleb Smirnoff2022-08-124-5/+5
| | | | | | | | 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
* protocols: init with standard SYSINIT(9) or VNET_SYSINITGleb Smirnoff2022-01-034-5/+0
| | | | | | | | | | | | | | | 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
* bluetooth: complete removal of ng_h4Warner Losh2021-09-301-114/+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
* pccard: Remove bt3c(4) driverWarner Losh2021-01-081-112/+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-0111-25/+11
| | | | Notes: svn path=/head/; revision=365071
* Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU.Takanori Watanabe2020-07-171-2/+2
| | | | | | | | | | | | | | ACL packet boundary flag should be 0 instead of 2 for LE PDU. Some HCI will drop LE packet with PB flag is 2, and if sent, some target may reject the packet. PR: 248024 Reported by: Greg V Reviewed by: Greg V, emax Differential Revision: https://reviews.freebsd.org/D25704 Notes: svn path=/head/; revision=363276
* Add support for [read|write] supported data length commands.Takanori Watanabe2020-07-081-1/+16
| | | | | | | | | | | Fix ng_hci_le_long_term_key_request_negative_reply_cp struct while here. PR: 247809 Submitted by: Marc Veldman Notes: svn path=/head/; revision=363003
* Update event masks constant to Bluetooth core spec V5.2Takanori Watanabe2020-06-151-2/+66
| | | | | | | | | | and add LE Events. PR: 247257 Submitted by: Marc Veldman Notes: svn path=/head/; revision=362199
* Add LE events:Takanori Watanabe2020-06-101-3/+57
| | | | | | | | | | | | | | | | READ_REMOTE_FEATURES_COMPL LONG_TERM_KEY_REQUEST REMOTE_CONN_PARAM_REQUEST DATA_LENGTH_CHANGE READ_LOCAL_P256_PK_COMPL GEN_DHKEY_COMPL ENH_CONN_COMPL PR: 247050 Submitted by: Marc Veldman marc at bumblingdork.com Notes: svn path=/head/; revision=362004
* Fix Typo in ng_hci_le_connection_complete_ep struct.Takanori Watanabe2020-05-191-1/+1
| | | | | | | | PR: 246538 Submitted by: Marc Veldman Notes: svn path=/head/; revision=361254
* Add space for RSSI in data member.Takanori Watanabe2020-05-091-1/+2
| | | | | | | | | | RSSI is put just after actual data. Submitted by: Marc Veldman PR: 245920 Notes: svn path=/head/; revision=360846
* Add le_read_buffer_size command and manpage.Takanori Watanabe2020-04-281-0/+9
| | | | | | | | | | It supports both v1 and v2 command. PR:245964 Submitted by: Marc Veldman <marc@bumblingdork.com> Notes: svn path=/head/; revision=360440
* Substitute le_read_supported_status with le_read_supported_states.Hans Petter Selasky2020-04-201-3/+3
| | | | | | | | | | | | Refer to bluetooth core v5.2 specifications Vol4. Part E. 7.8.27. PR: 245763 Submitted by: Marc Veldman <marc@bumblingdork.com> MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=360116
* sys: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2711-0/+22
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326272
* Make cached Bluetooth LE host advertise information visible from userland.Takanori Watanabe2017-04-273-4/+8
| | | | | | | Differential Revision: https://reviews.freebsd.org/D10362 Notes: svn path=/head/; revision=317506
* sys/netgraph: spelling fixes in comments.Pedro F. Giffuni2016-04-293-7/+7
| | | | | | | No functional change. Notes: svn path=/head/; revision=298813
* Bluetooth LE Security Management channel support.Takanori Watanabe2015-10-274-5/+22
| | | | | | | | | Add a socket option to block until underlying HCI connection encrypted. Differential Revision: https://reviews.freebsd.org/D3981 Notes: svn path=/head/; revision=290038
* Forgot to add default event mask definition.Takanori Watanabe2015-04-181-0/+3
| | | | Notes: svn path=/head/; revision=281683
* Initial Bluetooth LE support.Takanori Watanabe2015-04-074-7/+380
| | | | | | | | | | | | Note that sockaddr_l2cap structure is changed , check socket address to initialize new structure member and define L2CAP_SOCKET_CHECKED before including ng_btsocket.h Differential Revision: https://reviews.freebsd.org/D2021 Reviewed by:emax Notes: svn path=/head/; revision=281198
* Use callout(9) instead of timeout(9).John Baldwin2014-09-202-2/+2
| | | | | | | Reviewed by: emax Notes: svn path=/head/; revision=271908
* Get those pesky RFCOMM RPM data bits right. This is likely a noop.Maksim Yevmenkin2009-09-101-2/+2
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=197083
* Introduce support for Bluetooth SCO sockets. This is based on olderMaksim Yevmenkin2008-07-301-0/+130
| | | | | | | | | code that was revisted. MFC after: 3 months Notes: svn path=/head/; revision=181033
* Get in some basic infrastructure for Bluetooth SCO support.Maksim Yevmenkin2008-07-102-0/+21
| | | | | | | MFC after: 3 months Notes: svn path=/head/; revision=180399
* Several changes breaking netgraph module ABI collected together:Alexander Motin2008-04-151-23/+15
| | | | | | | | | | | | | | | | | | | | | | | | | - reorder structures fields (XX_refs) a bit to group fields modified same time together. According to my tests it gives up to 10% SMP performance benefit on real workload due to reduced inter-CPU cache trashing. - change q_flags from long to int as long is not really needed there and it's usage with atomics is argued by some people. - move NGF_WORKQ flag into the separate field q_flags2 as it protected by queue mutex instead of node writer protection used by the rest of flags. - move nd_work queue entry to ng_queue structure to which it is more related and make it STAILQ instead of TAILQ as now it is a classic FIFO. - remove q_node pointer from ng_queue structure as it is not really needed. - reimplement item queue using STAILQ instead of own equal implementation. As soon as BT subsystem has own item queues using ng_item.el_next update it also. - change depth field in ng_item from uintptr_t to u_int. It was made uintptr_t to keep ABI compatibility. Reviewed by: julian, emax Tested with: Netperf cluster Notes: svn path=/head/; revision=178228
* Change semantics of socket close and detach. Add a new protocol switchRobert Watson2006-07-213-0/+4
| | | | | | | | | | | | | | | | | | | | | | function, pru_close, to notify protocols that the file descriptor or other consumer of a socket is closing the socket. pru_abort is now a notification of close also, and no longer detaches. pru_detach is no longer used to notify of close, and will be called during socket tear-down by sofree() when all references to a socket evaporate after an earlier call to abort or close the socket. This means detach is now an unconditional teardown of a socket, whereas previously sockets could persist after detach of the protocol retained a reference. This faciliates sharing mutexes between layers of the network stack as the mutex is required during the checking and removal of references at the head of sofree(). With this change, pru_detach can now assume that the mutex will no longer be required by the socket layer after completion, whereas before this was not necessarily true. Reviewed by: gnn Notes: svn path=/head/; revision=160549
* Add new SIOC_HCI_RAW_NODE_LIST_NAMES ioctl. User-space applications canMaksim Yevmenkin2006-05-172-0/+11
| | | | | | | | | | | | | | | | use this ioctl to obtain the list of HCI nodes. User-space application is expected to preallocate 'ng_btsocket_hci_raw_node_list_names' structure and set limit in 'num_nodes' field. The 'nodes' field should be allocated as well and it should have space for at least 'num_nodes' elements. The SIOC_HCI_RAW_NODE_LIST_NAMES should be issued on bound raw HCI socket. It does not really really matter what HCI name the socket is bound to, as long as it is not empty. MFC after: 1 week Notes: svn path=/head/; revision=158672
* Chance protocol switch method pru_detach() so that it returns voidRobert Watson2006-04-013-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | rather than an error. Detaches do not "fail", they other occur or the protocol flags SS_PROTOREF to take ownership of the socket. soclose() no longer looks at so_pcb to see if it's NULL, relying entirely on the protocol to decide whether it's time to free the socket or not using SS_PROTOREF. so_pcb is now entirely owned and managed by the protocol code. Likewise, no longer test so_pcb in other socket functions, such as soreceive(), which have no business digging into protocol internals. Protocol detach routines no longer try to free the socket on detach, this is performed in the socket code if the protocol permits it. In rts_detach(), no longer test for rp != NULL in detach, and likewise in other protocols that don't permit a NULL so_pcb, reduce the incidence of testing for it during detach. netinet and netinet6 are not fully updated to this change, which will be in an upcoming commit. In their current state they may leak memory or panic. MFC after: 3 months Notes: svn path=/head/; revision=157370
* Change protocol switch pru_abort() API so that it returns void ratherRobert Watson2006-04-013-4/+4
| | | | | | | | | | | | | | | | | than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months Notes: svn path=/head/; revision=157366
* Push the assignment of a new or updated so_qlimit from solisten()Robert Watson2005-10-302-2/+2
| | | | | | | | | | | | | | | | | following the protocol pru_listen() call to solisten_proto(), so that it occurs under the socket lock acquisition that also sets SO_ACCEPTCONN. This requires passing the new backlog parameter to the protocol, which also allows the protocol to be aware of changes in queue limit should it wish to do something about the new queue limit. This continues a move towards the socket layer acting as a library for the protocol. Bump __FreeBSD_version due to a change in the in-kernel protocol interface. This change has been tested with IPv4 and UNIX domain sockets, but not other protocols. Notes: svn path=/head/; revision=151888
* Fix dangling callout problem in the Bluetooth L2CAP code that leads toMaksim Yevmenkin2005-08-311-0/+1
| | | | | | | | | | | | | | | panic. The panic happens when outgoing L2CAP connection descriptor is deleted with the L2CAP command(s) pending in the queue. In this case when the last L2CAP command is deleted (due to cleanup) and reference counter for the L2CAP connection goes down to zero the auto disconnect timeout is incorrectly set. pjd gets credit for tracking this down and committing bandaid. Reported by: Jonatan B <onatan at gmail dot com> MFC after: 3 days Notes: svn path=/head/; revision=149679
* Make default RFCOMM session MTU match default L2CAP MTU.Maksim Yevmenkin2005-01-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This is just a workaround for a know problem with Motorola E1000 phone. Something is wrong with the configuration of L2CAP/RFCOMM channel. Even though we set L2CAP MTU to 132 bytes (default RFCOMM MTU 127 + 5 bytes RFCOMM frame header) and the phone accepts it, the phone still sends oversized L2CAP packets. It appears that the phone wants to use bigger (667 bytes) RFCOMM frames, but it does not segment them according to the configured L2CAP MTU. The 667 bytes RFCOMM frame size corresponds to the default L2CAP MTU of 672 bytes (667 + 5 bytes RFCOMM frame header). This problem only appears if connection was initiated from the phone. I'm not sure who is at fault here, so for now just put workaround in place. Quick look at the spec did not reveal any anwser. Tested by: Jes < jjess at freebsd dot polarhome dot com > MFC after: 3 days Notes: svn path=/head/; revision=140027
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-0710-10/+30
| | | | Notes: svn path=/head/; revision=139823
* Rename 'class' field to 'uclass' in the ng_hci_inquiry_response structure.Maksim Yevmenkin2005-01-041-1/+1
| | | | | | | | | | class is a reserved word in C++ Submitted by: Markus Brueffer < markus AT brueffer DOT de > MFC after: 3 days Notes: svn path=/head/; revision=139686
* Align netgraph message fields ready for 64-bit (and 128 bit :-) machines.Julian Elischer2004-08-201-6/+1
| | | | | | | | | | | | | requires a recompile of netgraph users. Also change the size of a field in the bluetooth code that was waiting for the next change that needed recompiles so it could piggyback its way in. Submitted by: jdp, maksim MFC after: 2 days Notes: svn path=/head/; revision=134057
* Introduce ng_hci_inquiry_response structure and use it in the hccontrol(8)Maksim Yevmenkin2004-08-101-7/+10
| | | | Notes: svn path=/head/; revision=133415
* Mode few Bluetooth defines into system include filesMaksim Yevmenkin2004-05-103-21/+1
| | | | | | | Reviewed by: imp Notes: svn path=/head/; revision=129079
* Replace deprecated NG_NODELEN with the new NG_NODESIZ. There is oneHartmut Brandt2004-01-261-1/+6
| | | | | | | | | | problem here still to be solved: the sockaddr_hci has still a 16 byte field for the node name. The code currently does not correctly use the length field in the sockaddr to handle the address length, so node names get truncated to 15 characters when put into a sockaddr_hci. Notes: svn path=/head/; revision=125037
* Change double include protection style in headers to matchMaksim Yevmenkin2003-11-147-7/+7
| | | | | | | | | | the rest of Netgraph code. Reviewed by: imp, ru Approved by: imp (mentor) Notes: svn path=/head/; revision=122634
* Part one of undating the bluetooth code to the newest versionJulian Elischer2003-05-1010-72/+434
| | | | | | | | Submitted by: Maksim Yevmenkin <m_evmenkin@yahoo.com> Approved by: re@ Notes: svn path=/head/; revision=114878
* The second try a committing the bluetooth codeJulian Elischer2002-11-209-0/+3477
Has been seen to work on several cards and communicating with several mobile phones to use them as modems etc. We are still talking with 3com to try get them to allow us to include the firmware for their pccard in the driver but the driver is here.. In the mean time it can be downloaded from the 3com website and loaded using the utility bt3cfw(8) (supplied) (instructions in the man page) Not yet linked to the build Submitted by: Maksim Yevmenkin <myevmenk@exodus.net> Approved by: re Notes: svn path=/head/; revision=107120