Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: sack option handling improvements

1) Don't early return when sack doesn't fit. AccECN code will be
placed after this fragment so no early returns please.

2) Make sure opts->num_sack_blocks is not left undefined. E.g.,
tcp_current_mss() does not memset its opts struct to zero.
AccECN code checks if SACK option is present and may even
alter it to make room for AccECN option when many SACK blocks
are present. Thus, num_sack_blocks needs to be always valid.

Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250916082434.100722-6-chia-yu.chang@nokia-bell-labs.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Ilpo Järvinen and committed by
Paolo Abeni
77a4fdf4 a92543d5

+13 -10
+13 -10
net/ipv4/tcp_output.c
··· 985 985 eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack; 986 986 if (unlikely(eff_sacks)) { 987 987 const unsigned int remaining = MAX_TCP_OPTION_SPACE - size; 988 - if (unlikely(remaining < TCPOLEN_SACK_BASE_ALIGNED + 989 - TCPOLEN_SACK_PERBLOCK)) 990 - return size; 988 + if (likely(remaining >= TCPOLEN_SACK_BASE_ALIGNED + 989 + TCPOLEN_SACK_PERBLOCK)) { 990 + opts->num_sack_blocks = 991 + min_t(unsigned int, eff_sacks, 992 + (remaining - TCPOLEN_SACK_BASE_ALIGNED) / 993 + TCPOLEN_SACK_PERBLOCK); 991 994 992 - opts->num_sack_blocks = 993 - min_t(unsigned int, eff_sacks, 994 - (remaining - TCPOLEN_SACK_BASE_ALIGNED) / 995 - TCPOLEN_SACK_PERBLOCK); 996 - 997 - size += TCPOLEN_SACK_BASE_ALIGNED + 998 - opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK; 995 + size += TCPOLEN_SACK_BASE_ALIGNED + 996 + opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK; 997 + } else { 998 + opts->num_sack_blocks = 0; 999 + } 1000 + } else { 1001 + opts->num_sack_blocks = 0; 999 1002 } 1000 1003 1001 1004 if (unlikely(BPF_SOCK_OPS_TEST_FLAG(tp,