tcp: Check for filled TCP option space before SACK
Subsystems (3)
Mat Martineau
PATCH 1/1 tcp: Check for filled TCP option space before SACK
The SACK code would potentially add four bytes to the expected TCP option size even if all option space was already used.
--- net/ipv4/tcp_output.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv4/tcp_output.c +3 -0
@@ -814,6 +814,9 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb } } +if (size +TCPOLEN_SACK_BASE_ALIGNED >=MAX_TCP_OPTION_SPACE ) +return size; + eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;if (unlikely (eff_sacks)) {const unsigned int remaining =MAX_TCP_OPTION_SPACE - size;
Signature · 1 line
2.21.0
Matthieu Baerts
Hi Mat,
Thank you for the patch!
Quoted 13 lines · Mat Martineau
The SACK code would potentially add four bytes to the expected TCP option size even if all option space was already used.
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>--- net/ipv4/tcp_output.c | 3 +++ 1 file changed, 3 insertions(+)net/ipv4/tcp_output.c +0
-0
net/ipv4/tcp_output.c static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb · line 819
Quoted 6 lines
net/ipv4/tcp_output.c +3
-0@@ -814,6 +814,9 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb } } +if (size +TCPOLEN_SACK_BASE_ALIGNED >=MAX_TCP_OPTION_SPACE ) +return size; +
Should we not add this check in the "if" block here below...
net/ipv4/tcp_output.c static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb · line 822
Quoted 3 lines
net/ipv4/tcp_output.c +0
-0eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;if (unlikely (eff_sacks)) {const unsigned int remaining =MAX_TCP_OPTION_SPACE - size;
... to use this "remaining" variable only if we want to add SACKS:
if (TCPOLEN_SACK_BASE_ALIGNED >= remaining)
return size;
Do you want me to squash this fix in Peter's commit (mptcp: Handle MP_CAPABLE options for outgoing connections) or to add it as a new commit just after Peter's one? (It's only to ease the "rebasing" task later by helping doing a maximum now as long as I can help :) )
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Mat Martineau
Quoted 27 lines · Matthieu Baerts
Hi Mat,
Thank you for the patch!
Quoted 13 lines · Mat Martineau
The SACK code would potentially add four bytes to the expected TCP option size even if all option space was already used.
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>--- net/ipv4/tcp_output.c | 3 +++ 1 file changed, 3 insertions(+)net/ipv4/tcp_output.c +0
-0net/ipv4/tcp_output.c static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb · line 819
Quoted 6 lines
net/ipv4/tcp_output.c +3
-0@@ -814,6 +814,9 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb } } +if (size +TCPOLEN_SACK_BASE_ALIGNED >=MAX_TCP_OPTION_SPACE ) +return size; +Should we not add this check in the "if" block here below...
Quoted 8 lines
net/ipv4/tcp_output.c static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb · line 822
Quoted 3 lines
net/ipv4/tcp_output.c +0
-0eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;if (unlikely (eff_sacks)) {const unsigned int remaining =MAX_TCP_OPTION_SPACE - size;... to use this "remaining" variable only if we want to add SACKS:
if (
TCPOLEN_SACK_BASE_ALIGNED>= remaining)return size;
Florian had suggested the above location (#2 in
https://lists.01.org/pipermail/mptcp/2019-April/001097.html). Seemed like adding the check there made sense because there's no need to calculate eff_sacks if there's no option space.
Quoted 6 lines
Do you want me to squash this fix in Peter's commit (mptcp: Handle
MP_CAPABLEoptions for outgoing connections) or to add it as a new commit just after Peter's one? (It's only to ease the "rebasing" task later by helping doing a maximum now as long as I can help :) )
I'd prefer to add commits to the end so it's easier for everyone to see what's changing over time.
--
Mat Martineau
Intel
Matthieu Baerts
Hi Mat,
Quoted 37 lines · Mat Martineau
Quoted 34 lines · Matthieu Baerts
Hi Mat,
Thank you for the patch!
Quoted 17 lines · Mat Martineau
The SACK code would potentially add four bytes to the expected TCP option size even if all option space was already used.
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>---
net/ipv4/tcp_output.c | 3 +++1 file changed, 3 insertions(+)net/ipv4/tcp_output.c +0
-0@@ -814,6 +814,9 @@ static unsigned inttcp_established_options(struct sock *sk, struct
sk_buff*skb }
}Quoted 3 lines
+ if (size +
TCPOLEN_SACK_BASE_ALIGNED>=MAX_TCP_OPTION_SPACE) + return size;
+Should we not add this check in the "if" block here below...
Quoted 3 lines
eff_sacks=tp->rx_opt.num_sacks+tp->rx_opt.dsack; if (unlikely(eff_sacks)) {
const unsigned int remaining =MAX_TCP_OPTION_SPACE- size;... to use this "remaining" variable only if we want to add SACKS:
Quoted 7 lines
Quoted 2 lines
if (
TCPOLEN_SACK_BASE_ALIGNED>= remaining)
return size;Florian had suggested the above location (#2 in
https://lists.01.org/pipermail/mptcp/2019-April/001097.html). Seemed like adding the check there made sense because there's no need to calculateeff_sacksif there's no option space.
I thought Florian' suggestion was only to show the bug. But OK for me to keep it there if you prefer.
Quoted 9 lines
Quoted 6 lines
Do you want me to squash this fix in Peter's commit (mptcp: Handle
MP_CAPABLEoptions for outgoing connections) or to add it as a new commit just after Peter's one? (It's only to ease the "rebasing" task later by helping doing a maximum now as long as I can help :) )I'd prefer to add commits to the end so it's easier for everyone to see what's changing over time.
Do you mean for those who doesn't subscribe to this ML? Or for everybody in general?
If it is for everybody, I guess the best is also to stop the CI scripts doing the automatic rebases once per day after validations then.
Added at the end as requested.
https://github.com/multipath-tcp/mptcp_net-next/commits/export
Matt
Quoted 3 lines
Signature · 2 lines
Mat Martineau Intel
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Mat Martineau
Quoted 58 lines · Matthieu Baerts
Hi Mat,
Quoted 37 lines · Mat Martineau
Quoted 34 lines · Matthieu Baerts
Hi Mat,
Thank you for the patch!
Quoted 17 lines · Mat Martineau
The SACK code would potentially add four bytes to the expected TCP option size even if all option space was already used.
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>---
net/ipv4/tcp_output.c | 3 +++1 file changed, 3 insertions(+)net/ipv4/tcp_output.c +0
-0@@ -814,6 +814,9 @@ static unsigned inttcp_established_options(struct sock *sk, struct
sk_buff*skb }
}Quoted 3 lines
+ if (size +
TCPOLEN_SACK_BASE_ALIGNED>=MAX_TCP_OPTION_SPACE) + return size;
+Should we not add this check in the "if" block here below...
Quoted 3 lines
eff_sacks=tp->rx_opt.num_sacks+tp->rx_opt.dsack; if (unlikely(eff_sacks)) {
const unsigned int remaining =MAX_TCP_OPTION_SPACE- size;... to use this "remaining" variable only if we want to add SACKS:
Quoted 7 lines
Quoted 2 lines
if (
TCPOLEN_SACK_BASE_ALIGNED>= remaining)
return size;Florian had suggested the above location (#2 in
https://lists.01.org/pipermail/mptcp/2019-April/001097.html). Seemed like adding the check there made sense because there's no need to calculateeff_sacksif there's no option space.I thought Florian' suggestion was only to show the bug. But OK for me to keep it there if you prefer.
Quoted 7 lines
Quoted 6 lines
Do you want me to squash this fix in Peter's commit (mptcp: Handle
MP_CAPABLEoptions for outgoing connections) or to add it as a new commit just after Peter's one? (It's only to ease the "rebasing" task later by helping doing a maximum now as long as I can help :) )
Quoted 6 lines
Quoted 2 lines
I'd prefer to add commits to the end so it's easier for everyone to see what's changing over time.
Do you mean for those who doesn't subscribe to this ML? Or for everybody in general?
I was thinking in general - with various patch sets (and versions of those patch sets) in stages of review and getting merged, it helps if it's easy to see what's been merged and when.
The new pattern seems to be to squash small fixes and append more significant ones - that seems to be working for the group and not causing problems.
Quoted 2 lines
If it is for everybody, I guess the best is also to stop the CI scripts doing the automatic rebases once per day after validations then.
The automatic rebase does make it harder to refer to existing commits by id (for "fixes" information, squashing, etc) because the commit ids are constantly changing, but we also don't want to fall too far behind net-next. Seems to be going ok so far, we could talk about rebase frequency at the meeting this week. I added it to the agenda.
--
Mat Martineau
Intel