mirror of https://github.com/torvalds/linux.git
ipv6: make ipv6_pinfo.daddr_cache a boolean
ipv6_pinfo.daddr_cache is either NULL or &sk->sk_v6_daddr We do not need 8 bytes, a boolean is enough. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20250916160951.541279-3-edumazet@google.com Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
3fbb2a6f3a
commit
5489f333ef
|
|
@ -219,7 +219,7 @@ struct ipv6_pinfo {
|
||||||
#ifdef CONFIG_IPV6_SUBTREES
|
#ifdef CONFIG_IPV6_SUBTREES
|
||||||
bool saddr_cache;
|
bool saddr_cache;
|
||||||
#endif
|
#endif
|
||||||
const struct in6_addr *daddr_cache;
|
bool daddr_cache;
|
||||||
|
|
||||||
__be32 flow_label;
|
__be32 flow_label;
|
||||||
__u32 frag_size;
|
__u32 frag_size;
|
||||||
|
|
|
||||||
|
|
@ -229,14 +229,14 @@ static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb)
|
||||||
* Store a destination cache entry in a socket
|
* Store a destination cache entry in a socket
|
||||||
*/
|
*/
|
||||||
static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
|
static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
|
||||||
const struct in6_addr *daddr,
|
bool daddr_set,
|
||||||
bool saddr_set)
|
bool saddr_set)
|
||||||
{
|
{
|
||||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||||
|
|
||||||
np->dst_cookie = rt6_get_cookie(dst_rt6_info(dst));
|
np->dst_cookie = rt6_get_cookie(dst_rt6_info(dst));
|
||||||
sk_setup_caps(sk, dst);
|
sk_setup_caps(sk, dst);
|
||||||
np->daddr_cache = daddr;
|
np->daddr_cache = daddr_set;
|
||||||
#ifdef CONFIG_IPV6_SUBTREES
|
#ifdef CONFIG_IPV6_SUBTREES
|
||||||
np->saddr_cache = saddr_set;
|
np->saddr_cache = saddr_set;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -857,7 +857,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
|
||||||
return PTR_ERR(dst);
|
return PTR_ERR(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
ip6_dst_store(sk, dst, NULL, false);
|
ip6_dst_store(sk, dst, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk,
|
||||||
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p);
|
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p);
|
||||||
|
|
||||||
if (!IS_ERR(dst))
|
if (!IS_ERR(dst))
|
||||||
ip6_dst_store(sk, dst, NULL, false);
|
ip6_dst_store(sk, dst, false, false);
|
||||||
}
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1100,7 +1100,8 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
|
||||||
* sockets.
|
* sockets.
|
||||||
* 2. oif also should be the same.
|
* 2. oif also should be the same.
|
||||||
*/
|
*/
|
||||||
if (ip6_rt_check(&rt->rt6i_dst, &fl6->daddr, np->daddr_cache) ||
|
if (ip6_rt_check(&rt->rt6i_dst, &fl6->daddr,
|
||||||
|
np->daddr_cache ? &sk->sk_v6_daddr : NULL) ||
|
||||||
#ifdef CONFIG_IPV6_SUBTREES
|
#ifdef CONFIG_IPV6_SUBTREES
|
||||||
ip6_rt_check(&rt->rt6i_src, &fl6->saddr,
|
ip6_rt_check(&rt->rt6i_src, &fl6->saddr,
|
||||||
np->saddr_cache ? &np->saddr : NULL) ||
|
np->saddr_cache ? &np->saddr : NULL) ||
|
||||||
|
|
|
||||||
|
|
@ -3032,8 +3032,7 @@ void ip6_sk_dst_store_flow(struct sock *sk, struct dst_entry *dst,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ip6_dst_store(sk, dst,
|
ip6_dst_store(sk, dst,
|
||||||
ipv6_addr_equal(&fl6->daddr, &sk->sk_v6_daddr) ?
|
ipv6_addr_equal(&fl6->daddr, &sk->sk_v6_daddr),
|
||||||
&sk->sk_v6_daddr : NULL,
|
|
||||||
#ifdef CONFIG_IPV6_SUBTREES
|
#ifdef CONFIG_IPV6_SUBTREES
|
||||||
ipv6_addr_equal(&fl6->saddr, &np->saddr) ?
|
ipv6_addr_equal(&fl6->saddr, &np->saddr) ?
|
||||||
true :
|
true :
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||||
inet->inet_rcv_saddr = LOOPBACK4_IPV6;
|
inet->inet_rcv_saddr = LOOPBACK4_IPV6;
|
||||||
|
|
||||||
sk->sk_gso_type = SKB_GSO_TCPV6;
|
sk->sk_gso_type = SKB_GSO_TCPV6;
|
||||||
ip6_dst_store(sk, dst, NULL, false);
|
ip6_dst_store(sk, dst, false, false);
|
||||||
|
|
||||||
icsk->icsk_ext_hdr_len = 0;
|
icsk->icsk_ext_hdr_len = 0;
|
||||||
if (opt)
|
if (opt)
|
||||||
|
|
@ -1459,7 +1459,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
|
||||||
|
|
||||||
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
|
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
|
||||||
|
|
||||||
ip6_dst_store(newsk, dst, NULL, false);
|
ip6_dst_store(newsk, dst, false, false);
|
||||||
|
|
||||||
newnp->saddr = ireq->ir_v6_loc_addr;
|
newnp->saddr = ireq->ir_v6_loc_addr;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue