summaryrefslogtreecommitdiff
path: root/sys/netbt
AgeCommit message (Collapse)Author
2023-03-26fix various typos in documentation, comments and sysctl device description.andvar
mainly aion -> ation and inlude -> include.
2022-12-24s/Reqest/Request/ and adding apostrophe for don't and didn't in comments.andvar
2022-05-28fix various typos in comments, mainly origional->original,andvar
extened->extended, incomming->incoming.
2022-03-13s/hander/handler/ and s/hader/header/ in comments and documentation.andvar
2021-12-05s/commmand/command/ in comment.msaitoh
2021-12-04fix typos in comments and log messages, mainly in establish(ed).andvar
2021-11-22s/repsonse/response/ in comment.msaitoh
2021-09-21don't opencode kauth_cred_get()christos
2021-08-07Merge thorpej-cfargs2.thorpej
2021-04-24Merge thorpej-cfargs branch:thorpej
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments. Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.) Remove unnecessary or redundant interface attributes where they're not needed. There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles) ...and a sentinel value CFARG_EOL. Add some extra sanity checking to ensure that interface attributes aren't ambiguous. Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
2020-02-29pass the address of the field, instead of relying on it being the firstmaxv
field of the structure/union, no functional change, discussed with plunky@
2020-02-23fix reversed logic for Remote Port Negotiation, pointed out by maxv@plunky
2019-09-28permit read_encryption_key_size from userlandplunky
2019-09-28When encrypted connections are configured, verify that the encryptionplunky
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/
2019-02-03- add or adjust /* FALLTHROUGH */ where appropriatemrg
- add __unreachable() after functions that can return but won't in this case, and thus can't be marked __dead easily
2019-01-28Fix memory leaks pointed out by Ilja Van Sprundel: allmartin
sendoob() functions are expted to free both passed mbuf chains.
2018-12-22Replace M_ALIGN and MH_ALIGN by m_align.maxv
2018-09-07two issues noted by maxv@plunky
1. If an adaptor sends repeated fragments indicating HCI_PACKET_START, we would leak mbufs. Fix that by releasing the previous in that case. 2. If an adaptor sends fragments which overflow the expected total payload length, it could build up the pending packet to use up system mbufs. Fix that by changing the unsigned calculation to a comparison and rejecting oversize packets
2018-09-03Rename min/max -> uimin/uimax for better honesty.riastradh
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended. HOWEVER! Some subsystems have #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation. To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it. I have left a handful of bootloaders that are too annoying to compile-test, and some dead code: cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4)) It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them. Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
2018-08-21Result of audit to check that mbuf length is checked before m_copydata()plunky
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
2018-07-25Appease GCC in hci_filter_test()kamil
Cast the returned value from hci_filter_test explicitly to int, as requested by GCC when building with Undefined Behavior Sanitizer.
2017-12-21add HCI_SPEC_50plunky
2017-01-28avoid -Werror=sign-conversionjakllsch
2017-01-28factor out common subexpressions.christos
2016-12-12acknowleg -> acknowledg, proceedure -> procedure.maya
only comments were changed. from miod
2016-10-04The last named argument of a variadic function shall not be defaultjoerg
promoted according to ISO C.
2016-01-21Revert previous: ran cvs commit when I meant cvs diff. Sorry!riastradh
Hit up-arrow one too few times.
2016-01-21Give proper prototype to ip_output.riastradh
2015-12-22there is no longer a reason to have a separate hci_send function nowplunky
that the hci_usrreq function is disassembled, so merge hci_send_pcb back into hci_send()
2015-11-28add version and extended feature flags defined in 4.2 specification,plunky
add cache for page 2 of extended features and return this in the SIOCGBTFEAT ioctl (no change in size)
2015-11-28note recent spec additions to L2CAP Info command regarding fixed channelsplunky
2015-11-28add in PSMs defined in later versions of specificationplunky
2015-09-06More on PR 41200: headers that declare ioctls should include sys/ioccom.h.dholland
This covers (I think) all the MI headers outside of external/ (and dist/).
2015-05-02make connect syscall use sockaddr_big and modify pr_{send,connect}rtr
nam parameter type from buf * to sockaddr *. final commit for parameter type changes to protocol user requests * bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect}
2015-04-26remove pr_generic from struct pr_usrreqs and all implementations ofrtr
pr_generic in protocols. bump to 7.99.13 approved by rmind@
2015-04-24make accept, getsockname and getpeername syscalls use sockaddr_big and modifyrtr
pr_{accept,sockname,peername} nam parameter type from mbuf * to sockaddr *. * retained use of mbuftypes[MT_SONAME] for now. * bump to netbsd version 7.99.12 for parameter type change. patch posted to tech-net@ 2015/04/19
2015-04-03* change pr_bind to accept struct sockaddr * instead of struct mbuf *rtr
* update protocol bind implementations to use/expect sockaddr * instead of mbuf * * introduce sockaddr_big struct for storage of addr data passed via sys_bind; sockaddr_big is of sufficient size and alignment to accommodate all addr data sizes received. * modify sys_bind to allocate sockaddr_big instead of using an mbuf. * bump kernel version to 7.99.9 for change to pr_bind() parameter type. Patch posted to tech-net@ http://mail-index.netbsd.org/tech-net/2015/03/15/msg005004.html The choice to use a new structure sockaddr_big has been retained since changing sockaddr_storage size would lead to unnecessary ABI change. The use of the new structure does not preclude future work that increases the size of sockaddr_storage and at that time sockaddr_big may be trivially replaced. Tested by mrg@ and myself, discussed with rmind@, posted to tech-net@
2014-11-16since rfcomm_attach_pcb may be called from (soft) interrupt contextplunky
(for incoming connections), use kmem_intr_()
2014-08-09split PRU_CONNECT2 & PRU_PURGEIF function out of pr_generic() usrreqrtr
switches and put into separate functions - always KASSERT(solocked(so)) even if not implemented (for PRU_CONNECT2 only) - replace calls to pr_generic() with req = PRU_CONNECT2 with calls to pr_connect2() - replace calls to pr_generic() with req = PRU_PURGEIF with calls to pr_purgeif() put common code from unp_connect2() (used by unp_connect() into unp_connect1() and call out to it when needed patch only briefly reviewed by rmind@
2014-08-08split PRU_RCVD function out of pr_generic() usrreq switches and put intortr
separate functions - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_RCVD with calls to pr_rcvd()
2014-08-05split PRU_SEND function out of pr_generic() usrreq switches and put intortr
separate functions xxx_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *) - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_SEND with calls to pr_send() rename existing functions that operate on PCB for consistency (and to free up their names for xxx_send() PRUs - l2cap_send() -> l2cap_send_pcb() - sco_send() -> sco_send_pcb() - rfcomm_send() -> rfcomm_send_pcb() patch reviewed by rmind
2014-08-05revert the removal of struct lwp * parameter from bind, listen and connectrtr
user requests. this should resolve the issue relating to nfs client hangs presented recently by wiz on current-users@
2014-07-31release mbuf on failure of PRU_SENDrtr
2014-07-31split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out ofrtr
pr_generic() usrreq switches and put into separate functions xxx_disconnect(struct socket *) xxx_shutdown(struct socket *) xxx_abort(struct socket *) - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_{DISCONNECT,SHUTDOWN,ABORT} with calls to pr_{disconnect,shutdown,abort}() respectively rename existing internal functions used to implement above functionality to permit use of the names for xxx_{disconnect,shutdown,abort}(). - {l2cap,sco,rfcomm}_disconnect() -> {l2cap,sco,rfcomm}_disconnect_pcb() - {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1() - unp_shutdown() -> unp_shutdown1() patch reviewed by rmind
2014-07-30split PRU_CONNECT function out of pr_generic() usrreq switches and putrtr
into seaparate functions xxx_listen(struct socket *, struct mbuf *) - always KASSERT(solocked(so)) and KASSERT(nam != NULL) - replace calls to pr_generic() with req = PRU_CONNECT with pr_connect() - rename existin {l2cap,sco,rfcomm}_connect() to {l2cap,sco,rfcomm}_connect_pcb() respectively to permit naming consistency with other protocols functions. - drop struct lwp * parameter from unp_connect() and at_pcbconnect() and use curlwp instead where appropriate. patch reviewed by rmind
2014-07-24split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreqrtr
switches and put into separate functions xxx_bind(struct socket *, struct mbuf *) xxx_listen(struct socket *) - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_BIND with call to pr_bind() - replace calls to pr_generic() with req = PRU_LISTEN with call to pr_listen() - drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and unp_bind() and always use curlwp. rename existing functions that operate on PCB for consistency (and to free up their names for xxx_{bind,listen}() PRUs - l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb() - sco_{bind,listen}() -> sco_{bind,listen}_pcb() - rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb() patch reviewed by rmind welcome to netbsd 6.99.48
2014-07-23split PRU_SENDOOB and PRU_RCVOOB function out of pr_generic() usrreqrtr
switches and put into separate functions xxx_sendoob(struct socket *, struct mbuf *, struct mbuf *) xxx_recvoob(struct socket *, struct mbuf *, int) - always KASSERT(solocked(so)) even if request is not implemented - replace calls to pr_generic() with req = PRU_{SEND,RCV}OOB with calls to pr_{send,recv}oob() respectively. there is still some tweaking of m_freem(m) and m_freem(control) to come for consistency. not performed with this commit for clarity. reviewed by rmind
2014-07-09* split PRU_ACCEPT function out of pr_generic() usrreq switches and putrtr
into a separate function xxx_accept(struct socket *, struct mbuf *) note: future cleanup will take place to remove struct mbuf parameter type and replace it with a more appropriate type. patch reviewed by rmind
2014-07-09* split PRU_PEERADDR and PRU_SOCKADDR function out of pr_generic()rtr
usrreq switches and put into separate functions xxx_{peer,sock}addr(struct socket *, struct mbuf *). - KASSERT(solocked(so)) always in new functions even if request is not implemented - KASSERT(pcb != NULL) and KASSERT(nam) if the request is implemented and not for tcp. * for tcp roll #ifdef KPROF and #ifdef DEBUG code from tcp_usrreq() into easier to cut & paste functions tcp_debug_capture() and tcp_debug_trace() - functions provided by rmind - remaining use of PRU_{PEER,SOCK}ADDR #define to be removed in a future commit. * rename netbt functions to permit consistency of pru function names (as has been done with other requests already split out). - l2cap_{peer,sock}addr() -> l2cap_{peer,sock}_addr_pcb() - rfcomm_{peer,sock}addr() -> rfcomm_{peer,sock}_addr_pcb() - sco_{peer,sock}addr() -> sco_{peer,sock}_addr_pcb() * split/refactor do_sys_getsockname(lwp, fd, which, nam) into two functions do_sys_get{peer,sock}name(fd, nam). - move PRU_PEERADDR handling into do_sys_getpeername() from do_sys_getsockname() - have svr4_stream directly call do_sys_get{sock,peer}name() respectively instead of providing `which' & fix a DPRINTF string that incorrectly wrote "getpeername" when it meant "getsockname" - fix sys_getpeername() and sys_getsockname() to call do_sys_get{sock,peer}name() without `which' and `lwp' & adjust comments - bump kernel version for removal of lwp & which parameters from do_sys_getsockname() note: future cleanup to remove struct mbuf * abuse in xxx_{peer,sock}name() still to come, not done in this commit since it is easier to do post split. patch reviewed by rmind welcome to 6.99.47
2014-07-07* sprinkle KASSERT(solocked(so)); in all pr_stat() functions.rtr
* fix remaining inconsistent struct socket parameter names.