History log of /openbsd-src/sys/netinet/tcp_timer.c (Results 1 – 25 of 82)
Revision Date Author Comments
# e835bce2 16-Jan-2025 bluhm <bluhm@openbsd.org>

Remove net lock from TCP sysctl for keep alive.

Keep copies in seconds for the sysctl and update timer variables
atomically when they change. tcp_maxidle was historically calculated
in tcp_slowtimo

Remove net lock from TCP sysctl for keep alive.

Keep copies in seconds for the sysctl and update timer variables
atomically when they change. tcp_maxidle was historically calculated
in tcp_slowtimo() as the timers were called from there. Better
calculate maxidle when needed. tcp_timer_init() is useless, just
initialize data. While there make the names consistent.

input sthen@; OK mvs@

show more ...


# 680a5d21 14-Jan-2025 bluhm <bluhm@openbsd.org>

Remove exclusive net lock from TCP timers.

TCP timers can run with shared netlock and socket lock. Use common
tcp_timer_enter() and tcp_timer_leave() that lock the socket and
do reference counting.

Remove exclusive net lock from TCP timers.

TCP timers can run with shared netlock and socket lock. Use common
tcp_timer_enter() and tcp_timer_leave() that lock the socket and
do reference counting. Then incpb and socket always exist.

input and OK mvs@

show more ...


# 8fed5aa8 05-Jan-2025 bluhm <bluhm@openbsd.org>

Read tcp_do_ecn only once during packet processing and mark atomic.

OK mvs@


# 4ab10cec 03-Jan-2025 bluhm <bluhm@openbsd.org>

Reference count the inpcb in TCP timers.

Switch from struct tcpcb to inpcb in the TCP timer argument. The
latter already has a reference counter. Increment it at timeout_add()
and decrement at tim

Reference count the inpcb in TCP timers.

Switch from struct tcpcb to inpcb in the TCP timer argument. The
latter already has a reference counter. Increment it at timeout_add()
and decrement at timeout_del() or when handler runs. The reaper
timeout is special as it does not need a reference, the inpcb is
already dead. Use special field t_timer_reaper instead of regular
TCP timeout and run it without reference or lock.

OK mvs@

show more ...


# f9d292df 28-Dec-2024 bluhm <bluhm@openbsd.org>

Read more TCP sysctl variables atomically.

OK mvs@


# 7aa20da4 20-Dec-2024 bluhm <bluhm@openbsd.org>

Declare some global TCP variables constant.

OK mvs@


# 7b1356d5 28-Jan-2024 bluhm <bluhm@openbsd.org>

Use more specific sockaddr type for inpcb notify.

in_pcbnotifyall() is an IPv4 only function. All callers check that
sockaddr dst is in fact a sockaddr_in. Pass the more spcific type
and remove th

Use more specific sockaddr type for inpcb notify.

in_pcbnotifyall() is an IPv4 only function. All callers check that
sockaddr dst is in fact a sockaddr_in. Pass the more spcific type
and remove the runtime check at beginning of in_pcbnotifyall().
Use const sockaddr_in in in_pcbnotifyall() and const sockaddr_in6
in6_pcbnotify() as dst parameter.

OK millert@

show more ...


# 8f2135b8 27-Jan-2024 bluhm <bluhm@openbsd.org>

Assert that tcp_timer_rexmt() uses IPv4 inpcb.

in_pcbnotifyall() must be called with IPv4 inpcb only. Comment why
this is the case and verify it with kassert. This assures that
inp_faddr is a vali

Assert that tcp_timer_rexmt() uses IPv4 inpcb.

in_pcbnotifyall() must be called with IPv4 inpcb only. Comment why
this is the case and verify it with kassert. This assures that
inp_faddr is a valid address.

OK mvs@

show more ...


# 6285ef23 11-Jan-2024 bluhm <bluhm@openbsd.org>

Fix white spaces in TCP.


# 9e96aff0 06-Jul-2023 bluhm <bluhm@openbsd.org>

Convert tcp_now() time counter to 64 bit.

After changing tcp now tick to milliseconds, 32 bits will wrap
around after 49 days of uptime. That may be a problem in some
places of our stack. Better u

Convert tcp_now() time counter to 64 bit.

After changing tcp now tick to milliseconds, 32 bits will wrap
around after 49 days of uptime. That may be a problem in some
places of our stack. Better use a 64 bit counter.

As timestamp option is 32 bit in TCP protocol, use the lower 32 bit
there. There are casts to 32 bits that should behave correctly.

Start with random 63 bit offset to avoid uptime leakage. 2^63
milliseconds result in 2.9*10^8 years of possible uptime.

OK yasuoka@

show more ...


# b9587575 14-Mar-2023 yasuoka <yasuoka@openbsd.org>

To avoid misunderstanding, keep variables for tcp keepalive in
milliseconds, which is the same unit of tcp_now(). However, keep the
unit of sysctl variables in seconds and convert their unit in
tcp_

To avoid misunderstanding, keep variables for tcp keepalive in
milliseconds, which is the same unit of tcp_now(). However, keep the
unit of sysctl variables in seconds and convert their unit in
tcp_sysctl(). Additionally revert TCPTV_SRTTDFLT back to 3 seconds,
which was mistakenly changed to 1.5 seconds by tcp_timer.h 1.19.

ok claudio

show more ...


# 00007ca3 07-Nov-2022 yasuoka <yasuoka@openbsd.org>

Modify TCP receive buffer size auto scaling to use the smoothed RTT
(SRTT) instead of the timestamp option. Since the timestamp option is
disabled on some OSs (eg. Windows) or dropped by some
firewa

Modify TCP receive buffer size auto scaling to use the smoothed RTT
(SRTT) instead of the timestamp option. Since the timestamp option is
disabled on some OSs (eg. Windows) or dropped by some
firewalls/routers, in such a case the window size had been fixed at
16KB, this limits throughput at very low on high latency networks.
Also replace "tcp_now" from 2HZ tick counter to binuptime in
milliseconds to calculate the SRTT better.

tested by krw matthieu jmatthew dlg djm stu stsp
ok claudio

show more ...


# 8c664ca5 03-Sep-2022 bluhm <bluhm@openbsd.org>

Use a mutex to update tcp_maxidle, tcp_iss, and tcp_now. This
removes pressure from the exclusive netlock in tcp_slowtimo().
Reading is done atomically. Ensure that the tcp_now value is read
only o

Use a mutex to update tcp_maxidle, tcp_iss, and tcp_now. This
removes pressure from the exclusive netlock in tcp_slowtimo().
Reading is done atomically. Ensure that the tcp_now value is read
only once per function to provide consistent time.
OK yasuoka@

show more ...


# df8d9afd 02-Jan-2022 jsg <jsg@openbsd.org>

spelling
ok jmc@ reads ok tb@


# d330eb92 20-Dec-2020 bluhm <bluhm@openbsd.org>

Accept reject and blackhole routes for IPsec PMTU discovery.

Since revision 1.87 of ip_icmp.c icmp_mtudisc_clone() ignored reject
routes. Otherwise TCP would clone these routes for PMTU discovery.

Accept reject and blackhole routes for IPsec PMTU discovery.

Since revision 1.87 of ip_icmp.c icmp_mtudisc_clone() ignored reject
routes. Otherwise TCP would clone these routes for PMTU discovery.
They will not work, even after dynamic routing has found a better
route than the reject route.

With IPsec the use case is different. First you need a route, but
then the flow handles the packet without routing. Usually this
route should be a reject route to avoid sending unencrypted traffic
if the flow is missing. But IPsec needs this route for PMTU
discovery, so use it for that.

OK claudio@ tobhe@

show more ...


# 4e64d49b 11-Jun-2018 bluhm <bluhm@openbsd.org>

The output from tcp debug sockets was incomplete. After detach tp
was NULL and nothing was traced. So save the old tcpcb and use
that to retrieve some information. Note that otb may be freed and
m

The output from tcp debug sockets was incomplete. After detach tp
was NULL and nothing was traced. So save the old tcpcb and use
that to retrieve some information. Note that otb may be freed and
must not be dereferenced. Use a heuristic for cases where the
address family is in the IP header but not provided in the PCB.
OK visa@

show more ...


# 36d7e348 10-May-2018 bluhm <bluhm@openbsd.org>

TCP debug sockets still had code for old TCP timers that were
implemented as slow and fast protocol user requests. Replace that
with a proper timer debug implementation.
OK visa@


# 5bcca80f 08-May-2018 bluhm <bluhm@openbsd.org>

Historically there were slow and fast tcp timeouts. That is why
the delack timer had a different implementation. Use the same
mechanism for all TCP timer.
OK mpi@ visa@


# 772b5f4e 07-Feb-2018 bluhm <bluhm@openbsd.org>

Historically TCP timeouts were implemented with pr_slowtimo and
pr_fasttimo. That is the reason why we have two timeout mechanisms
with complicated ticks calculation. Move the delay ACK timeout to

Historically TCP timeouts were implemented with pr_slowtimo and
pr_fasttimo. That is the reason why we have two timeout mechanisms
with complicated ticks calculation. Move the delay ACK timeout to
milliseconds and remove some ticks and hz mess from the others.
This makes it easier to see the actual values.
OK florian@ dhill@ dlg@

show more ...


# ded1556f 06-Feb-2018 bluhm <bluhm@openbsd.org>

There was a race in the TCP timers. As they may sleep to grab the
netlock, timers may still run after they have been disarmed. Deleting
the timeout is not sufficient to cancel them, but the code fr

There was a race in the TCP timers. As they may sleep to grab the
netlock, timers may still run after they have been disarmed. Deleting
the timeout is not sufficient to cancel them, but the code from 4.4
BSD is assuming this.
The solution is to add a flag for every timer to see whether it has
been armed or canceled. Remove the TF_DEAD check as tcp_canceltimers()
is called before the reaper timer is fired. Cancelation works
reliably now.
OK mpi@

show more ...


# 9acddc59 23-Jan-2018 bluhm <bluhm@openbsd.org>

The TCP reaper timeout was still imlemented as soft timeout. So
it could run immediately and was not synchronized with the TCP
timeouts, although that was the intension when it was introduced
in rev

The TCP reaper timeout was still imlemented as soft timeout. So
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@

show more ...


# df55d315 23-Jan-2018 bluhm <bluhm@openbsd.org>

Although it is a dead store here, always reassign the tcpcb after
calling tcp_close(), tcp_drop(), and tcp_disconnect(). Then no
freed memory can be used after closing a TCP connection.
OK mikeb@ mp

Although it is a dead store here, always reassign the tcpcb after
calling tcp_close(), tcp_drop(), and tcp_disconnect(). Then no
freed memory can be used after closing a TCP connection.
OK mikeb@ mpi@

show more ...


# 9b2f66c9 29-Oct-2017 florian <florian@openbsd.org>

Move NET_{,UN}LOCK into individual slowtimo functions.

Direction suggested by mpi

OK mpi, visa


# e441a72a 25-Oct-2017 job <job@openbsd.org>

Remove the TCP_FACK option and associated #if{,n}def code.

TCP_FACK was disabled by provos@ in June 1999.
TCP_FACK is an algorithm that decides that when something is lost, all
not SACKed packets un

Remove the TCP_FACK option and associated #if{,n}def code.

TCP_FACK was disabled by provos@ in June 1999.
TCP_FACK is an algorithm that decides that when something is lost, all
not SACKed packets until the most forward SACK are lost. It may be a
correct estimate, if network does not reorder packets.

OK visa@ mpi@ mikeb@

show more ...


# 86385160 22-Oct-2017 mikeb <mikeb@openbsd.org>

Unconditionally enable TCP selective acknowledgements (SACK)

OK deraadt, mpi, visa, job


1234