Skip to content

Commit 1845afe

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: setsockopt support for TCP_MD5SIG
This adds setsockopt support for TCP_MD5SIG and TCP_MD5SIG_EXT options. The implementation: - Allows setting these options (getsockopt remains unsupported) - Applies them only to the first subflow - Forces fallback to TCP (since MD5 isn't compatible with MPTCP) Setting these options triggers fallback to TCP to maintain MD5 compatibility. Note that TCP_MD5SIG and TCP_MD5SIG_EXT are unsupported for TCP too. Closes: multipath-tcp/mptcp_net-next#575 Signed-off-by: Geliang Tang <[email protected]>
1 parent 55f3657 commit 1845afe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

net/mptcp/sockopt.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <net/tcp.h>
1414
#include <net/mptcp.h>
1515
#include "protocol.h"
16+
#include "mib.h"
1617

1718
#define MIN_INFO_OPTLEN_SIZE 16
1819
#define MIN_FULL_INFO_OPTLEN_SIZE 40
@@ -567,11 +568,12 @@ static bool mptcp_supported_sockopt(int level, int optname)
567568
case TCP_FASTOPEN_CONNECT:
568569
case TCP_FASTOPEN_KEY:
569570
case TCP_FASTOPEN_NO_COOKIE:
571+
/* MD5 will force a fallback to TCP: OK to set while not connected */
572+
case TCP_MD5SIG:
573+
case TCP_MD5SIG_EXT:
570574
return true;
571575
}
572576

573-
/* TCP_MD5SIG, TCP_MD5SIG_EXT are not supported, MD5 is not compatible with MPTCP */
574-
575577
/* TCP_REPAIR, TCP_REPAIR_QUEUE, TCP_QUEUE_SEQ, TCP_REPAIR_OPTIONS,
576578
* TCP_REPAIR_WINDOW are not supported, better avoid this mess
577579
*/
@@ -830,6 +832,12 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
830832
/* See tcp.c: TCP_DEFER_ACCEPT does not fail */
831833
mptcp_setsockopt_first_sf_only(msk, SOL_TCP, optname, optval, optlen);
832834
return 0;
835+
#ifdef CONFIG_TCP_MD5SIG
836+
case TCP_MD5SIG:
837+
case TCP_MD5SIG_EXT:
838+
__mptcp_try_fallback(msk, MPTCP_MIB_MD5SIGFALLBACK);
839+
fallthrough;
840+
#endif
833841
case TCP_FASTOPEN:
834842
case TCP_FASTOPEN_CONNECT:
835843
case TCP_FASTOPEN_KEY:

0 commit comments

Comments
 (0)