socket: Implement SO_RERRORSO_RERROR indicates that receive buffer overflows should be handled aserrors. Historically receive buffer overflows have been ignored andprograms could not tell if they
socket: Implement SO_RERRORSO_RERROR indicates that receive buffer overflows should be handled aserrors. Historically receive buffer overflows have been ignored andprograms could not tell if they missed messages or messages had beentruncated because of overflows. Since programs historically do notexpect to get receive overflow errors, this behavior is not thedefault.This is really really important for programs that use route(4) to keepin sync with the system. If we loose a message then we need to reloadthe full system state, otherwise the behaviour from that point isundefined and can lead to chasing bogus bug reports.Reviewed by: philip (network), kbowling (transport), gbe (manpages)MFC after: 2 weeksDifferential Revision: https://reviews.freebsd.org/D26652(cherry picked from commit 7045b1603bdf054145dd958a4acc17b410fb62a0)
show more ...
Consistently use the SOLISTENING() macroSome code was using it already, but in many places we were testingSO_ACCEPTCONN directly. As a small step towards fixing some bugsinvolving synchronizatio
Consistently use the SOLISTENING() macroSome code was using it already, but in many places we were testingSO_ACCEPTCONN directly. As a small step towards fixing some bugsinvolving synchronization with listen(2), make the kernel consistentlyuse SOLISTENING(). No functional change intended.Sponsored by: The FreeBSD Foundation(cherry picked from commit f4bb1869ddd2bca89b6b6bfaf4d866efdd9243cf)
net: clean up empty lines in .c and .h files
Allow some Bluetooth LE related HCI request to non-root user.PR: 247588Reported by: Greg V ([email protected])Reviewed by: emaxDifferential Revision: https://reviews.freebsd.org/D25516
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that arestill not MPSAFE (or already are but aren’t properly mark
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that arestill not MPSAFE (or already are but aren’t properly marked).Use it in preparation for a general review of all nodes.This is non-functional change that adds annotations to SYSCTL_NODE andSYSCTL_PROC nodes using one of the soon-to-be-required flags.Mark all obvious cases as MPSAFE. All entries that haven't been markedas MPSAFE before are by default marked as NEEDGIANTApproved by: kib (mentor, blanket)Commented by: kib, gallatin, melifaroDifferential Revision: https://reviews.freebsd.org/D23718
avoid holding PCB mutex during copyin/copyout()Reported by: imp, mms dot vanbreukelingen at gmail dot comReviewed by: imp
sys: general adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorpro
sys: general adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.No functional change intended.
Listening sockets improvements.o Separate fields of struct socket that belong to listening from fields that belong to normal dataflow, and unionize them. This shrinks the structure a bit. -
Listening sockets improvements.o Separate fields of struct socket that belong to listening from fields that belong to normal dataflow, and unionize them. This shrinks the structure a bit. - Take out selinfo's from the socket buffers into the socket. The first reason is to support braindamaged scenario when a socket is added to kevent(2) and then listen(2) is cast on it. The second reason is that there is future plan to make socket buffers pluggable, so that for a dataflow socket a socket buffer can be changed, and in this case we also want to keep same selinfos through the lifetime of a socket. - Remove struct struct so_accf. Since now listening stuff no longer affects struct socket size, just move its fields into listening part of the union. - Provide sol_upcall field and enforce that so_upcall_set() may be called only on a dataflow socket, which has buffers, and for listening sockets provide solisten_upcall_set().o Remove ACCEPT_LOCK() global. - Add a mutex to socket, to be used instead of socket buffer lock to lock fields of struct socket that don't belong to a socket buffer. - Allow to acquire two socket locks, but the first one must belong to a listening socket. - Make soref()/sorele() to use atomic(9). This allows in some situations to do soref() without owning socket lock. There is place for improvement here, it is possible to make sorele() also to lock optionally. - Most protocols aren't touched by this change, except UNIX local sockets. See below for more information.o Reduce copy-and-paste in kernel modules that accept connections from listening sockets: provide function solisten_dequeue(), and use it in the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4), infiniband, rpc.o UNIX local sockets. - Removal of ACCEPT_LOCK() global uncovered several races in the UNIX local sockets. Most races exist around spawning a new socket, when we are connecting to a local listening socket. To cover them, we need to hold locks on both PCBs when spawning a third one. This means holding them across sonewconn(). This creates a LOR between pcb locks and unp_list_lock. - To fix the new LOR, abandon the global unp_list_lock in favor of global unp_link_lock. Indeed, separating these two locks didn't provide us any extra parralelism in the UNIX sockets. - Now call into uipc_attach() may happen with unp_link_lock hold if, we are accepting, or without unp_link_lock in case if we are just creating a socket. - Another problem in UNIX sockets is that uipc_close() basicly did nothing for a listening socket. The vnode remained opened for connections. This is fixed by removing vnode in uipc_close(). Maybe the right way would be to do it for all sockets (not only listening), simply move the vnode teardown from uipc_detach() to uipc_close()?Sponsored by: NetflixDifferential Revision: https://reviews.freebsd.org/D9770
Disconnect LE socket when the HCI connection associated is disconnected.
sys/netgraph: spelling fixes in comments.No functional change.
Remove slightly used const values that can be replaced with nitems().Suggested by: jhb
Make it possible for sbappend() to preserve M_NOTREADY on mbufs, just likesbappendstream() does. Although, M_NOTREADY may appear only on SOCK_STREAMsockets, due to sendfile(2) supporting only the l
Make it possible for sbappend() to preserve M_NOTREADY on mbufs, just likesbappendstream() does. Although, M_NOTREADY may appear only on SOCK_STREAMsockets, due to sendfile(2) supporting only the latter, there is a cornercase of AF_UNIX/SOCK_STREAM socket, that still uses records for the sakeof control data, albeit being stream socket.Provide private version of m_clrprotoflags(), which understands PRUS_NOTREADY,similar to m_demote().
- grab ng_btsocket_l2cap_sockets_mtx lock in ng_btsocket_l2cap_process_l2ca_enc_change() before calling ng_btsocket_l2cap_pcb_by_cid();- handle possible NULL value returned from ng_btsocket_l
- grab ng_btsocket_l2cap_sockets_mtx lock in ng_btsocket_l2cap_process_l2ca_enc_change() before calling ng_btsocket_l2cap_pcb_by_cid();- handle possible NULL value returned from ng_btsocket_l2cap_pcb_by_cid();Submitted by: Hans Petter Selasky; hps at selasky dot orgMFC after: 1 week
Fix encryption error handling.Close l2cap connection on encryption error.
Bluetooth LE Security Management channel support.Add a socket option to block until underlying HCI connection encrypted.Differential Revision: https://reviews.freebsd.org/D3981
Fix rfcomm_sppd regression I could reproduced.To reproduce it, Two machine running FreeBSD andrunrfcomm_sppd -c 3 -Srfcomm_sppd -a ${PEER} -c 3on each side.
Initial Bluetooth LE support.Note that sockaddr_l2cap structure is changed , check socket addressto initialize new structure member and define L2CAP_SOCKET_CHECKEDbefore including ng_btsocket.h
Initial Bluetooth LE support.Note that sockaddr_l2cap structure is changed , check socket addressto initialize new structure member and define L2CAP_SOCKET_CHECKEDbefore including ng_btsocket.hDifferential Revision: https://reviews.freebsd.org/D2021Reviewed by:emax
In preparation of merging projects/sendfile, transform bare access tosb_cc member of struct sockbuf to a couple of inline functions:sbavail() and sbused()Right now they are equal, but once notio
In preparation of merging projects/sendfile, transform bare access tosb_cc member of struct sockbuf to a couple of inline functions:sbavail() and sbused()Right now they are equal, but once notion of "not ready socket buffer data",will be checked in, they are going to be different.Sponsored by: NetflixSponsored by: Nginx, Inc.
Use callout(9) instead of timeout(9).Reviewed by: emax
PF_BLUETOOTH protocols: skip initialization of non-virtualized globalsfor non-default VNET instances.This fixes panic on a vnet initialization when ng_btsocket is loaded.MFC after: 1 week
PR: 168520 170096Submitted by: adrian, zecFix multiple kernel panics when VIMAGE is enabled in the kernel.These fixes are based on patches submitted by Adrian Chadd and Marko Zec.(1) Set curth
PR: 168520 170096Submitted by: adrian, zecFix multiple kernel panics when VIMAGE is enabled in the kernel.These fixes are based on patches submitted by Adrian Chadd and Marko Zec.(1) Set curthread->td_vnet to vnet0 in device_probe_and_attach() just before calling device_attach(). This fixes multiple VIMAGE related kernel panics when trying to attach Bluetooth or USB Ethernet devices because curthread->td_vnet is NULL.(2) Set curthread->td_vnet in if_detach(). This fixes kernel panics when detaching networking interfaces, especially USB Ethernet devices.(3) Use VNET_DOMAIN_SET() in ng_btsocket.c(4) In ng_unref_node() set curthread->td_vnet. This fixes kernel panics when detaching Netgraph nodes.
Mechanically substitute flags from historic mbuf allocator withmalloc(9) flags within sys.Exceptions:- sys/contrib not touched- sys/mbuf.h edited manually
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.The SYSCTL_NODE macro defines a list that stores all child-elements ofthat node. If there's no SYSCTL_DECL macro anywhere else,
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.The SYSCTL_NODE macro defines a list that stores all child-elements ofthat node. If there's no SYSCTL_DECL macro anywhere else, there's noreason why it shouldn't be static.
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.This means that their use is restricted to a single C file.
Fix typos - remove duplicate "the".PR: bin/154928Submitted by: Eitan Adler <lists at eitanadler.com>MFC after: 3 days
1234