Skip to content

Commit 31484d5

Browse files
geertudavem330
authored andcommitted
mptcp: Fix undefined mptcp_handle_ipv6_mapped for modular IPV6
If CONFIG_MPTCP=y, CONFIG_MPTCP_IPV6=n, and CONFIG_IPV6=m: ERROR: "mptcp_handle_ipv6_mapped" [net/ipv6/ipv6.ko] undefined! This does not happen if CONFIG_MPTCP_IPV6=y, as CONFIG_MPTCP_IPV6 selects CONFIG_IPV6, and thus forces CONFIG_IPV6 builtin. As exporting a symbol for an empty function would be a bit wasteful, fix this by providing a dummy version of mptcp_handle_ipv6_mapped() for the CONFIG_MPTCP_IPV6=n case. Rename mptcp_handle_ipv6_mapped() to mptcpv6_handle_mapped(), to make it clear this is a pure-IPV6 function, just like mptcpv6_init(). Fixes: cec37a6 ("mptcp: Handle MP_CAPABLE options for outgoing connections") Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 72d62c4 commit 31484d5

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

include/net/mptcp.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,12 @@ static inline bool mptcp_skb_can_collapse(const struct sk_buff *to,
174174

175175
#endif /* CONFIG_MPTCP */
176176

177-
void mptcp_handle_ipv6_mapped(struct sock *sk, bool mapped);
178-
179177
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
180178
int mptcpv6_init(void);
179+
void mptcpv6_handle_mapped(struct sock *sk, bool mapped);
181180
#elif IS_ENABLED(CONFIG_IPV6)
182-
static inline int mptcpv6_init(void)
183-
{
184-
return 0;
185-
}
181+
static inline int mptcpv6_init(void) { return 0; }
182+
static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
186183
#endif
187184

188185
#endif /* __NET_MPTCP_H */

net/ipv6/tcp_ipv6.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
239239

240240
icsk->icsk_af_ops = &ipv6_mapped;
241241
if (sk_is_mptcp(sk))
242-
mptcp_handle_ipv6_mapped(sk, true);
242+
mptcpv6_handle_mapped(sk, true);
243243
sk->sk_backlog_rcv = tcp_v4_do_rcv;
244244
#ifdef CONFIG_TCP_MD5SIG
245245
tp->af_specific = &tcp_sock_ipv6_mapped_specific;
@@ -251,7 +251,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
251251
icsk->icsk_ext_hdr_len = exthdrlen;
252252
icsk->icsk_af_ops = &ipv6_specific;
253253
if (sk_is_mptcp(sk))
254-
mptcp_handle_ipv6_mapped(sk, false);
254+
mptcpv6_handle_mapped(sk, false);
255255
sk->sk_backlog_rcv = tcp_v6_do_rcv;
256256
#ifdef CONFIG_TCP_MD5SIG
257257
tp->af_specific = &tcp_sock_ipv6_specific;
@@ -1208,7 +1208,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
12081208

12091209
inet_csk(newsk)->icsk_af_ops = &ipv6_mapped;
12101210
if (sk_is_mptcp(newsk))
1211-
mptcp_handle_ipv6_mapped(newsk, true);
1211+
mptcpv6_handle_mapped(newsk, true);
12121212
newsk->sk_backlog_rcv = tcp_v4_do_rcv;
12131213
#ifdef CONFIG_TCP_MD5SIG
12141214
newtp->af_specific = &tcp_sock_ipv6_mapped_specific;

net/mptcp/subflow.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,9 @@ subflow_default_af_ops(struct sock *sk)
585585
return &subflow_specific;
586586
}
587587

588-
void mptcp_handle_ipv6_mapped(struct sock *sk, bool mapped)
589-
{
590588
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
589+
void mptcpv6_handle_mapped(struct sock *sk, bool mapped)
590+
{
591591
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
592592
struct inet_connection_sock *icsk = inet_csk(sk);
593593
struct inet_connection_sock_af_ops *target;
@@ -602,8 +602,8 @@ void mptcp_handle_ipv6_mapped(struct sock *sk, bool mapped)
602602

603603
subflow->icsk_af_ops = icsk->icsk_af_ops;
604604
icsk->icsk_af_ops = target;
605-
#endif
606605
}
606+
#endif
607607

608608
int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock)
609609
{

0 commit comments

Comments
 (0)