summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* we don't have to cast to caddr_t when calling m_copydata anymore.dlg2021-02-251-2/+2
| | | | | | | | | | | | | | | | the first cut of this diff was made with coccinelle using this spatch: @rule@ type caddr_t; expression m, off, len, cp; @@ -m_copydata(m, off, len, (caddr_t)cp) +m_copydata(m, off, len, cp) i had fix it's opinionated idea of formatting by hand though, so i'm not sure it was worth it. ok deraadt@ bluhm@
* netinet: tcp_close(): delay reaper timeout by one tickcheloha2020-07-241-2/+2
| | | | | | | | | Zero-tick timeouts rely on implicit behavior in the timeout layer that inhibits optimizations in softclock(). bluhm@ says waiting a tick for the reaper shouldn't break anything. ok bluhm@
* Revert the inpcb table mutex commit. It triggers a witness panicbluhm2018-10-041-3/+1
| | | | | | | in raw IP delivery and UDP broadcast loops. There inpcbtable_mtx is held and sorwakeup() is called within the loop. As sowakeup() grabs the kernel lock, we have a lock ordering problem. found by Hrvoje Popovski; OK deraadt@ mpi@
* As a step towards per inpcb or socket locks, remove the net lockbluhm2018-09-201-1/+3
| | | | | | | | | | | | for netstat -a. Introduce a global mutex that protects the tables and hashes for the internet PCBs. To detect detached PCB, set its inp_socket field to NULL. This has to be protected by a per PCB mutex. The protocol pointer has to be protected by the mutex as netstat uses it. Always take the kernel lock in in_pcbnotifyall() and in6_pcbnotify() before the table mutex to avoid lock ordering problems in the notify functions. OK visa@
* Use mbuf (not cluster) always for t_template of tcpcb.yasuoka2018-06-141-14/+4
| | | | ok bluhm
* Historically there were slow and fast tcp timeouts. That is whybluhm2018-05-081-5/+2
| | | | | | the delack timer had a different implementation. Use the same mechanism for all TCP timer. OK mpi@ visa@
* Use memcpy on freshly allocated memory and add the free size.dhill2018-04-021-3/+3
| | | | OK millert@
* Refactor tcp_mtudisc() like NetBSD did. Do the route lookup onlybluhm2018-03-181-21/+24
| | | | | if the tcpcb exits. OK mpi@
* The TCP reaper timeout was still imlemented as soft timeout. Sobluhm2018-01-231-13/+3
| | | | | | | | | | | it could run immediately and was not synchronized with the TCP timeouts, although that was the intension when it was introduced in revision 1.85. Convert the reaper to an ordinary TCP timeout so it is scheduled on the same timeout thread after all timeouts have finished. A net lock is not necessary as the process calling tcp_close() will not access the tcpcb after arming the reaper timeout. OK mikeb@
* Initialize tcp_secret in tcp_initmikeb2017-12-071-10/+8
| | | | | | | | | The initialization of a secret SHA256 context for generating TCP initial sequence numbers is moved out of tcp_set_iss_tsm used to set up ISN for new connections and into tcp_init, sparing the need for a global flag. OK deraadt, visa, mpi
* Unconditionally enable TCP selective acknowledgements (SACK)mikeb2017-10-221-15/+2
| | | | OK deraadt, mpi, visa, job
* Assert that the corresponding socket is locked when manipulating socketmpi2017-06-261-2/+3
| | | | | | | | | | | | | | | | buffers. This is one step towards unlocking TCP input path. Note that all the functions asserting for the socket lock are not necessarilly MP-safe. All the fields of 'struct socket' aren't protected. Introduce a new kernel-only kqueue hint, NOTE_SUBMIT, to be able to tell when a filter needs to lock the underlying data structures. Logic and name taken from NetBSD. Tested by Hrvoje Popovski. ok claudio@, bluhm@, mikeb@
* Merge the content of <netinet/tcpip.h> and <netinet6/tcpipv6.h> inmpi2017-05-181-2/+1
| | | | | | | | | <netinet/tcp_debug.h>. The IPv6 variant was always included and the IPv4 version is not present on all systems. Most of the offending ports are already fixed, thanks to sthen@!
* Convert diagnostic panic to compile time assert in tcp6_ctlinput().bluhm2017-05-091-5/+2
| | | | | No binary change. OK mpi@
* Introduce sstosa() for converting sockaddr_storage with a type safebluhm2017-05-041-3/+2
| | | | | | | inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
* Use the rt_rmx defines that hide the struct rt_kmetrics indirection.bluhm2017-04-191-2/+2
| | | | | No binary change. OK mpi@
* percpu counters for TCP statsjca2017-02-091-5/+6
| | | | ok mpi@ bluhm@
* Reduce the difference between struct protosw and ip6protosw. Thebluhm2017-01-261-13/+11
| | | | | | IPv4 pr_ctlinput functions did return a void pointer that was always NULL and never used. Make all functions void like in the IPv6 case. OK mpi@
* Remove NULL checks before m_free(9), it deals with it.mpi2017-01-101-3/+2
| | | | ok bluhm@, kettenis@
* No need for splsoftnet()/splx() dance around a pool_put() if the poolmpi2016-12-201-4/+1
| | | | | | has IPL_SOFTNET as ipl. ok mikeb@, kettenis@
* ANSIfy netinet/; from David Hillnaddy2016-09-241-37/+14
|
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-8/+7
| | | | | | | | | | | | | | | | | | | | | | the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
* pool_setipl for various netinet and netinet6 bitsdlg2016-09-061-1/+4
| | | | | | thank you to everyone who helped reviewed these diffs ok mpi@
* Reduce the factor of the limits derived form NMBCLUSTERS. We wantbluhm2016-09-031-2/+2
| | | | | the additional clusters in the socket buffer and not elsewhere. OK claudio@
* Use 'sc_route{4,6}' directly instead of casting them to 'struct route *'.mpi2016-08-311-11/+8
| | | | | | This is another little step towards deprecating 'struct route{,_in6}'. ok florian@
* Sync no-argument function declaration and definition by adding (void).naddy2016-03-071-3/+3
| | | | ok mpi@ millert@
* Ignore Router Advertisment's current hop limit.mpi2015-10-241-3/+3
| | | | | | | | Appart from the usual inet6 axe murdering exercise to keep you fit, this allows us to get rid of a lot of layer violation due to the use of per- ifp variables to store the current hop limit. Imputs from bluhm@, ok phessler@, florian@, bluhm@
* add a comment above the rfc1948 code that mentions the rfc so it's easy to findtedu2015-10-021-1/+4
|
* Kill yet another argument to functions in IPv6. This time ip6_output'sclaudio2015-09-111-2/+2
| | | | | | | ifpp - XXX: just for statistics ifpp is always NULL in all callers so that statistic confirms ifpp is dying OK mpi@
* Replace sockaddr casts with the proper satosin(), ... calls.bluhm2015-09-011-3/+2
| | | | From David Hill; OK mpi@; tested kspillner@; tweaks bluhm@
* The syn cache is completely implemented in tcp_input.c. So all itsbluhm2015-08-271-9/+1
| | | | | global variables should also live there. OK markus@
* Rename the syn cache counter into tcp_syn_cache_count to have thebluhm2015-08-241-9/+7
| | | | | | | | same prefix for all variables. Convert the counter type to int, the limit is also int. Before searching the cache, check that it is not empty. Do not access the counter outside of the syn cache from tcp_ctlinput(), let the syn_cache_lookup() function handle it. OK dlg@
* Expand ancient NTOHL/NTOHS/HTONS/HTONL macros.mpi2015-07-161-6/+6
| | | | ok guenther@, henning@
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-2/+2
| | | | | | | | | | | | | | | receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
* test mbuf pointers against NULL not 0jsg2015-05-131-3/+3
| | | | ok krw@ miod@
* Include the timestamp TCP option in keep alive packets as well.mikeb2015-05-071-8/+17
| | | | | | | | | | According to RFC 7323 "once TSopt has been successfully negotiated, ... [it] MUST be sent in every non-<RST> segment for the duration of the connection." Which means that keep alives which are just ACK packets must include that too. Pointed out and tested by Lauri Tirkkonen <lotheac at iki ! fi>, thanks! ok mpi
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* unifdef INET in net code as a precursor to removing the pretend option.tedu2014-12-191-7/+1
| | | | | long live the one true internet. ok henning mikeb
* move arc4random prototype to systm.h. more appropriate for most codetedu2014-11-181-2/+1
| | | | to include that than rdnvar.h. ok deraadt dlg
* remove now unnecessary casts from hash update calls.tedu2014-11-161-8/+8
|
* Let's just call a rdomain a rdomain.mpi2014-11-061-3/+3
| | | | ok dlg@
* mix the rtable into the hash for tcp sequence number generation.dlg2014-11-061-2/+3
| | | | ok tedu@ claudio@
* Remove "pl" suffix on pool names.mpi2014-11-041-6/+4
| | | | ok dlg@, uebayasi@, mikeb@
* use sha512 instead of md5 for tcp isn. ok deraadttedu2014-10-201-15/+20
|
* Fewer <netinet/in_systm.h> !mpi2014-07-221-2/+1
|
* Resize the pcb hashtable automatically. The table size will be doubledyasuoka2014-07-121-5/+4
| | | | | | when the number of the hash entries reaches 75% of the table size. ok dlg henning, 'commit in' claudio
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* ip_output() using varargs always struck me as bizarre, esp since it's onlyhenning2014-04-211-2/+2
| | | | | | ever used to pass on uint32 (for ipsec). stop that madness and just pass the uint32, 0 in all cases but the two that pass the ipsec flowinfo. ok deraadt reyk guenther
* we'll do fine without casting NULL to struct foo * / void *henning2014-04-211-3/+3
| | | | ok gcc & md5 (alas, no binary change)
* tcp_respond: let the stack worry about the cksum instead of doing ithenning2014-04-181-16/+3
| | | | manually, ok naddy (in january)