FAILED: patch "[PATCH] mptcp: sockopt: fix getting freebind & transparent" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x e2f4ac7bab2205d3c4dd9464e6ffd82502177c51
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025041756-ovary-sandfish-4a21@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e2f4ac7bab2205d3c4dd9464e6ffd82502177c51 Mon Sep 17 00:00:00 2001
From: "Matthieu Baerts (NGI0)" <[email protected]>
Date: Fri, 14 Mar 2025 21:11:33 +0100
Subject: [PATCH] mptcp: sockopt: fix getting freebind & transparent
When adding a socket option support in MPTCP, both the get and set parts are supposed to be implemented.
IP(V6)_FREEBIND and IP(V6)_TRANSPARENT support for the setsockopt part has been added a while ago, but it looks like the get part got forgotten. It should have been present as a way to verify a setting has been set as expected, and not to act differently from TCP or any other socket types.
Everything was in place to expose it, just the last step was missing. Only new code is added to cover these specific getsockopt(), that seems safe.
net/mptcp/sockopt.c +12 -0
@@ -1419,6 +1419,12 @@ static int mptcp_getsockopt_v4(struct mptcp_sock *msk, int optname,switch (optname) {case IP_TOS :return mptcp_put_int_option (msk, optval, optlen,READ_ONCE (inet_sk (sk)->tos)); +case IP_FREEBIND : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (FREEBIND , sk)); +case IP_TRANSPARENT : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (TRANSPARENT , sk));case IP_BIND_ADDRESS_NO_PORT :return mptcp_put_int_option (msk, optval, optlen,inet_test_bit (BIND_ADDRESS_NO_PORT , sk));
@@ -1439,6 +1445,12 @@ static int mptcp_getsockopt_v6(struct mptcp_sock *msk, int optname,case IPV6_V6ONLY :return mptcp_put_int_option (msk, optval, optlen, sk->sk_ipv6only); +case IPV6_TRANSPARENT : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (TRANSPARENT , sk)); +case IPV6_FREEBIND : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (FREEBIND , sk)); }return -EOPNOTSUPP ;
Matthieu Baerts (NGI0)
maintainercover mptcp: sockopt: fix getting freebind & transparent
Commit e2f4ac7bab22 ("mptcp: sockopt: fix getting freebind & transparent") failed to apply to 6.6-stable tree. The conflict resolution was easy, see the patch 1/2.
Patch 2/2 has been added, because this warning was visible in the selftests without impacting results on fast enough test environments:
# ./mptcp_join.sh: line 3083: mptcp_lib_wait_local_port_listen: command not found
It looks like the commit 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp"), backported in this 6.6-stable tree, was requiring this commit 9369777c2939 ("selftests: mptcp: add mptcp_lib_wait_local_port_listen").
Geliang Tang (1):
selftests: mptcp: add mptcp_lib_wait_local_port_listen
Matthieu Baerts (NGI0) (1):
mptcp: sockopt: fix getting freebind & transparent
net/mptcp/sockopt.c | 12 ++++++++++ tools/testing/selftests/net/mptcp/diag.sh | 23 +++---------------- .../selftests/net/mptcp/mptcp_connect.sh | 19 +-------------- .../testing/selftests/net/mptcp/mptcp_join.sh | 20 +--------------- .../testing/selftests/net/mptcp/mptcp_lib.sh | 18 +++++++++++++++ .../selftests/net/mptcp/simult_flows.sh | 19 +-------------- 6 files changed, 36 insertions(+), 75 deletions(-)
Signature · 1 line
2.48.1
Matthieu Baerts (NGI0)
maintainerPATCH 1/2 mptcp: sockopt: fix getting freebind & transparent
In reply to [email protected]commit e2f4ac7bab2205d3c4dd9464e6ffd82502177c51 upstream.
When adding a socket option support in MPTCP, both the get and set parts are supposed to be implemented.
IP(V6)_FREEBIND and IP(V6)_TRANSPARENT support for the setsockopt part has been added a while ago, but it looks like the get part got forgotten. It should have been present as a way to verify a setting has been set as expected, and not to act differently from TCP or any other socket types.
Everything was in place to expose it, just the last step was missing. Only new code is added to cover these specific getsockopt(), that seems safe.
[ Conflict in sockopt.c due to commit e08d0b3d1723 ("inet: implement
lockless IP_TOS") not being in this version. The conflict is in the context and the modification can still be applied in mptcp_getsockopt_v4() after the IP_TOS case. ]
--- net/mptcp/sockopt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/mptcp/sockopt.c +12 -0
@@ -1388,6 +1388,12 @@ static int mptcp_getsockopt_v4(struct mptcp_sock *msk, int optname,switch (optname) {case IP_TOS :return mptcp_put_int_option (msk, optval, optlen,inet_sk (sk)->tos); +case IP_FREEBIND : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (FREEBIND , sk)); +case IP_TRANSPARENT : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (TRANSPARENT , sk)); }return -EOPNOTSUPP ;
@@ -1402,6 +1408,12 @@ static int mptcp_getsockopt_v6(struct mptcp_sock *msk, int optname,case IPV6_V6ONLY :return mptcp_put_int_option (msk, optval, optlen, sk->sk_ipv6only); +case IPV6_TRANSPARENT : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (TRANSPARENT , sk)); +case IPV6_FREEBIND : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (FREEBIND , sk)); }return -EOPNOTSUPP ;
Signature · 1 line
2.48.1
Sasha Levin
maintainerRe: [PATCH 6.6.y 1/2] mptcp: sockopt: fix getting freebind & transparent
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: e2f4ac7bab2205d3c4dd9464e6ffd82502177c51
Status in newer kernel trees:
6.14.y | Not found 6.13.y | Not found 6.12.y | Not found
Note: The patch differs from the upstream commit:
---
1: e2f4ac7bab220 < -: ------------- mptcp: sockopt: fix getting freebind & transparent -: ------------- > 1: 814637ca257f4 Linux 6.6.87
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |
Matthieu Baerts (NGI0)
maintainerPATCH 2/2 selftests: mptcp: add mptcp_lib_wait_local_port_listen
In reply to [email protected]From: Geliang Tang <[email protected]>
commit 9369777c29395730cec967e7d0f48aed872b7110 upstream.
To avoid duplicated code in different MPTCP selftests, we can add and use helpers defined in mptcp_lib.sh.
wait_local_port_listen() helper is defined in diag.sh, mptcp_connect.sh, mptcp_join.sh and simult_flows.sh, export it into mptcp_lib.sh and rename it with mptcp_lib_ prefix. Use this new helper in all these scripts.
Note: We only have IPv4 connections in this helper, not looking at IPv6 (tcp6) but that's OK because we only have IPv4 connections here in diag.sh.
Stable-dep-of: 5afca7e996c4 ("selftests: mptcp: join: test for prohibited MPC to port-based endp") [ Conflict in diag.sh, because commit 1f24ba67ba49 ("selftests: mptcp:
diag: check CURRESTAB counters") that is more recent that the one
here, has been backported in this kernel version before, introducing chk_msk_cestab() helper in the same context. wait_local_port_listen()
was still the same as in the original, and can then be simply removed
from diag.sh. ]
--- tools/testing/selftests/net/mptcp/diag.sh | 23 +++---------------- .../selftests/net/mptcp/mptcp_connect.sh | 19 +-------------- .../testing/selftests/net/mptcp/mptcp_join.sh | 20 +--------------- .../testing/selftests/net/mptcp/mptcp_lib.sh | 18 +++++++++++++++ .../selftests/net/mptcp/simult_flows.sh | 19 +-------------- 5 files changed, 24 insertions(+), 75 deletions(-)
tools/testing/selftests/net/mptcp/diag.sh +3 -20
@@ -186,23 +186,6 @@ chk_msk_inuse() __chk_nr get_msk_inuse $expected "${msg}" 0 } -# $1: ns, $2: port -wait_local_port_listen() -{ - local listener_ns="${1}" - local port="${2}" - - local port_hex i - - port_hex="$(printf "%04X" "${port}")" - for i in $(seq 10); do - ip netns exec "${listener_ns}" cat /proc/net/tcp | \ - awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" && - break - sleep 0.1 - done -} - # $1: cestab nr chk_msk_cestab() {
@@ -240,7 +223,7 @@ echo "a" | \ ip netns exec $ns \ ./mptcp_connect -p 10000 -l -t ${timeout_poll} -w 20 \ 0.0.0.0 >/dev/null & -wait_local_port_listen $ns 10000 +mptcp_lib_wait_local_port_listen $ns 10000 chk_msk_nr 0 "no msk on netns creation" chk_msk_listen 10000
@@ -265,7 +248,7 @@ echo "a" | \ ip netns exec $ns \ ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} -w 20 \ 0.0.0.0 >/dev/null & -wait_local_port_listen $ns 10001 +mptcp_lib_wait_local_port_listen $ns 10001 echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \
@@ -288,7 +271,7 @@ for I in `seq 1 $NR_CLIENTS`; do ./mptcp_connect -p $((I+10001)) -l -w 20 \ -t ${timeout_poll} 0.0.0.0 >/dev/null & done -wait_local_port_listen $ns $((NR_CLIENTS + 10001)) +mptcp_lib_wait_local_port_listen $ns $((NR_CLIENTS + 10001)) for I in `seq 1 $NR_CLIENTS`; do echo "b" | \
tools/testing/selftests/net/mptcp/mptcp_connect.sh +1 -18
@@ -342,23 +342,6 @@ do_ping() return 0 } -# $1: ns, $2: port -wait_local_port_listen() -{ - local listener_ns="${1}" - local port="${2}" - - local port_hex i - - port_hex="$(printf "%04X" "${port}")" - for i in $(seq 10); do - ip netns exec "${listener_ns}" cat /proc/net/tcp* | \ - awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" && - break - sleep 0.1 - done -} - do_transfer() { local listener_ns="$1"
@@ -448,7 +431,7 @@ do_transfer() $extra_args $local_addr < "$sin" > "$sout" & local spid=$! - wait_local_port_listen "${listener_ns}" "${port}" + mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}" local start start=$(date +%s%3N)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -19
@@ -598,24 +598,6 @@ link_failure() done } -# $1: ns, $2: port -wait_local_port_listen() -{ - local listener_ns="${1}" - local port="${2}" - - local port_hex - port_hex="$(printf "%04X" "${port}")" - - local i - for i in $(seq 10); do - ip netns exec "${listener_ns}" cat /proc/net/tcp* | \ - awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" && - break - sleep 0.1 - done -} - rm_addr_count() { mptcp_lib_get_counter "${1}" "MPTcpExtRmAddr"
@@ -1117,7 +1099,7 @@ do_transfer() fi local spid=$! - wait_local_port_listen "${listener_ns}" "${port}" + mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}" extra_cl_args="$extra_args $extra_cl_args" if [ "$test_linkfail" -eq 0 ];then
tools/testing/selftests/net/mptcp/mptcp_lib.sh +18 -0
@@ -274,3 +274,21 @@ mptcp_lib_events() { ip netns exec "${ns}" ./pm_nl_ctl events >> "${evts}" 2>&1 & pid=$! } + +# $1: ns, $2: port +mptcp_lib_wait_local_port_listen() { + local listener_ns="${1}" + local port="${2}" + + local port_hex + port_hex="$(printf "%04X" "${port}")" + + local _ + for _ in $(seq 10); do + ip netns exec "${listener_ns}" cat /proc/net/tcp* | \ + awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) \ + {rc=0; exit}} END {exit rc}" && + break + sleep 0.1 + done +}
tools/testing/selftests/net/mptcp/simult_flows.sh +1 -18
@@ -123,23 +123,6 @@ setup() grep -q ' kmemleak_init$\| lockdep_init$\| kasan_init$\| prove_locking$' /proc/kallsyms && slack=$((slack+550)) } -# $1: ns, $2: port -wait_local_port_listen() -{ - local listener_ns="${1}" - local port="${2}" - - local port_hex i - - port_hex="$(printf "%04X" "${port}")" - for i in $(seq 10); do - ip netns exec "${listener_ns}" cat /proc/net/tcp* | \ - awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" && - break - sleep 0.1 - done -} - do_transfer() { local cin=$1
@@ -179,7 +162,7 @@ do_transfer() 0.0.0.0 < "$sin" > "$sout" & local spid=$! - wait_local_port_listen "${ns3}" "${port}" + mptcp_lib_wait_local_port_listen "${ns3}" "${port}" timeout ${timeout_test} \ ip netns exec ${ns1} \
Signature · 1 line
2.48.1
Sasha Levin
maintainerRe: [PATCH 6.6.y 2/2] selftests: mptcp: add mptcp_lib_wait_local_port_listen
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 9369777c29395730cec967e7d0f48aed872b7110
WARNING: Author mismatch between patch and upstream commit:
Backport author: "Matthieu Baerts (NGI0)"<[email protected]> Commit author: Geliang Tang<[email protected]>
Status in newer kernel trees:
6.14.y | Present (exact SHA1) 6.13.y | Present (exact SHA1) 6.12.y | Present (exact SHA1)
Note: The patch differs from the upstream commit:
---
1: 9369777c29395 < -: ------------- selftests: mptcp: add mptcp_lib_wait_local_port_listen -: ------------- > 1: 814637ca257f4 Linux 6.6.87
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.12.y | Success | Success |