summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_usrreq.c
AgeCommit message (Collapse)Author
2022-11-04inpcb: rename functions to in6pcb_*ozaki-r
2022-11-04inpcb: rename functions to inpcb_*ozaki-r
Inspired by rmind-smpnet patches.
2022-10-30tcp: restore NULL check for inp in tcp_ctloutputozaki-r
2022-10-29tcp: restore NULL checks for inpozaki-r
2022-10-28inpcb: separate inpcb again to reduce the size of PCB for IPv4ozaki-r
The data size of PCB for IPv4 increased because of the merge of struct in6pcb. The change decreases the size to the original size by separating struct inpcb (again). struct in4pcb and in6pcb that embed struct inpcb are introduced. Even after the separation, users don't need to realize the separation and only have to use some macros to access dedicated data. For example, inp->inp_laddr is now accessed through in4p_laddr(inp).
2022-10-28inpcb: integrate data structures of PCB into oneozaki-r
Data structures of network protocol control blocks (PCBs), i.e., struct inpcb, in6pcb and inpcb_hdr, are not organized well. Users of the data structures have to handle them separately and thus the code is cluttered and duplicated. The commit integrates the data structures into one, struct inpcb. As a result, users of PCBs only have to handle just one data structure, so the code becomes simple. One drawback is that the data size of PCB for IPv4 increases by 40 bytes (from 248 bytes to 288 bytes).
2022-09-20tcp: separate syn cache stuffs into tcp_syncache.[ch] filesozaki-r
No functional change.
2022-06-28tcp(4): Bail early on sendoob if not connected.riastradh
XXX Not sure if testing tp->t_template is the right way to discern this -- I just reached for it because the downstream crash is a panic on tp->t_template == NULL in tcp_output. XXX In principle this could try connecting to the address, except it's not passed down from the logic in uipc_socket.c to tcp_sendoob. Reported-by: syzbot+a01f4cfec72790855ce2@syzkaller.appspotmail.com
2021-08-04Get the value of the right variable (from RVP)christos
2021-03-08Remove the unused "addin" argument (it was always 0) and go back usingchristos
a random iss by default (instead of rfc1948)
2020-11-23Restore correct functioning of SIOCATMARK by removing the previouschs
change that was done to fix poll(POLLPRI | POLLRDBAND) and instead add a separate flag to track when poll() should indicate that a MSG_OOB byte is available. Re-fixes PR 54435 properly.
2020-10-17Fix RTT values reported by TCP_INFO.mlelstv
2020-04-13hardclock_ticks -> getticks()maxv
2019-08-06Clamp tcp timer quantities to reasonable ranges.riastradh
Reported-by: syzbot+259675123340bf46a6de@syzkaller.appspotmail.com
2019-02-05adjust fallthru comments to appease gcc7.mrg
2019-01-28Fix memory leaks pointed out by Ilja Van Sprundel: allmartin
sendoob() functions are expted to free both passed mbuf chains.
2018-12-16sbspace() does not return negative values anymore and that broke OOB datachristos
sending. Instead of depending on negative values, account for the 1024 bytes sosend() adds so that it can use all the space here in a separate function sbspace_oob(). Idea from mlelstv@
2018-11-24KNF, no functional change.maxv
2018-11-24Fix kernel pointer leaks in sysctl_inpcblist.maxv
2018-05-03Remove now unused tcpip.h includes. Some were already unused before.maxv
2018-04-07Remove dead code.maxv
2018-03-29Remove #ifdef INET. Same as tcp_input.c. Makes the code easier tomaxv
understand. Also make tcp6_mtudisc() static in tcp_subr.c.
2017-08-15add some more getsockopt(2) paramschristos
2017-07-28Remove TCP_COMPAT_42. This feature is a workaround for a bug in the TCPmaxv
stack of BSD4.2. Having such features just does not make any sense, and looking at the code, I'm not sure it actually works.
2017-01-24Tweak softnet_lock and NET_MPSAFEozaki-r
- Don't hold softnet_lock in some functions if NET_MPSAFE - Add softnet_lock to sysctl_net_inet_icmp_redirtimeout - Add softnet_lock to expire_upcalls of ip_mroute.c - Restore softnet_lock for in{,6}_pcbpurgeif{,0} if NET_MPSAFE - Mark some softnet_lock for future work
2016-11-18fix: "ifconfig destory" can stalls when "ifconfig" is done parallel.knakahara
This problem occurs only if NET_MPSAFE on. ifconfig destroy side: kernel entry point is ifioctl => if_clone_destroy. pr_purgeif() acquires softnet_lock, and then ifa_remove() calls pserialize_perform() holding softnet_lock. ifconfig side: kernel entry point is socreate. pr_attach()(udp_attach_wrapper()) calls sosetlock(). In this call path, sosetlock() try to acquire softnet_lock. These can cause dead lock.
2016-04-26Sweep unnecessary route.h inclusionsozaki-r
2016-02-15Reduce code duplication.rtr
Split creation of IPv4-Mapped IPv6 addresses into its own function and use it. No functional change intended. As posted to tech-net@
2016-02-14remove duplicated #include of <netinet/in.h>rtr
2015-08-24sprinkle _KERNEL_OPTpooka
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@
2015-03-31Remove unnecessary opt_ipsec.h inclusionsozaki-r
2015-02-14Port over the TCP_INFO socket option from FreeBSD, originally fromhe
the Linux 2.6 TCP API. This permits the caller to query certain information about a TCP connection, and is used by pkgsrc's net/iperf3 test program if available. This extends struct tcbcb with three fields to count retransmits, out-of-sequence receives and zero window announcements, and will therefore warrant a kernel revision bump (done separately).
2014-11-10Do not uselessly include <sys/malloc.h>.maxv
2014-10-18src is too big these days to tolerate superfluous apostrophes. It'ssnj
"its", people!
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-05get_tcppcb() is nearly always called upon entry to usrreqs sortr
KASSERT(solocked(so)) inside it and remove the redundant KASSERT everywhere we are using tcp_getpcb()
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-08-02restore splsoftnet() in various usrreqs that were removed during the PRUrtr
splits. we will properly review removal after the PRU split work is complete.
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-30put boilerplate extraction of inpcb or in6pcb and tcpcb performed in tcprtr
usrreqs into a function that can be called instead of cut & pasting it to every single usrreq function. tcp_getpcb(struct socket *, struct inpcb **, struct in6pcb **, struct tcpcb **) * examines the family of the provided socket and fills in either inpcb or in6pcb and tcpcb. * if the pcb is not present for the family of the socket EINVAL is returned, if the family is not AF_INET{,6} EAFNOSUPPORT is returned. signature provided by and patch reviewed by rmind
2014-07-24cleanup after last commitrtr
- add KASSERT(req != PRU_BIND) and KASSERT(req != PRU_LISTEN) inside tcp_usrreq() as these reqs should no longer reach here. - remove (now unreachable) PRU_LISTEN case in switch.
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