|
13 | 13 | #include <net/tcp.h>
|
14 | 14 | #include <net/mptcp.h>
|
15 | 15 | #include "protocol.h"
|
| 16 | +#include "mib.h" |
16 | 17 |
|
17 | 18 | #define MIN_INFO_OPTLEN_SIZE 16
|
18 | 19 | #define MIN_FULL_INFO_OPTLEN_SIZE 40
|
@@ -567,11 +568,12 @@ static bool mptcp_supported_sockopt(int level, int optname)
|
567 | 568 | case TCP_FASTOPEN_CONNECT:
|
568 | 569 | case TCP_FASTOPEN_KEY:
|
569 | 570 | 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: |
570 | 574 | return true;
|
571 | 575 | }
|
572 | 576 |
|
573 |
| - /* TCP_MD5SIG, TCP_MD5SIG_EXT are not supported, MD5 is not compatible with MPTCP */ |
574 |
| - |
575 | 577 | /* TCP_REPAIR, TCP_REPAIR_QUEUE, TCP_QUEUE_SEQ, TCP_REPAIR_OPTIONS,
|
576 | 578 | * TCP_REPAIR_WINDOW are not supported, better avoid this mess
|
577 | 579 | */
|
@@ -836,6 +838,19 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
|
836 | 838 | case TCP_FASTOPEN_NO_COOKIE:
|
837 | 839 | return mptcp_setsockopt_first_sf_only(msk, SOL_TCP, optname,
|
838 | 840 | optval, optlen);
|
| 841 | +#ifdef CONFIG_TCP_MD5SIG |
| 842 | + case TCP_MD5SIG: |
| 843 | + case TCP_MD5SIG_EXT: |
| 844 | + if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) |
| 845 | + return -EINVAL; |
| 846 | + ret = mptcp_setsockopt_first_sf_only(msk, SOL_TCP, optname, |
| 847 | + optval, optlen); |
| 848 | + if (ret) |
| 849 | + return ret; |
| 850 | + if (!__mptcp_try_fallback(msk, MPTCP_MIB_MD5SIGFALLBACK)) |
| 851 | + return -EINVAL; |
| 852 | + return 0; |
| 853 | +#endif |
839 | 854 | }
|
840 | 855 |
|
841 | 856 | ret = mptcp_get_int_option(msk, optval, optlen, &val);
|
|
0 commit comments