Skip to content

Commit 8564416

Browse files
matttbegregkh
authored andcommitted
selftests: mptcp: userspace pm: validate deny-join-id0 flag
commit 24733e1 upstream. The previous commit adds the MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 flag. Make sure it is correctly announced by the other peer when it has been received. pm_nl_ctl will now display 'deny_join_id0:1' when monitoring the events, and when this flag was set by the other peer. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 702c2f6 ("mptcp: netlink: allow userspace-driven subflow establishment") Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250912-net-mptcp-pm-uspace-deny_join_id0-v1-3-40171884ade8@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> [ Conflict in userspace_pm.sh, because of a difference in the context, introduced by commit c66fb48 ("selftests: userspace pm: avoid relaunching pm events"), which is not in this version. The same lines can still be added at the same place. Conflicts in userspace_pm.sh, because of different refactoring, like with commit ae1fa39 ("selftests: mptcp: add evts_get_info helper"), and commit e198ad7 ("selftests: mptcp: userspace_pm: uniform results printing"). The modifications have been adapted to the old version, without the new helpers. ] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f84281b commit 8564416

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

tools/testing/selftests/net/mptcp/pm_nl_ctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ static int capture_events(int fd, int event_group)
188188
fprintf(stderr, ",error:%u", *(__u8 *)RTA_DATA(attrs));
189189
else if (attrs->rta_type == MPTCP_ATTR_SERVER_SIDE)
190190
fprintf(stderr, ",server_side:%u", *(__u8 *)RTA_DATA(attrs));
191+
else if (attrs->rta_type == MPTCP_ATTR_FLAGS) {
192+
__u16 flags = *(__u16 *)RTA_DATA(attrs);
193+
194+
/* only print when present, easier */
195+
if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
196+
fprintf(stderr, ",deny_join_id0:1");
197+
}
191198

192199
attrs = RTA_NEXT(attrs, msg_len);
193200
}

tools/testing/selftests/net/mptcp/userspace_pm.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ make_connection()
139139
is_v6="v4"
140140
fi
141141

142+
# set this on the client side only: will not affect the rest
143+
ip netns exec "$ns2" sysctl -q net.mptcp.allow_join_initial_addr_port=0
144+
142145
# Capture netlink events over the two network namespaces running
143146
# the MPTCP client and server
144147
local client_evts
@@ -173,21 +176,28 @@ make_connection()
173176
local client_token
174177
local client_port
175178
local client_serverside
179+
local client_nojoin
176180
local server_token
177181
local server_serverside
182+
local server_nojoin
178183

179184
client_token=$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
180185
client_port=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
181186
client_serverside=$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q'\
182187
"$client_evts")
188+
client_nojoin=$(sed --unbuffered -n 's/.*\(deny_join_id0:\)\([[:digit:]]*\).*$/\2/p;q'\
189+
"$client_evts")
183190
kill_wait $server_evts_pid
184191
server_token=$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts")
185192
server_serverside=$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q'\
186193
"$server_evts")
194+
server_nojoin=$(sed --unbuffered -n 's/.*\(deny_join_id0:\)\([[:digit:]]*\).*$/\2/p;q'\
195+
"$server_evts")
187196
rm -f "$client_evts" "$server_evts" "$file"
188197

189-
if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] &&
190-
[ "$server_serverside" = 1 ]
198+
if [ "${client_token}" != "" ] && [ "${server_token}" != "" ] &&
199+
[ "${client_serverside}" = 0 ] && [ "${server_serverside}" = 1 ] &&
200+
[ "${client_nojoin:-0}" = 0 ] && [ "${server_nojoin:-0}" = 1 ]
191201
then
192202
stdbuf -o0 -e0 printf "Established IP%s MPTCP Connection ns2 => ns1 \t\t[OK]\n" $is_v6
193203
else

0 commit comments

Comments
 (0)