aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/sctp_syscalls.c
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup, no functional change intended.Michael Tuexen2020-07-121-12/+0
| | | | | | | | | | | This file is only compiled if INET or INET6 is defined. So there is no need for checking that. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25635 Notes: svn path=/head/; revision=363133
* (Re)activate SCTP system calls when compiling SCTP support into the kernelMichael Tuexen2020-07-121-0/+4
| | | | | | | | | | | | | | r363079 introduced the possibility of loading the SCTP stack as a module in addition to compiling it into the kernel. As part of this, the registration of the system calls was removed and put into the loading of the module. Therefore, the system calls are not registered anymore when compiling the SCTP into the kernel. This patch addresses that. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25632 Notes: svn path=/head/; revision=363129
* Provide support for building SCTP as a loadable module.Mark Johnston2020-07-101-28/+47
| | | | | | | | | | | | | | | | | With this change, a kernel compiled with "options SCTP_SUPPORT" and without "options SCTP" supports dynamic loading of the SCTP stack. Currently sctp.ko cannot be unloaded since some prerequisite teardown logic is not yet implemented. Attempts to unload the module will return EOPNOTSUPP. Discussed with: tuexen MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21997 Notes: svn path=/head/; revision=363079
* sctp: use new capsicum helpersMateusz Guzik2020-02-151-4/+4
| | | | Notes: svn path=/head/; revision=357954
* netinet silence warningsMatt Macy2018-05-191-1/+1
| | | | Notes: svn path=/head/; revision=333869
* Move most of the contents of opt_compat.h to opt_global.h.Brooks Davis2018-04-061-1/+0
| | | | | | | | | | | | | | | | | | | | | opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941 Notes: svn path=/head/; revision=332122
* Correct sysent flags for dynamically loaded syscalls.Konstantin Belousov2017-07-141-4/+4
| | | | | | | | | | | | | | | | | | | Using the https://github.com/google/capsicum-test/ suite, the PosixMqueue.CapModeForked test was failing due to an ECAPMODE after calling kmq_notify(). On further inspection, the dynamically loaded syscall entry was initialized with sy_flags zeroed out, since SYSCALL_INIT_HELPER() left sysent.sy_flags with the default value. Add a new helper SYSCALL{,32}_INIT_HELPER_F() which takes an additional argument to specify the sy_flags value. Submitted by: Siva Mahadevan <smahadevan@freebsdfoundation.org> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11576 Notes: svn path=/head/; revision=320982
* Listening sockets improvements.Gleb Smirnoff2017-06-081-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Netflix Differential Revision: https://reviews.freebsd.org/D9770 Notes: svn path=/head/; revision=319722
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Use getsock_cap() instead of deprecated fgetsock().Gleb Smirnoff2017-01-131-4/+5
| | | | | | | Reviewed by: tuexen Notes: svn path=/head/; revision=312079
* capsicum: propagate rights on accept(2)Mariusz Zaborski2016-09-221-3/+3
| | | | | | | | | | | | | Descriptor returned by accept(2) should inherits capabilities rights from the listening socket. PR: 201052 Reviewed by: emaste, jonathan Discussed with: many Differential Revision: https://reviews.freebsd.org/D7724 Notes: svn path=/head/; revision=306174
* netinet: for pointers replace 0 with NULL.Pedro F. Giffuni2016-04-151-1/+1
| | | | | | | | | | | These are mostly cosmetical, no functional change. Found with devel/coccinelle. Reviewed by: ae. tuexen Notes: svn path=/head/; revision=298066
* Fix two KTRACE related bugs.Michael Tuexen2015-06-191-0/+8
| | | | | | | | | | Reported by: Coverity CID: 1018058, 1018060 MFC after: 3 days Notes: svn path=/head/; revision=284613
* Replace struct filedesc argument in getsock_cap with struct threadMateusz Guzik2015-04-111-4/+4
| | | | | | | This is is a step towards removal of spurious arguments. Notes: svn path=/head/; revision=281437
* fd: remove filedesc argument from fdcloseMateusz Guzik2015-04-111-1/+1
| | | | | | | | | Just accept a thread instead. This makes it consistent with fdalloc. No functional changes. Notes: svn path=/head/; revision=281436
* Avoid dynamic syscall overhead for statically compiled modules.Mateusz Guzik2014-10-261-2/+2
| | | | | | | | | | | | | | | | The kernel tracks syscall users so that modules can safely unregister them. But if the module is not unloadable or was compiled into the kernel, there is no need to do this. Achieve this by adding SY_THR_STATIC_KLD macro which expands to SY_THR_STATIC during kernel build and 0 otherwise. Reviewed by: kib (previous version) MFC after: 2 weeks Notes: svn path=/head/; revision=273707
* Move the SCTP syscalls to netinet with the rest of the SCTP code. TheMarcel Moolenaar2014-10-091-0/+588
syscalls themselves are tightly coupled with the network stack and therefore should not be in the generic socket code. The following four syscalls have been marked as NOSTD so they can be dynamically registered in sctp_syscalls_init() function: sys_sctp_peeloff sys_sctp_generic_sendmsg sys_sctp_generic_sendmsg_iov sys_sctp_generic_recvmsg The syscalls are also set up to be dynamically registered when COMPAT32 option is configured. As a side effect of moving the SCTP syscalls, getsock_cap needs to be made available outside of the uipc_syscalls.c source file. A proper prototype has been added to the sys/socketvar.h header file. API tests from the SCTP reference implementation have been run to ensure compatibility. (http://code.google.com/p/sctp-refimpl/source/checkout) Submitted by: Steve Kiernan <stevek@juniper.net> Reviewed by: tuexen, rrs Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=272823