From 8a0fe2bd530f51675a95b73d96288074c22de5b3 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Sat, 27 Jan 2024 21:13:47 +0000 Subject: Declare address parameter in TCP SYN cache const. tcp6_ctlinput() casted a constant sockaddr_sin6 to non-const sockaddr. sa6_src may be &sa6_any which lives in read-only data section. Better pass down the const addresses to syn_cache_lookup(). They are needed for hash lookup and are not modified. OK mvs@ --- sys/netinet6/in6.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/netinet6/in6.h') diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 936ef6c9465..98384bfd352 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.111 2023/11/28 13:23:20 bluhm Exp $ */ +/* $OpenBSD: in6.h,v 1.112 2024/01/27 21:13:46 bluhm Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -459,6 +459,12 @@ sin6tosa(struct sockaddr_in6 *sin6) return ((struct sockaddr *)(sin6)); } +static inline const struct sockaddr * +sin6tosa_const(const struct sockaddr_in6 *sin6) +{ + return ((const struct sockaddr *)(sin6)); +} + static inline struct in6_ifaddr * ifatoia6(struct ifaddr *ifa) { -- cgit v1.2.3