summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_input.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-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-05-24fix various typos in comment, documentation and log messages.andvar
2022-03-23fix few typos in comments, mainly s/paramenters/parameters/.andvar
2021-08-09fix typos in asymmetry, asymmetric(al), symmetrical.andvar
2021-08-06fix various typos in comments.andvar
2021-07-31s/threshhold/thresholdandvar
2021-03-08Remove the unused "addin" argument (it was always 0) and go back usingchristos
a random iss by default (instead of rfc1948)
2021-02-19it's spelled struct tcphdr, not struct tcp_hdrjakllsch
2021-02-19- Make ALIGNED_POINTER use __alignof(t) instead of sizeof(t). This is morechristos
correct because it works with non-primitive types and provides the ABI alignment for the type the compiler will use. - Remove all the *_HDR_ALIGNMENT macros and asserts - Replace POINTER_ALIGNED_P with ACCESSIBLE_POINTER which is identical to ALIGNED_POINTER, but returns that the pointer is always aligned if the CPU supports unaligned accesses. [ as proposed in tech-kern ]
2021-02-14- centralize header align and pullup into a single inline functionchristos
- use a single macro to align pointers and expose the alignment, instead of hard-coding 3 in 1/2 the macros. - fix an issue in the ipv6 lt2p where it was aligning for ipv4 and pulling for ipv6.
2020-09-29s/occurence/occurrence/msaitoh
2020-09-13inet: Fix build without ARProy
2020-09-11ARP: Use ND rather than our own.roy
This brings the benefit of Neighbour Unreachability Detection which is something ARP sorely lacks. The new timings mirror those of IPv6 and are adjustable via sysctl(8). Unlike IPv6 ND, these are global and not per interface.
2020-09-11tcp_input: Adjust for ND changesroy
2020-09-11PR/kern 55567kardel
fix the data-only fast path. RCV.UP and SND.WL1 could be left behind on long sequences of data only packets. pull them along to avoid relative sequence wraps. consistent with FreeBSD addresses second failure mode of PR/kern 55567. pullup to netbsd-8 pullup to netbsd-9
2020-09-02Fix fast path for uni directional transferskardel
pure ACK case: drag snd_wl2 along so only newer ACKs can update the window size. also avoids the state where snd_wl2 is eventually larger than th_ack and thus blocking the window update mechanism and the connection gets stuck for a loooong time in the zero sized send window state. see PR/kern 55567 ok thorpej@, also found in FreeBSD
2020-07-06- always set both ip and ip6, otherwise a kernel assertion can be triggeredchristos
- move alignment early so that we do less work
2019-11-16Call rtcache_unref() only when the checks succeed, instead of relying onmaxv
another NULL check in rtcache_unref(). Because, in order to resolve the address of the second argument, we do a dereference on 'tp', which is theoretically allowed to be NULL. The five callers of nd6_hint() never pass a NULL argument however, so by luck the actual NULL deref never happens. Maybe the NULL check on 'tp' in should be replaced to a KASSERT ensuring it isn't NULL, for clarity. Reported by kUBSan.
2019-09-25PR/54572 - Edgar Fuß -- error in commentjnemeth
2019-08-06Clamp tcp timer quantities to reasonable ranges.riastradh
Reported-by: syzbot+259675123340bf46a6de@syzkaller.appspotmail.com
2019-06-01Replace potentially misaligned pointer dereference + htonl() with be32dec()kamil
Reported by kUBSan.
2018-11-08"s/ an an / an /" in comment. No functional change.msaitoh
2018-09-14Use non-variadic function pointer in protosw::pr_input.maxv
2018-09-14rename toff -> offmaxv
2018-09-14rename off -> thlenmaxv
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-05-18IP6_EXTHDR_GET -> M_REGION_GET, no functional change.maxv
2018-05-03Remove now unused tcpip.h includes. Some were already unused before.maxv
2018-04-28Remove unused ipsec_var.h includes.maxv
2018-04-08Remove the ipre_mlast field and the TRAVERSE macro.maxv
The goal was to store in ipre_mlast the last mbuf of the chain, so that m_cat could be called on it. But it's not needed, since m_cat already does the equivalent of TRAVERSE itself. If it were needed, there would be a bug, since we don't call TRAVERSE on ipre_mlast when creating a new reassembly entry.
2018-04-03Remove ipsec_copy_policy and ipsec_copy_pcbpolicy. No functional change,maxv
since we used only ipsec_copy_pcbpolicy, and it was a no-op. Originally we were using ipsec_copy_policy to optimize the IPsec-PCB cache: when an ACK was received in response to a SYN, we used to copy the SP cached in the SYN's PCB into the ACK's PCB, so that ipsec_getpolicybysock could use the cached SP instead of requerying it. Then we switched to ipsec_copy_pcbpolicy which has always been a no-op. As a result the SP cached in the SYN was/is not copied in the ACK, and the first call to ipsec_getpolicybysock had to query the SP and cache it itself. It's not totally clear to me why this change was made. But it has been this way for years, and after a conversation with Ryota Ozaki it turns out the optimization is not valid anymore due to MP-ification, so it won't be re-enabled. ok ozaki-r@
2018-03-30Fix the log. mtod never returns NULL, so 'ip' is always non-NULL, and themaxv
'ip6' branch is never taken. As a result we log garbage on IPv6 packets. Use ip_v instead.
2018-03-30Use consttime_memequal instead of memcmp, to prevent side channels. Thismaxv
functions returns 1 when the buffers are equal, contrary to memcmp, hence the !.
2018-03-29tcp_urp_drop: fix a bug introduced in 1.390 rev (hi maxv@).rmind
2018-03-29Remove TCPREASS_DEBUG. It was introduced 20 years ago when the reassemblermaxv
was being developed, but it's irrelevant today. Makes the code clearer.
2018-03-29Reorder/Fix comments to clarify.maxv
2018-03-29Remove two more 'else' branches.maxv
2018-03-29Fix memory leak, we may reallocate 'tcp_saveti' after 'findpcb'. It's notmaxv
a tragic bug, because it happens only on sockets with debug enabled.
2018-03-29Remove 'else', makes it clearer that we leave.maxv
2018-03-29Clarify with KASSERT.maxv
2018-03-29Simplify the computation:maxv
m->m_pkthdr.len - sizeof(struct tcphdr) - optlen - hlen = m->m_pkthdr.len - (sizeof(struct tcphdr) + optlen + hlen) = m->m_pkthdr.len - [tcp_len] = toff
2018-03-28Several changes in syn_cache_respond:maxv
* Replace idiotic diagnostic check by KASSERT. max_linkhdr+tlen<=MCLBYTES is a widespread assumption. * Improve initialization of 'tp'. * Put panics in dead branches. * Merge two switches.
2018-03-28Remove unused variable.maxv
2018-03-28Remove two unused args from syn_cache_get().maxv
2018-03-28Dedup: introduce tcp_urp_drop() and use it.maxv
2018-03-28Minor changes: style, improve comments (and put them at the correct place),maxv
use NULL for pointers, and add {}s to prevent confusion.