From: Guangguan Wang Date: Wed, 11 Dec 2024 02:30:55 +0000 (+0800) Subject: net/smc: support ipv4 mapped ipv6 addr client for smc-r v2 X-Git-Tag: v6.14-rc1~162^2~230^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c12b2704a678b8a116eeb03f5b91895b90b4dd6f;p=thirdparty%2Fkernel%2Flinux.git net/smc: support ipv4 mapped ipv6 addr client for smc-r v2 AF_INET6 is not supported for smc-r v2 client before, even if the ipv6 addr is ipv4 mapped. Thus, when using AF_INET6, smc-r connection will fallback to tcp, especially for java applications running smc-r. This patch support ipv4 mapped ipv6 addr client for smc-r v2. Clients using real global ipv6 addr is still not supported yet. Signed-off-by: Guangguan Wang Reviewed-by: Wen Gu Reviewed-by: Dust Li Reviewed-by: D. Wythe Reviewed-by: Wenjia Zhang Reviewed-by: Halil Pasic Signed-off-by: Paolo Abeni --- diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 9e6c69d18581c..19ebff1c2579f 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -1117,7 +1117,10 @@ static int smc_find_proposal_devices(struct smc_sock *smc, ini->check_smcrv2 = true; ini->smcrv2.saddr = smc->clcsock->sk->sk_rcv_saddr; if (!(ini->smcr_version & SMC_V2) || - smc->clcsock->sk->sk_family != AF_INET || +#if IS_ENABLED(CONFIG_IPV6) + (smc->clcsock->sk->sk_family == AF_INET6 && + !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) || +#endif !smc_clc_ueid_count() || smc_find_rdma_device(smc, ini)) ini->smcr_version &= ~SMC_V2;