From 81b9353a8a6864dab8a8d914152683731000d3c4 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:52 +0100 Subject: [PATCH 01/13] tg create t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies base --- .topdeps | 1 - .topmsg | 10 ---------- 2 files changed, 11 deletions(-) delete mode 100644 .topdeps delete mode 100644 .topmsg diff --git a/.topdeps b/.topdeps deleted file mode 100644 index e621e168e991d..0000000000000 --- a/.topdeps +++ /dev/null @@ -1 +0,0 @@ -t/DO-NOT-MERGE-git-markup-fixes-other-trees diff --git a/.topmsg b/.topmsg deleted file mode 100644 index f38e6c62ab26b..0000000000000 --- a/.topmsg +++ /dev/null @@ -1,10 +0,0 @@ -From: Wei Yongjun -Subject: [PATCH] mptcp: netlink: fix some error return code - -Fix to return negative error code -EINVAL from some error handling -case instead of 0, as done elsewhere in those functions. - -Fixes: 9ab4807c84a4 ("mptcp: netlink: Add MPTCP_PM_CMD_ANNOUNCE") -Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establishment") -Signed-off-by: Wei Yongjun -Reviewed-by: Matthieu Baerts From f457490b0881973274755b72df0ae7722403f9b2 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:52 +0100 Subject: [PATCH 02/13] tg create t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies --- .topdeps | 1 + .topmsg | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000000..b22e5f0b6741a --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +t/mptcp-netlink-fix-some-error-return-code diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000000..0eb235bfbac77 --- /dev/null +++ b/.topmsg @@ -0,0 +1,4 @@ +From: Matthieu Baerts +Subject: [PATCH] t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies + +Signed-off-by: Matthieu Baerts From bdd85db62a5f715483483238363c6de193fbe03a Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:53 +0100 Subject: [PATCH 03/13] tg import create t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies --- .topmsg | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.topmsg b/.topmsg index 0eb235bfbac77..87004d1ae3d89 100644 --- a/.topmsg +++ b/.topmsg @@ -1,4 +1,16 @@ From: Matthieu Baerts -Subject: [PATCH] t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies +Subject: [PATCH] mptcp: remove MPTCP 'ifdef' in TCP SYN cookies +To ease the maintenance, it is often recommended to avoid having #ifdef +preprocessor conditions. + +Here the section related to CONFIG_MPTCP was quite short but the next +commit needs to add more code around. It is then cleaner to move +specific MPTCP code to functions located in net/mptcp directory. + +Now that mptcp_subflow_request_sock_ops structure can be static, it can +also be marked as "read only after init". + +Suggested-by: Paolo Abeni Signed-off-by: Matthieu Baerts +Reviewed-by: Mat Martineau From 5819cf24db5fd76ab13a7de44885285b39575f86 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Wed, 30 Nov 2022 10:44:46 +0100 Subject: [PATCH 04/13] mptcp: remove MPTCP 'ifdef' in TCP SYN cookies To ease the maintenance, it is often recommended to avoid having #ifdef preprocessor conditions. Here the section related to CONFIG_MPTCP was quite short but the next commit needs to add more code around. It is then cleaner to move specific MPTCP code to functions located in net/mptcp directory. Now that mptcp_subflow_request_sock_ops structure can be static, it can also be marked as "read only after init". Suggested-by: Paolo Abeni Signed-off-by: Matthieu Baerts Reviewed-by: Mat Martineau --- include/net/mptcp.h | 12 ++++++++++-- net/ipv4/syncookies.c | 7 +++---- net/mptcp/subflow.c | 12 +++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 412479ebf5ad3..3c5c68618fcc5 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -97,8 +97,6 @@ struct mptcp_out_options { }; #ifdef CONFIG_MPTCP -extern struct request_sock_ops mptcp_subflow_request_sock_ops; - void mptcp_init(void); static inline bool sk_is_mptcp(const struct sock *sk) @@ -188,6 +186,9 @@ void mptcp_seq_show(struct seq_file *seq); int mptcp_subflow_init_cookie_req(struct request_sock *req, const struct sock *sk_listener, struct sk_buff *skb); +struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops, + struct sock *sk_listener, + bool attach_listener); __be32 mptcp_get_reset_option(const struct sk_buff *skb); @@ -274,6 +275,13 @@ static inline int mptcp_subflow_init_cookie_req(struct request_sock *req, return 0; /* TCP fallback */ } +static inline struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops, + struct sock *sk_listener, + bool attach_listener) +{ + return NULL; +} + static inline __be32 mptcp_reset_option(const struct sk_buff *skb) { return htonl(0u); } #endif /* CONFIG_MPTCP */ diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 942d2dfa11151..26fb97d1d4d9a 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c @@ -288,12 +288,11 @@ struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops, struct tcp_request_sock *treq; struct request_sock *req; -#ifdef CONFIG_MPTCP if (sk_is_mptcp(sk)) - ops = &mptcp_subflow_request_sock_ops; -#endif + req = mptcp_subflow_reqsk_alloc(ops, sk, false); + else + req = inet_reqsk_alloc(ops, sk, false); - req = inet_reqsk_alloc(ops, sk, false); if (!req) return NULL; diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 2159b5f9988f8..3f670f2d5c5cd 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -529,7 +529,7 @@ static int subflow_v6_rebuild_header(struct sock *sk) } #endif -struct request_sock_ops mptcp_subflow_request_sock_ops; +static struct request_sock_ops mptcp_subflow_request_sock_ops __ro_after_init; static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops __ro_after_init; static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) @@ -582,6 +582,16 @@ static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) } #endif +struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops, + struct sock *sk_listener, + bool attach_listener) +{ + ops = &mptcp_subflow_request_sock_ops; + + return inet_reqsk_alloc(ops, sk_listener, attach_listener); +} +EXPORT_SYMBOL(mptcp_subflow_reqsk_alloc); + /* validate hmac received in third ACK */ static bool subflow_hmac_valid(const struct request_sock *req, const struct mptcp_options_received *mp_opt) From a5094021a0241aead48c51e53e52eca529b05d8e Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:54 +0100 Subject: [PATCH 05/13] tg create t/mptcp-dedicated-request-sock-for-subflow-in-v6 base --- .topdeps | 1 - .topmsg | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 .topdeps delete mode 100644 .topmsg diff --git a/.topdeps b/.topdeps deleted file mode 100644 index b22e5f0b6741a..0000000000000 --- a/.topdeps +++ /dev/null @@ -1 +0,0 @@ -t/mptcp-netlink-fix-some-error-return-code diff --git a/.topmsg b/.topmsg deleted file mode 100644 index 87004d1ae3d89..0000000000000 --- a/.topmsg +++ /dev/null @@ -1,16 +0,0 @@ -From: Matthieu Baerts -Subject: [PATCH] mptcp: remove MPTCP 'ifdef' in TCP SYN cookies - -To ease the maintenance, it is often recommended to avoid having #ifdef -preprocessor conditions. - -Here the section related to CONFIG_MPTCP was quite short but the next -commit needs to add more code around. It is then cleaner to move -specific MPTCP code to functions located in net/mptcp directory. - -Now that mptcp_subflow_request_sock_ops structure can be static, it can -also be marked as "read only after init". - -Suggested-by: Paolo Abeni -Signed-off-by: Matthieu Baerts -Reviewed-by: Mat Martineau From 5b05e77ea1da11c2ced38a08fa80c74fcbfdc6eb Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:54 +0100 Subject: [PATCH 06/13] tg create t/mptcp-dedicated-request-sock-for-subflow-in-v6 --- .topdeps | 1 + .topmsg | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000000..206d6ca44c3b3 --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000000..ef37613dd83dd --- /dev/null +++ b/.topmsg @@ -0,0 +1,4 @@ +From: Matthieu Baerts +Subject: [PATCH] t/mptcp-dedicated-request-sock-for-subflow-in-v6 + +Signed-off-by: Matthieu Baerts From d4f56c602b588f01279f310f8dc51358bcdf8f4d Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:55 +0100 Subject: [PATCH 07/13] tg import create t/mptcp-dedicated-request-sock-for-subflow-in-v6 --- .topmsg | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.topmsg b/.topmsg index ef37613dd83dd..4ba18c8b1abdd 100644 --- a/.topmsg +++ b/.topmsg @@ -1,4 +1,23 @@ From: Matthieu Baerts -Subject: [PATCH] t/mptcp-dedicated-request-sock-for-subflow-in-v6 +Subject: [PATCH] mptcp: dedicated request sock for subflow in v6 +tcp_request_sock_ops structure is specific to IPv4. It should then not +be used with MPTCP subflows on top of IPv6. + +For example, it contains the 'family' field, initialised to AF_INET. +This 'family' field is used by TCP FastOpen code to generate the cookie +but also by TCP Metrics, SELinux and SYN Cookies. Using the wrong family +will not lead to crashes but displaying/using/checking wrong things. + +Note that 'send_reset' callback from request_sock_ops structure is used +in some error paths. It is then also important to use the correct one +for IPv4 or IPv6. + +The slab name can also be different in IPv4 and IPv6, it will be used +when printing some log messages. The slab pointer will anyway be the +same because the object size is the same for both v4 and v6. A +BUILD_BUG_ON() has also been added to make sure this size is the same. + +Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections") Signed-off-by: Matthieu Baerts +Reviewed-by: Mat Martineau From 46b00edc3b54e76a7abd5e16b3466c8cd7f24112 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Wed, 30 Nov 2022 10:44:47 +0100 Subject: [PATCH 08/13] mptcp: dedicated request sock for subflow in v6 tcp_request_sock_ops structure is specific to IPv4. It should then not be used with MPTCP subflows on top of IPv6. For example, it contains the 'family' field, initialised to AF_INET. This 'family' field is used by TCP FastOpen code to generate the cookie but also by TCP Metrics, SELinux and SYN Cookies. Using the wrong family will not lead to crashes but displaying/using/checking wrong things. Note that 'send_reset' callback from request_sock_ops structure is used in some error paths. It is then also important to use the correct one for IPv4 or IPv6. The slab name can also be different in IPv4 and IPv6, it will be used when printing some log messages. The slab pointer will anyway be the same because the object size is the same for both v4 and v6. A BUILD_BUG_ON() has also been added to make sure this size is the same. Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections") Signed-off-by: Matthieu Baerts Reviewed-by: Mat Martineau --- net/mptcp/subflow.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 3f670f2d5c5cd..30524dd7d0ec5 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -529,7 +529,7 @@ static int subflow_v6_rebuild_header(struct sock *sk) } #endif -static struct request_sock_ops mptcp_subflow_request_sock_ops __ro_after_init; +static struct request_sock_ops mptcp_subflow_v4_request_sock_ops __ro_after_init; static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops __ro_after_init; static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) @@ -542,7 +542,7 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) goto drop; - return tcp_conn_request(&mptcp_subflow_request_sock_ops, + return tcp_conn_request(&mptcp_subflow_v4_request_sock_ops, &subflow_request_sock_ipv4_ops, sk, skb); drop: @@ -551,6 +551,7 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) } #if IS_ENABLED(CONFIG_MPTCP_IPV6) +static struct request_sock_ops mptcp_subflow_v6_request_sock_ops __ro_after_init; static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops __ro_after_init; static struct inet_connection_sock_af_ops subflow_v6_specific __ro_after_init; static struct inet_connection_sock_af_ops subflow_v6m_specific __ro_after_init; @@ -573,7 +574,7 @@ static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) return 0; } - return tcp_conn_request(&mptcp_subflow_request_sock_ops, + return tcp_conn_request(&mptcp_subflow_v6_request_sock_ops, &subflow_request_sock_ipv6_ops, sk, skb); drop: @@ -586,7 +587,12 @@ struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *op struct sock *sk_listener, bool attach_listener) { - ops = &mptcp_subflow_request_sock_ops; + if (ops->family == AF_INET) + ops = &mptcp_subflow_v4_request_sock_ops; +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + else if (ops->family == AF_INET6) + ops = &mptcp_subflow_v6_request_sock_ops; +#endif return inet_reqsk_alloc(ops, sk_listener, attach_listener); } @@ -1914,7 +1920,6 @@ static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = { static int subflow_ops_init(struct request_sock_ops *subflow_ops) { subflow_ops->obj_size = sizeof(struct mptcp_subflow_request_sock); - subflow_ops->slab_name = "request_sock_subflow"; subflow_ops->slab = kmem_cache_create(subflow_ops->slab_name, subflow_ops->obj_size, 0, @@ -1931,9 +1936,10 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops) void __init mptcp_subflow_init(void) { - mptcp_subflow_request_sock_ops = tcp_request_sock_ops; - if (subflow_ops_init(&mptcp_subflow_request_sock_ops) != 0) - panic("MPTCP: failed to init subflow request sock ops\n"); + mptcp_subflow_v4_request_sock_ops = tcp_request_sock_ops; + mptcp_subflow_v4_request_sock_ops.slab_name = "request_sock_subflow_v4"; + if (subflow_ops_init(&mptcp_subflow_v4_request_sock_ops) != 0) + panic("MPTCP: failed to init subflow v4 request sock ops\n"); subflow_request_sock_ipv4_ops = tcp_request_sock_ipv4_ops; subflow_request_sock_ipv4_ops.route_req = subflow_v4_route_req; @@ -1948,6 +1954,18 @@ void __init mptcp_subflow_init(void) tcp_prot_override.release_cb = tcp_release_cb_override; #if IS_ENABLED(CONFIG_MPTCP_IPV6) + /* In struct mptcp_subflow_request_sock, we assume the TCP request sock + * structures for v4 and v6 have the same size. It should not changed in + * the future but better to make sure to be warned if it is no longer + * the case. + */ + BUILD_BUG_ON(sizeof(struct tcp_request_sock) != sizeof(struct tcp6_request_sock)); + + mptcp_subflow_v6_request_sock_ops = tcp6_request_sock_ops; + mptcp_subflow_v6_request_sock_ops.slab_name = "request_sock_subflow_v6"; + if (subflow_ops_init(&mptcp_subflow_v6_request_sock_ops) != 0) + panic("MPTCP: failed to init subflow v6 request sock ops\n"); + subflow_request_sock_ipv6_ops = tcp_request_sock_ipv6_ops; subflow_request_sock_ipv6_ops.route_req = subflow_v6_route_req; From 9e6f9830ef09d2181813382979c6ca96a213ce5b Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:56 +0100 Subject: [PATCH 09/13] tg create t/mptcp-use-proper-req-destructor-for-IPv6 base --- .topdeps | 1 - .topmsg | 23 ----------------------- 2 files changed, 24 deletions(-) delete mode 100644 .topdeps delete mode 100644 .topmsg diff --git a/.topdeps b/.topdeps deleted file mode 100644 index 206d6ca44c3b3..0000000000000 --- a/.topdeps +++ /dev/null @@ -1 +0,0 @@ -t/mptcp-remove-MPTCP-ifdef-in-TCP-SYN-cookies diff --git a/.topmsg b/.topmsg deleted file mode 100644 index 4ba18c8b1abdd..0000000000000 --- a/.topmsg +++ /dev/null @@ -1,23 +0,0 @@ -From: Matthieu Baerts -Subject: [PATCH] mptcp: dedicated request sock for subflow in v6 - -tcp_request_sock_ops structure is specific to IPv4. It should then not -be used with MPTCP subflows on top of IPv6. - -For example, it contains the 'family' field, initialised to AF_INET. -This 'family' field is used by TCP FastOpen code to generate the cookie -but also by TCP Metrics, SELinux and SYN Cookies. Using the wrong family -will not lead to crashes but displaying/using/checking wrong things. - -Note that 'send_reset' callback from request_sock_ops structure is used -in some error paths. It is then also important to use the correct one -for IPv4 or IPv6. - -The slab name can also be different in IPv4 and IPv6, it will be used -when printing some log messages. The slab pointer will anyway be the -same because the object size is the same for both v4 and v6. A -BUILD_BUG_ON() has also been added to make sure this size is the same. - -Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections") -Signed-off-by: Matthieu Baerts -Reviewed-by: Mat Martineau From 5ed8d81fe28537391b33f0e7d3a9d9449d19e2ec Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:57 +0100 Subject: [PATCH 10/13] tg create t/mptcp-use-proper-req-destructor-for-IPv6 --- .topdeps | 1 + .topmsg | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000000..eb05eda9c6fa5 --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +t/mptcp-dedicated-request-sock-for-subflow-in-v6 diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000000..f57f564d3bd20 --- /dev/null +++ b/.topmsg @@ -0,0 +1,4 @@ +From: Matthieu Baerts +Subject: [PATCH] t/mptcp-use-proper-req-destructor-for-IPv6 + +Signed-off-by: Matthieu Baerts From ebba28e2f7d8ad76b989a1e2e01fb5bcc9accf27 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:57 +0100 Subject: [PATCH 11/13] tg import create t/mptcp-use-proper-req-destructor-for-IPv6 --- .topmsg | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.topmsg b/.topmsg index f57f564d3bd20..ddccb5fc79748 100644 --- a/.topmsg +++ b/.topmsg @@ -1,4 +1,13 @@ From: Matthieu Baerts -Subject: [PATCH] t/mptcp-use-proper-req-destructor-for-IPv6 +Subject: [PATCH] mptcp: use proper req destructor for IPv6 +Before, only the destructor from TCP request sock in IPv4 was called +even if the subflow was IPv6. + +It is important to use the right destructor to avoid memory leaks with +some advanced IPv6 features, e.g. when the request socks contain +specific IPv6 options. + +Fixes: 79c0949e9a09 ("mptcp: Add key generation and token tree") Signed-off-by: Matthieu Baerts +Reviewed-by: Mat Martineau From 2df171723dbb186c858a70ee13448f96a3bae15d Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Wed, 30 Nov 2022 10:44:48 +0100 Subject: [PATCH 12/13] mptcp: use proper req destructor for IPv6 Before, only the destructor from TCP request sock in IPv4 was called even if the subflow was IPv6. It is important to use the right destructor to avoid memory leaks with some advanced IPv6 features, e.g. when the request socks contain specific IPv6 options. Fixes: 79c0949e9a09 ("mptcp: Add key generation and token tree") Signed-off-by: Matthieu Baerts Reviewed-by: Mat Martineau --- net/mptcp/subflow.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 30524dd7d0ec5..613f515fedf0a 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -45,7 +45,6 @@ static void subflow_req_destructor(struct request_sock *req) sock_put((struct sock *)subflow_req->msk); mptcp_token_destroy_request(req); - tcp_request_sock_ops.destructor(req); } static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, @@ -550,6 +549,12 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) return 0; } +static void subflow_v4_req_destructor(struct request_sock *req) +{ + subflow_req_destructor(req); + tcp_request_sock_ops.destructor(req); +} + #if IS_ENABLED(CONFIG_MPTCP_IPV6) static struct request_sock_ops mptcp_subflow_v6_request_sock_ops __ro_after_init; static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops __ro_after_init; @@ -581,6 +586,12 @@ static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) tcp_listendrop(sk); return 0; /* don't send reset */ } + +static void subflow_v6_req_destructor(struct request_sock *req) +{ + subflow_req_destructor(req); + tcp6_request_sock_ops.destructor(req); +} #endif struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops, @@ -1929,8 +1940,6 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops) if (!subflow_ops->slab) return -ENOMEM; - subflow_ops->destructor = subflow_req_destructor; - return 0; } @@ -1938,6 +1947,8 @@ void __init mptcp_subflow_init(void) { mptcp_subflow_v4_request_sock_ops = tcp_request_sock_ops; mptcp_subflow_v4_request_sock_ops.slab_name = "request_sock_subflow_v4"; + mptcp_subflow_v4_request_sock_ops.destructor = subflow_v4_req_destructor; + if (subflow_ops_init(&mptcp_subflow_v4_request_sock_ops) != 0) panic("MPTCP: failed to init subflow v4 request sock ops\n"); @@ -1963,6 +1974,8 @@ void __init mptcp_subflow_init(void) mptcp_subflow_v6_request_sock_ops = tcp6_request_sock_ops; mptcp_subflow_v6_request_sock_ops.slab_name = "request_sock_subflow_v6"; + mptcp_subflow_v6_request_sock_ops.destructor = subflow_v6_req_destructor; + if (subflow_ops_init(&mptcp_subflow_v6_request_sock_ops) != 0) panic("MPTCP: failed to init subflow v6 request sock ops\n"); From eeae3c10638fe4df7ed86ebac65a0da2ee73853f Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Mon, 5 Dec 2022 11:22:58 +0100 Subject: [PATCH 13/13] tg: switch to t/mptcp-use-proper-req-destructor-for-IPv6 Signed-off-by: Matthieu Baerts --- .topdeps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.topdeps b/.topdeps index b22e5f0b6741a..7dd9b62d8d602 100644 --- a/.topdeps +++ b/.topdeps @@ -1 +1 @@ -t/mptcp-netlink-fix-some-error-return-code +t/mptcp-use-proper-req-destructor-for-IPv6