Skip to content

Commit 507533d

Browse files
matttbeintel-lab-lkp
authored andcommitted
selftests: mptcp: connect cleanup TFO setup
To the TFO, only the file descriptor is needed, the family is not. Also, the error can be handled the same way when 'sendto()' or 'connect()' are used. Only the printed error message is different. This avoids a bit of confusions. Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
1 parent 5e25273 commit 507533d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void set_transparent(int fd, int pf)
259259
}
260260
}
261261

262-
static void set_mptfo(int fd, int pf)
262+
static void set_mptfo(int fd)
263263
{
264264
int qlen = 25;
265265

@@ -336,7 +336,7 @@ static int sock_listen_mptcp(const char * const listenaddr,
336336
set_transparent(sock, pf);
337337

338338
if (cfg_sockopt_types.mptfo)
339-
set_mptfo(sock, pf);
339+
set_mptfo(sock);
340340

341341
if (bind(sock, a->ai_addr, a->ai_addrlen) == 0)
342342
break; /* success */
@@ -407,21 +407,18 @@ static int sock_connect_mptcp(const char * const remoteaddr,
407407
*peer = a;
408408
break; /* success */
409409
}
410+
perror("sendto()");
410411
} else {
411412
if (connect(sock, a->ai_addr, a->ai_addrlen) == 0) {
412413
*peer = a;
413414
break; /* success */
414415
}
415-
}
416-
if (cfg_sockopt_types.mptfo) {
417-
perror("sendto()");
418-
close(sock);
419-
sock = -1;
420-
} else {
421416
perror("connect()");
422-
close(sock);
423-
sock = -1;
424417
}
418+
419+
/* error */
420+
close(sock);
421+
sock = -1;
425422
}
426423

427424
freeaddrinfo(addr);

0 commit comments

Comments
 (0)