Commit 3fbb2a6f authored by Eric Dumazet's avatar Eric Dumazet Committed by Paolo Abeni
Browse files

ipv6: make ipv6_pinfo.saddr_cache a boolean



ipv6_pinfo.saddr_cache is either NULL or &np->saddr.

We do not need 8 bytes, a boolean is enough.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250916160951.541279-2-edumazet@google.com


Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent b127e355
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -216,10 +216,10 @@ struct inet6_cork {
struct ipv6_pinfo {
	struct in6_addr 	saddr;
	struct in6_pktinfo	sticky_pktinfo;
	const struct in6_addr		*daddr_cache;
#ifdef CONFIG_IPV6_SUBTREES
	const struct in6_addr		*saddr_cache;
	bool			saddr_cache;
#endif
	const struct in6_addr		*daddr_cache;

	__be32			flow_label;
	__u32			frag_size;
+2 −2
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb)
 */
static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
				 const struct in6_addr *daddr,
				 const struct in6_addr *saddr)
				 bool saddr_set)
{
	struct ipv6_pinfo *np = inet6_sk(sk);

@@ -238,7 +238,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
	sk_setup_caps(sk, dst);
	np->daddr_cache = daddr;
#ifdef CONFIG_IPV6_SUBTREES
	np->saddr_cache = saddr;
	np->saddr_cache = saddr_set;
#endif
}

+1 −1
Original line number Diff line number Diff line
@@ -857,7 +857,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
			return PTR_ERR(dst);
		}

		ip6_dst_store(sk, dst, NULL, NULL);
		ip6_dst_store(sk, dst, NULL, false);
	}

	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -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);

		if (!IS_ERR(dst))
			ip6_dst_store(sk, dst, NULL, NULL);
			ip6_dst_store(sk, dst, NULL, false);
	}
	return dst;
}
+2 −1
Original line number Diff line number Diff line
@@ -1102,7 +1102,8 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
	 */
	if (ip6_rt_check(&rt->rt6i_dst, &fl6->daddr, np->daddr_cache) ||
#ifdef CONFIG_IPV6_SUBTREES
	    ip6_rt_check(&rt->rt6i_src, &fl6->saddr, np->saddr_cache) ||
	    ip6_rt_check(&rt->rt6i_src, &fl6->saddr,
			 np->saddr_cache ? &np->saddr : NULL) ||
#endif
	   (fl6->flowi6_oif && fl6->flowi6_oif != dst_dev(dst)->ifindex)) {
		dst_release(dst);
Loading