]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mptcp: pm: drop inet6_sk after inet_sk
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 21 Feb 2025 15:43:59 +0000 (16:43 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 25 Feb 2025 02:23:43 +0000 (18:23 -0800)
In mptcp_event_add_subflow(), mptcp_event_pm_listener() and
mptcp_nl_find_ssk(), 'issk' has already been got through inet_sk().

No need to use inet6_sk() to get 'ipv6_pinfo' again, just use
issk->pinet6 instead. This patch also drops these 'ipv6_pinfo'
variables.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250221-net-next-mptcp-pm-misc-cleanup-3-v1-6-2b70ab1cee79@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/pm_netlink.c
net/mptcp/pm_userspace.c

index 98fcbf8b1465649961c568c6f8978e91d0a53668..f67b637c1fcf7c2930ced8b5c6b9df156118cbcd 100644 (file)
@@ -2022,9 +2022,7 @@ static int mptcp_event_add_subflow(struct sk_buff *skb, const struct sock *ssk)
                break;
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
        case AF_INET6: {
-               const struct ipv6_pinfo *np = inet6_sk(ssk);
-
-               if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr))
+               if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &issk->pinet6->saddr))
                        return -EMSGSIZE;
                if (nla_put_in6_addr(skb, MPTCP_ATTR_DADDR6, &ssk->sk_v6_daddr))
                        return -EMSGSIZE;
@@ -2251,9 +2249,7 @@ void mptcp_event_pm_listener(const struct sock *ssk,
                break;
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
        case AF_INET6: {
-               const struct ipv6_pinfo *np = inet6_sk(ssk);
-
-               if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr))
+               if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &issk->pinet6->saddr))
                        goto nla_put_failure;
                break;
        }
index a16e2fb45a6c68bc0c3c187122a54765ef0fb259..6bf6a20ef7f3e50750b648032c9e8961d3222890 100644 (file)
@@ -460,9 +460,7 @@ static struct sock *mptcp_nl_find_ssk(struct mptcp_sock *msk,
                        break;
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
                case AF_INET6: {
-                       const struct ipv6_pinfo *pinfo = inet6_sk(ssk);
-
-                       if (!ipv6_addr_equal(&local->addr6, &pinfo->saddr) ||
+                       if (!ipv6_addr_equal(&local->addr6, &issk->pinet6->saddr) ||
                            !ipv6_addr_equal(&remote->addr6, &ssk->sk_v6_daddr))
                                continue;
                        break;