summaryrefslogtreecommitdiff
path: root/sys/netgraph/bluetooth/include
AgeCommit message (Collapse)Author
2025-12-13ng_hci(4): Fix a typo in a source code commentGordon Bergling
- s/depricated/deprecated/ MFC after: 3 days
2025-09-15ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *Christos Margiolis
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
2025-01-27ng_hci: add support for Bluetooth Secure Simple PairingAndreas Kempe
Add additional messages that allow for secure simple pairing. PR: 265066 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation (review and commit)
2023-11-30sockets: don't malloc/free sockaddr memory on getpeername/getsocknameGleb Smirnoff
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
2023-11-30sockets: don't malloc/free sockaddr memory on accept(2)Gleb Smirnoff
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
2023-08-16sys: Remove $FreeBSD$: one-line .h patternWarner Losh
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
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
2022-08-12protosw: change prototype for pr_controlGleb Smirnoff
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
2022-01-03protocols: init with standard SYSINIT(9) or VNET_SYSINITGleb Smirnoff
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
2021-09-29bluetooth: complete removal of ng_h4Warner Losh
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
2021-01-07pccard: Remove bt3c(4) driverWarner Losh
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
2020-09-01net: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365071
2020-07-17Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU.Takanori Watanabe
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
2020-07-08Add support for [read|write] supported data length commands.Takanori Watanabe
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
2020-06-15Update event masks constant to Bluetooth core spec V5.2Takanori Watanabe
and add LE Events. PR: 247257 Submitted by: Marc Veldman Notes: svn path=/head/; revision=362199
2020-06-10Add LE events:Takanori Watanabe
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
2020-05-19Fix Typo in ng_hci_le_connection_complete_ep struct.Takanori Watanabe
PR: 246538 Submitted by: Marc Veldman Notes: svn path=/head/; revision=361254
2020-05-09Add space for RSSI in data member.Takanori Watanabe
RSSI is put just after actual data. Submitted by: Marc Veldman PR: 245920 Notes: svn path=/head/; revision=360846
2020-04-28Add le_read_buffer_size command and manpage.Takanori Watanabe
It supports both v1 and v2 command. PR:245964 Submitted by: Marc Veldman <marc@bumblingdork.com> Notes: svn path=/head/; revision=360440
2020-04-20Substitute le_read_supported_status with le_read_supported_states.Hans Petter Selasky
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
2017-11-27sys: general adoption of SPDX licensing ID tags.Pedro F. Giffuni
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
2017-04-27Make cached Bluetooth LE host advertise information visible from userland.Takanori Watanabe
Differential Revision: https://reviews.freebsd.org/D10362 Notes: svn path=/head/; revision=317506
2016-04-29sys/netgraph: spelling fixes in comments.Pedro F. Giffuni
No functional change. Notes: svn path=/head/; revision=298813
2015-10-27Bluetooth LE Security Management channel support.Takanori Watanabe
Add a socket option to block until underlying HCI connection encrypted. Differential Revision: https://reviews.freebsd.org/D3981 Notes: svn path=/head/; revision=290038
2015-04-18Forgot to add default event mask definition.Takanori Watanabe
Notes: svn path=/head/; revision=281683
2015-04-07Initial Bluetooth LE support.Takanori Watanabe
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
2014-09-20Use callout(9) instead of timeout(9).John Baldwin
Reviewed by: emax Notes: svn path=/head/; revision=271908
2009-09-10Get those pesky RFCOMM RPM data bits right. This is likely a noop.Maksim Yevmenkin
MFC after: 1 month Notes: svn path=/head/; revision=197083
2008-07-30Introduce support for Bluetooth SCO sockets. This is based on olderMaksim Yevmenkin
code that was revisted. MFC after: 3 months Notes: svn path=/head/; revision=181033
2008-07-10Get in some basic infrastructure for Bluetooth SCO support.Maksim Yevmenkin
MFC after: 3 months Notes: svn path=/head/; revision=180399
2008-04-15Several changes breaking netgraph module ABI collected together:Alexander Motin
- 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
2006-07-21Change semantics of socket close and detach. Add a new protocol switchRobert Watson
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
2006-05-17Add new SIOC_HCI_RAW_NODE_LIST_NAMES ioctl. User-space applications canMaksim Yevmenkin
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
2006-04-01Chance protocol switch method pru_detach() so that it returns voidRobert Watson
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
2006-04-01Change protocol switch pru_abort() API so that it returns void ratherRobert Watson
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
2005-10-30Push the assignment of a new or updated so_qlimit from solisten()Robert Watson
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
2005-08-31Fix dangling callout problem in the Bluetooth L2CAP code that leads toMaksim Yevmenkin
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
2005-01-11Make default RFCOMM session MTU match default L2CAP MTU.Maksim Yevmenkin
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
2005-01-07/* -> /*- for license, minor formatting changesWarner Losh
Notes: svn path=/head/; revision=139823
2005-01-04Rename 'class' field to 'uclass' in the ng_hci_inquiry_response structure.Maksim Yevmenkin
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
2004-08-20Align netgraph message fields ready for 64-bit (and 128 bit :-) machines.Julian Elischer
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
2004-08-10Introduce ng_hci_inquiry_response structure and use it in the hccontrol(8)Maksim Yevmenkin
Notes: svn path=/head/; revision=133415
2004-05-10Mode few Bluetooth defines into system include filesMaksim Yevmenkin
Reviewed by: imp Notes: svn path=/head/; revision=129079
2004-01-26Replace deprecated NG_NODELEN with the new NG_NODESIZ. There is oneHartmut Brandt
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
2003-11-14Change double include protection style in headers to matchMaksim Yevmenkin
the rest of Netgraph code. Reviewed by: imp, ru Approved by: imp (mentor) Notes: svn path=/head/; revision=122634
2003-05-10Part one of undating the bluetooth code to the newest versionJulian Elischer
Submitted by: Maksim Yevmenkin <m_evmenkin@yahoo.com> Approved by: re@ Notes: svn path=/head/; revision=114878
2002-11-20The second try a committing the bluetooth codeJulian Elischer
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