MPTCP KTLS support
Subsystems (4)
Geliang Tang
reviewerv3 cover MPTCP KTLS support
From: Geliang Tang <[email protected]>
v3:
- mptcp_read_sock() and mptcp_poll() are not exported, as mptcp_sockopt test does not use read_sock/poll interfaces. They will be exported when new tests are added in the future.
- call mptcp_inq_hint in tls_device_rx_resync_new_rec(), tls_device_core_ctrl_rx_resync() and tls_read_flush_backlog() too.
- update selftests.
v2:
- fix disconnect.
- update selftests.
This series adds KTLS support for MPTCP. Since the ULP of msk is not being used, ULP KTLS can be directly configured onto msk without affecting its communication.
Depends on: implement mptcp read_sock, v13
Based-on: <[email protected]>
Geliang Tang (8):
selftests: mptcp: sockopt: add protocol arguments
selftests: mptcp: sockopt: enhance compatibility with TCP tests
selftests: mptcp: sockopt: implement TCP TLS tests
tls: add MPTCP protocol support
mptcp: update ULP getsockopt
mptcp: enable TLS setsockopt
selftests: mptcp: connect: update sock_test_tcpulp
selftests: mptcp: sockopt: cover MPTCP KTLS test cases
include/net/mptcp.h | 33 +++++ net/mptcp/protocol.c | 62 +++++++-- net/mptcp/sockopt.c | 30 ++++- net/tls/tls_device.c | 8 +- net/tls/tls_main.c | 6 +- net/tls/tls_strp.c | 16 ++- net/tls/tls_sw.c | 4 +- tools/testing/selftests/net/mptcp/config | 1 + .../selftests/net/mptcp/mptcp_connect.c | 36 +++-- .../selftests/net/mptcp/mptcp_sockopt.c | 125 ++++++++++++++++-- .../selftests/net/mptcp/mptcp_sockopt.sh | 36 +++++ 11 files changed, 315 insertions(+), 42 deletions(-)
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 1/8 selftests: mptcp: sockopt: add protocol arguments
From: Geliang Tang <[email protected]>
Add -t and -r options to specify tx/rx protocols (TCP/MPTCP). This increases testing flexibility by allowing explicit protocol selection for both transmission and reception paths.
These codes are from mptcp_inq.c.
--- .../selftests/net/mptcp/mptcp_sockopt.c | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_sockopt.c +24 -5
@@ -27,6 +27,8 @@#include <linux/tcp.h> static int pf =AF_INET ; +static int proto_tx =IPPROTO_MPTCP ; +static int proto_rx =IPPROTO_MPTCP ;#ifndef IPPROTO_MPTCP #define IPPROTO_MPTCP 262
@@ -135,7 +137,7 @@ static void die_perror(const char *msg)static void die_usage (int r) { -fprintf (stderr,"Usage: mptcp_sockopt [-6]\n" ); +fprintf (stderr,"Usage: mptcp_sockopt [-6] [-t tcp|mptcp] [-r tcp|mptcp]\n" );exit (r); }
@@ -201,7 +203,7 @@ static int sock_listen_mptcp(const char * const listenaddr, hints.ai_family = pf;for (a = addr; a; a = a->ai_next) { - sock =socket (a->ai_family, a->ai_socktype,IPPROTO_MPTCP ); + sock =socket (a->ai_family, a->ai_socktype, proto_rx);if (sock <0 )continue ;
@@ -259,11 +261,22 @@ static int sock_connect_mptcp(const char * const remoteaddr,return sock; } +static int protostr_to_num (const char *s) +{ +if (strcasecmp (s,"tcp" ) ==0 ) +return IPPROTO_TCP ; +if (strcasecmp (s,"mptcp" ) ==0 ) +return IPPROTO_MPTCP ; + +die_usage (1 ); +return 0 ; +} +static void parse_opts (int argc,char **argv) {int c; -while ((c =getopt (argc, argv,"h6" )) !=-1 ) { +while ((c =getopt (argc, argv,"h6t:r:" )) !=-1 ) {switch (c) {case 'h' :die_usage (0 );
@@ -271,6 +284,12 @@ static void parse_opts(int argc, char **argv)case '6' : pf =AF_INET6 ;break ; +case 't' : + proto_tx =protostr_to_num (optarg); +break ; +case 'r' : + proto_rx =protostr_to_num (optarg); +break ;default :die_usage (1 );break ;
@@ -776,10 +795,10 @@ static int client(int pipefd)switch (pf) {case AF_INET : - fd =sock_connect_mptcp ("127.0.0.1" ,"15432" ,IPPROTO_MPTCP ); + fd =sock_connect_mptcp ("127.0.0.1" ,"15432" , proto_tx);break ;case AF_INET6 : - fd =sock_connect_mptcp ("::1" ,"15432" ,IPPROTO_MPTCP ); + fd =sock_connect_mptcp ("::1" ,"15432" , proto_tx);break ;default :xerror ("Unknown pf %d\n" , pf);
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 2/8 selftests: mptcp: sockopt: enhance compatibility with TCP tests
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Enhance compatibility with TCP tests in mptcp_sockopt.c, skip mptcp getsockopt checks during tcp tests since MPTCP socket options are not available for them.
--- .../selftests/net/mptcp/mptcp_sockopt.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_sockopt.c +17 -8
@@ -383,8 +383,11 @@ static void do_getsockopt_mptcp_info(struct so_state *s, int fd, size_t w) olen =sizeof (i); ret =getsockopt (fd,SOL_MPTCP ,MPTCP_INFO , &i, &olen); -if (ret <0 ) +if (ret <0 ) { +if (errno ==EOPNOTSUPP || errno ==ENOPROTOOPT ) +return ;die_perror ("getsockopt MPTCP_INFO" ); + } s->pkt_stats_avail = olen >=sizeof (i);
@@ -414,8 +417,11 @@ static void do_getsockopt_tcp_info(struct so_state *s, int fd, size_t r, size_t olen =sizeof (ti); ret =getsockopt (fd,SOL_MPTCP ,MPTCP_TCPINFO , &ti, &olen); -if (ret <0 ) +if (ret <0 ) { +if (errno ==EOPNOTSUPP || errno ==ENOPROTOOPT ) +return ;xerror ("getsockopt MPTCP_TCPINFO (tries %d, %m)" ); + }assert (olen <=sizeof (ti));assert (ti.d.size_kernel >0 );
@@ -469,8 +475,11 @@ static void do_getsockopt_subflow_addrs(struct so_state *s, int fd) olen =sizeof (addrs); ret =getsockopt (fd,SOL_MPTCP ,MPTCP_SUBFLOW_ADDRS , &addrs, &olen); -if (ret <0 ) +if (ret <0 ) { +if (errno ==EOPNOTSUPP || errno ==ENOPROTOOPT ) +return ;die_perror ("getsockopt MPTCP_SUBFLOW_ADDRS" ); + }assert (olen <=sizeof (addrs));assert (addrs.d.size_kernel >0 );
@@ -541,10 +550,8 @@ static void do_getsockopt_mptcp_full_info(struct so_state *s, int fd) ret =getsockopt (fd,SOL_MPTCP ,MPTCP_FULL_INFO , &mfi, &olen);if (ret <0 ) { -if (errno ==EOPNOTSUPP ) { -perror ("MPTCP_FULL_INFO test skipped" ); +if (errno ==EOPNOTSUPP || errno ==ENOPROTOOPT )return ; - }xerror ("getsockopt MPTCP_FULL_INFO" ); }
@@ -650,7 +657,8 @@ static void connect_one_server(int fd, int pipefd)if (eof) total +=1 ;/* sequence advances due to FIN */ -assert (s.mptcpi_rcv_delta == (uint64_t )total); +if (s.mptcpi_rcv_delta) +assert (s.mptcpi_rcv_delta == (uint64_t )total);close (fd); }
@@ -685,7 +693,8 @@ static void process_one_client(int fd, int pipefd)xerror ("expected EOF, got %lu" , ret3);do_getsockopts (&s, fd, ret, ret2); -if (s.mptcpi_rcv_delta != (uint64_t )ret +1 ) +if (s.mptcpi_rcv_delta && + s.mptcpi_rcv_delta != (uint64_t )ret +1 )xerror ("mptcpi_rcv_delta %" PRIu64", expect %" PRIu64", diff %" PRId64, s.mptcpi_rcv_delta, ret +1 , s.mptcpi_rcv_delta - (ret +1 ));
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 3/8 selftests: mptcp: sockopt: implement TCP TLS tests
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch adds Kernel TLS (KTLS) testing infrastructure to MPTCP sockopt selftest, introducing a new '-c' option to enable TLS tests. It includes a helper for configuring TLS socket options and implements TCP-specific KTLS test cases for both IPv4 and IPv6, along with the necessary header includes and config updates.
TLS_OVERHEAD_SIZE macro is defined to account for the overhead in sent and received data length.
--- tools/testing/selftests/net/mptcp/config | 1 + .../selftests/net/mptcp/mptcp_sockopt.c | 75 ++++++++++++++++++- .../selftests/net/mptcp/mptcp_sockopt.sh | 36 +++++++++ 3 files changed, 110 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/config +1 -0
@@ -34,3 +34,4 @@ CONFIG_NFT_SOCKET=m CONFIG_NFT_TPROXY=m CONFIG_SYN_COOKIES=y CONFIG_VETH=y +CONFIG_TLS=y
tools/testing/selftests/net/mptcp/mptcp_sockopt.c +73 -2
139 lines not on this page · raw message
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +36 -0
@@ -351,6 +351,41 @@ do_tcpinq_tests() return $? } +do_tls_test() +{ + print_title "KTLS $*" | head -c 53 + ip netns exec "$ns_sbox" ./mptcp_sockopt "$@" + local lret=$? + if [ $lret -ne 0 ];then + ret=$lret + mptcp_lib_pr_fail + mptcp_lib_result_fail "KTLS: $*" + return $lret + fi + + mptcp_lib_pr_ok + mptcp_lib_result_pass "KTLS: $*" + return $lret +} + +do_tls_tests() +{ + local lret=0 + + mptcp_lib_print_info "sockopt KTLS" + + local args + for args in "-c -t tcp -r tcp" "-6 -c -t tcp -r tcp"; do + do_tls_test $args + lret=$? + if [ $lret -ne 0 ] ; then + return $lret + fi + done + + return $lret +} + sin=$(mktemp) sout=$(mktemp) cin=$(mktemp)
@@ -366,6 +401,7 @@ run_tests $ns1 $ns2 dead:beef:1::1 do_mptcp_sockopt_tests do_tcpinq_tests +do_tls_tests mptcp_lib_result_print_all_tap exit $ret
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 4/8 tls: add MPTCP protocol support
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
To extend MPTCP support based on TCP TLS, corresponding MPTCP-specific helpers have been implemented, including:
- mptcp_sendmsg_locked() for TLS record transmission
- mptcp_inq_hint() and mptcp_recv_skb() for receive side handling
- mptcp_read_done() for data reading
- mptcp_disconnect() for connection teardown.
TLS implementation switches between the respective TCP and MPTCP helpers based on the detected protocol.
--- include/net/mptcp.h | 33 +++++++++++++++++++++++ net/mptcp/protocol.c | 62 +++++++++++++++++++++++++++++++++++++------- net/tls/tls_device.c | 8 ++++-- net/tls/tls_main.c | 6 ++++- net/tls/tls_strp.c | 16 +++++++++--- net/tls/tls_sw.c | 4 ++- 6 files changed, 113 insertions(+), 16 deletions(-)
include/net/mptcp.h +33 -0
@@ -237,6 +237,16 @@ static inline __be32 mptcp_reset_option(const struct sk_buff *skb) }void mptcp_active_detect_blackhole (struct sock *sk,bool expired); + +int mptcp_sendmsg_locked (struct sock *sk,struct msghdr *msg,size_t len); + +unsigned int mptcp_inq_hint (const struct sock *sk); + +struct sk_buff *mptcp_recv_skb (struct sock *sk,u32 *off); + +void mptcp_read_done (struct sock *sk,size_t len); + +int mptcp_disconnect (struct sock *sk,int flags);#else static inline void mptcp_init (void )
@@ -323,6 +333,29 @@ static inline struct request_sock *mptcp_subflow_reqsk_alloc(const struct requesstatic inline __be32 mptcp_reset_option (const struct sk_buff *skb) {return htonl (0u ); }static inline void mptcp_active_detect_blackhole (struct sock *sk,bool expired) { } + +static inline int mptcp_sendmsg_locked (struct sock *sk,struct msghdr *msg, +size_t len) +{ +return 0 ; +} + +static inline unsigned int mptcp_inq_hint (const struct sock *sk) +{ +return 0 ; +} + +static inline struct sk_buff *mptcp_recv_skb (struct sock *sk,u32 *off) +{ +return NULL ; +} + +static inline void mptcp_read_done (struct sock *sk,size_t len) { } + +static inline int mptcp_disconnect (struct sock *sk,int flags) +{ +return 0 ; +}#endif /* CONFIG_MPTCP */ #if IS_ENABLED (CONFIG_MPTCP_IPV6 )
net/mptcp/protocol.c +53 -9
116 lines not on this page · raw message
net/tls/tls_device.c +6 -2
@@ -805,7 +805,9 @@ void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq)/* head of next rec is already in, note that the sock_inq will * include the currently parsed message when called from parser */ - sock_data =tcp_inq (sk); + sock_data = sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_inq_hint (sk) : +tcp_inq (sk);if (sock_data > rcd_len) {trace_tls_device_rx_resync_nh_delay (sk, sock_data, rcd_len);
@@ -864,7 +866,9 @@ static void tls_device_core_ctrl_rx_resync(struct tls_context *tls_ctx, rxm =strp_msg (skb);/* head of next rec is already in, parser will sync for us */ -if (tcp_inq (sk) > rxm->full_len) { +if ((sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_inq_hint (sk) : +tcp_inq (sk)) > rxm->full_len) {trace_tls_device_rx_resync_nh_schedule (sk); ctx->resync_nh_do_now =1 ; }else {
net/tls/tls_main.c +5 -1
@@ -194,7 +194,9 @@ int tls_push_sg(struct sock *sk,bvec_set_page (&bvec, p, size, offset);iov_iter_bvec (&msg.msg_iter,ITER_SOURCE , &bvec,1 , size); - ret =tcp_sendmsg_locked (sk, &msg, size); + ret = sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_sendmsg_locked (sk, &msg, size) : +tcp_sendmsg_locked (sk, &msg, size);if (ret != size) {if (ret >0 ) {
@@ -907,6 +909,8 @@ static int tls_setsockopt(struct sock *sk, int level, int optname,static int tls_disconnect (struct sock *sk,int flags) { +if (sk->sk_protocol ==IPPROTO_MPTCP ) +return mptcp_disconnect (sk, flags);return -EOPNOTSUPP ; }
net/tls/tls_strp.c +13 -3
@@ -132,6 +132,8 @@ int tls_strp_msg_cow(struct tls_sw_context_rx *ctx)tls_strp_anchor_free (strp); strp->anchor = skb; + strp->sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_read_done (strp->sk, strp->stm.full_len) :tcp_read_done (strp->sk, strp->stm.full_len); strp->copy_mode =1 ;
@@ -464,7 +466,9 @@ static void tls_strp_load_anchor_with_queue(struct tls_strparser *strp, int len)struct sk_buff *first;u32 offset; - first =tcp_recv_skb (strp->sk, tp->copied_seq, &offset); + first = strp->sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_recv_skb (strp->sk, &offset) : +tcp_recv_skb (strp->sk, tp->copied_seq, &offset);if (WARN_ON_ONCE (!first))return ;
@@ -490,7 +494,9 @@ bool tls_strp_msg_load(struct tls_strparser *strp, bool force_refresh)DEBUG_NET_WARN_ON_ONCE (!strp->stm.full_len);if (!strp->copy_mode && force_refresh) { -if (unlikely (tcp_inq (strp->sk) < strp->stm.full_len)) { +if (unlikely ((strp->sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_inq_hint (strp->sk) : +tcp_inq (strp->sk)) < strp->stm.full_len)) {WRITE_ONCE (strp->msg_ready,0 );memset (&strp->stm,0 ,sizeof (strp->stm));return false;
@@ -513,7 +519,9 @@ static int tls_strp_read_sock(struct tls_strparser *strp) {int sz, inq; - inq =tcp_inq (strp->sk); + inq = strp->sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_inq_hint (strp->sk) : +tcp_inq (strp->sk);if (inq <1 )return 0 ;
@@ -586,6 +594,8 @@ void tls_strp_msg_done(struct tls_strparser *strp)WARN_ON (!strp->stm.full_len);if (likely (!strp->copy_mode)) + strp->sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_read_done (strp->sk, strp->stm.full_len) :tcp_read_done (strp->sk, strp->stm.full_len);else tls_strp_flush_anchor_copy (strp);
net/tls/tls_sw.c +3 -1
@@ -1958,7 +1958,9 @@ tls_read_flush_backlog(struct sock *sk, struct tls_prot_info *prot,return false; max_rec = prot->overhead_size - prot->tail_size +TLS_MAX_PAYLOAD_SIZE ; -if (done - *flushed_at <SZ_128K &&tcp_inq (sk) > max_rec) +if (done - *flushed_at <SZ_128K && (sk->sk_protocol ==IPPROTO_MPTCP ? +mptcp_inq_hint (sk) : +tcp_inq (sk)) > max_rec)return false; *flushed_at = done;
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 5/8 mptcp: update ULP getsockopt
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
TCP_ULP was obtained by calling mptcp_getsockopt_first_sf_only() to get the ULP of the first subflow. Now that the mechanism has changed, a new helper needs to be implemented to get the ULP of the msk.
--- net/mptcp/sockopt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/mptcp/sockopt.c +12 -0
@@ -1393,6 +1393,17 @@ static int mptcp_put_int_option(struct mptcp_sock *msk, char __user *optval,return 0 ; } +static int mptcp_getsockopt_msk (struct sock *sk,int level,int optname, +char __user *optval,int __user *optlen) +{ +int ret; + +lock_sock (sk); + ret =tcp_getsockopt (sk, level, optname, optval, optlen); +release_sock (sk); +return ret; +} +static int mptcp_getsockopt_sol_tcp (struct mptcp_sock *msk,int optname,char __user *optval,int __user *optlen) {
@@ -1400,6 +1411,7 @@ static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname,switch (optname) {case TCP_ULP : +return mptcp_getsockopt_msk (sk,SOL_TCP , optname, optval, optlen);case TCP_CONGESTION :case TCP_INFO :case TCP_CC_INFO :
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 6/8 mptcp: enable TLS setsockopt
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch adds MPTCP TLS setsockopt support. It allows setting the TCP_ULP option to 'tls' exclusively, and enables configuration of the TLS_TX and TLS_RX options at the SOL_TLS level.
This option cannot be set when the socket is in CLOSE or LISTEN state.
--- net/mptcp/sockopt.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
net/mptcp/sockopt.c +17 -1
@@ -12,6 +12,7 @@#include <net/protocol.h> #include <net/tcp.h> #include <net/mptcp.h> +#include <net/tls.h> #include "protocol.h" #define MIN_INFO_OPTLEN_SIZE 16
@@ -567,6 +568,7 @@ static bool mptcp_supported_sockopt(int level, int optname)case TCP_FASTOPEN_CONNECT :case TCP_FASTOPEN_KEY :case TCP_FASTOPEN_NO_COOKIE : +case TCP_ULP :return true; }
@@ -576,6 +578,13 @@ static bool mptcp_supported_sockopt(int level, int optname)* TCP_REPAIR_WINDOW are not supported, better avoid this mess */ } +if (level ==SOL_TLS ) { +switch (optname) { +case TLS_TX : +case TLS_RX : +return true; + } + }return false; }
@@ -819,11 +828,18 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, sockptr_t optval, unsigned int optlen) {struct sock *sk = (void *)msk; +char ulp[4 ] ="" ;int ret, val;switch (optname) {case TCP_ULP : -return -EOPNOTSUPP ; +if (copy_from_user (ulp, optval.user,4 )) +return -EFAULT ; +if (strcmp (ulp,"tls\0" )) +return -EOPNOTSUPP ; +if ((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )) +return -EINVAL ; +return tcp_setsockopt (sk,SOL_TCP , optname, optval, optlen);case TCP_CONGESTION :return mptcp_setsockopt_sol_tcp_congestion (msk, optval, optlen);case TCP_DEFER_ACCEPT :
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 7/8 selftests: mptcp: connect: update sock_test_tcpulp
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Improve sock_test_tcpulp() to properly validate TLS ULP setup on MPTCP sockets. The updated logic verifies that TLS can be correctly configured based on the socket protocol type and state.
fallback() helper has been implemented to verify fallback scenarios, ensuring that MPTCP fallback-to-TCP tests continue to pass.
Initialize 'peer' pointer to NULL in main_loop() to fix the compiler warning 'peer' may be used uninitialized.
--- .../selftests/net/mptcp/mptcp_connect.c | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +24 -12
@@ -266,13 +266,25 @@ static void set_mptfo(int fd, int pf)perror ("TCP_FASTOPEN" ); } +static int fallback (int fd) +{ +int is_mptcp =0 ; +socklen_t optlen; + + optlen =sizeof (is_mptcp); +if (getsockopt (fd,IPPROTO_TCP ,TCP_IS_MPTCP , &is_mptcp, &optlen) ==-1 ) +perror ("TCP_IS_MPTCP" ); + +return !is_mptcp; +} +static int do_ulp_so (int sock,const char *name) {return setsockopt (sock,IPPROTO_TCP ,TCP_ULP , name,strlen (name)); }#define X (m) xerror("%s:%u: %s: failed for proto %d at line %u", __FILE__, __LINE__, (m), proto, line) -static void sock_test_tcpulp (int sock,int proto,unsigned int line) +static void sock_test_tcpulp (int sock,int proto,int expect,unsigned int line) {socklen_t buflen =8 ;char buf[8 ] ="" ;
@@ -282,14 +294,14 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line)X ("getsockopt" );if (buflen >0 ) { -if (strcmp (buf,"mptcp" ) !=0 ) +if (strcmp (buf,fallback (sock) ?"mptcp" :"tls" ) !=0 )xerror ("unexpected ULP '%s' for proto %d at line %u" , buf, proto, line); ret =do_ulp_so (sock,"tls" );if (ret ==0 )X ("setsockopt" ); }else if (proto ==IPPROTO_MPTCP ) { ret =do_ulp_so (sock,"tls" ); -if (ret !=-1 ) +if (ret != expect)X ("setsockopt" ); }
@@ -300,7 +312,7 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line)#undef X } -#define SOCK_TEST_TCPULP (s, p) sock_test_tcpulp((s), (p), __LINE__) +#define SOCK_TEST_TCPULP (s, p, e) sock_test_tcpulp((s), (p), (e), __LINE__)static int sock_listen_mptcp (const char *const listenaddr,const char *const port)
@@ -325,7 +337,7 @@ static int sock_listen_mptcp(const char * const listenaddr,if (sock <0 )continue ; -SOCK_TEST_TCPULP (sock, cfg_sock_proto); +SOCK_TEST_TCPULP (sock, cfg_sock_proto,-1 );if (-1 ==setsockopt (sock,SOL_SOCKET ,SO_REUSEADDR , &one,sizeof (one)))
@@ -352,7 +364,7 @@ static int sock_listen_mptcp(const char * const listenaddr,return sock; } -SOCK_TEST_TCPULP (sock, cfg_sock_proto); +SOCK_TEST_TCPULP (sock, cfg_sock_proto,-1 );if (listen (sock,20 )) {perror ("listen" );
@@ -360,7 +372,7 @@ static int sock_listen_mptcp(const char * const listenaddr,return -1 ; } -SOCK_TEST_TCPULP (sock, cfg_sock_proto); +SOCK_TEST_TCPULP (sock, cfg_sock_proto,-1 );return sock; }
@@ -388,7 +400,7 @@ static int sock_connect_mptcp(const char * const remoteaddr,continue ; } -SOCK_TEST_TCPULP (sock, proto); +SOCK_TEST_TCPULP (sock, proto,-1 );if (cfg_mark)set_mark (sock, cfg_mark);
@@ -425,7 +437,7 @@ static int sock_connect_mptcp(const char * const remoteaddr,freeaddrinfo (addr);if (sock !=-1 ) -SOCK_TEST_TCPULP (sock, proto); +SOCK_TEST_TCPULP (sock, proto,fallback (sock) ?-1 :0 );return sock; }
@@ -1202,7 +1214,7 @@ int main_loop_s(int listensock)xerror ("can't open %s: %d" , cfg_input, errno); } -SOCK_TEST_TCPULP (remotesock,0 ); +SOCK_TEST_TCPULP (remotesock,0 ,0 );memset (&winfo,0 ,sizeof (winfo)); err =copyfd_io (fd, remotesock,1 , true, &winfo);
@@ -1364,7 +1376,7 @@ void xdisconnect(int fd)int main_loop (void ) {int fd =0 , ret, fd_in =0 ; -struct addrinfo *peer; +struct addrinfo *peer =NULL ;struct wstate winfo;if (cfg_input && cfg_sockopt_types.mptfo) {
@@ -1381,7 +1393,7 @@ int main_loop(void) again:check_getpeername_connect (fd); -SOCK_TEST_TCPULP (fd, cfg_sock_proto); +SOCK_TEST_TCPULP (fd, cfg_sock_proto,-1 );if (cfg_rcvbuf)set_rcvbuf (fd, cfg_rcvbuf);
Signature · 1 line
2.51.0
Geliang Tang
reviewerRFC v3 8/8 selftests: mptcp: sockopt: cover MPTCP KTLS test cases
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Now that MPTCP KTLS support is implemented, extend the existing TCP KTLS test cases to cover MPTCP for both IPv4 and IPv6.
--- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +1 -1
@@ -375,7 +375,7 @@ do_tls_tests() mptcp_lib_print_info "sockopt KTLS" local args - for args in "-c -t tcp -r tcp" "-6 -c -t tcp -r tcp"; do + for args in "-c -t tcp -r tcp" "-6 -c -t tcp -r tcp" "-c" "-6 -c"; do do_tls_test $args lret=$? if [ $lret -ne 0 ] ; then
Signature · 1 line
2.51.0
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Unstable: 1 failed test(s): packetdrill_dss 🔴
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Unstable: 1 failed test(s): packetdrill_dss 🔴
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/19593304037
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/943bd20791d6
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1026573
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)