From: Vitaliy Makkoveev Subject: Unlock IPV6CTL_USE_DEPRECATED case of ip6_sysctl() To: Alexander Bluhm , tech@openbsd.org Date: Thu, 24 Jul 2025 23:35:36 +0300 tcp_input() and in6_ifawithscope() belong to input and output path respectively. Not used in ramdisk. Index: sys/netinet/tcp_input.c =================================================================== RCS file: /cvs/src/sys/netinet/tcp_input.c,v retrieving revision 1.456 diff -u -p -r1.456 tcp_input.c --- sys/netinet/tcp_input.c 8 Jul 2025 00:47:41 -0000 1.456 +++ sys/netinet/tcp_input.c 24 Jul 2025 20:33:13 -0000 @@ -847,7 +847,8 @@ findpcb: * are not exactly the same. I believe 5.5.4 * is the best one, so we follow 5.5.4. */ - if (ip6 && !ip6_use_deprecated) { + if (ip6 && + !atomic_load_int(&ip6_use_deprecated)) { struct in6_ifaddr *ia6; struct ifnet *ifp = if_get(m->m_pkthdr.ph_ifidx); Index: sys/netinet6/in6.c =================================================================== RCS file: /cvs/src/sys/netinet6/in6.c,v retrieving revision 1.271 diff -u -p -r1.271 in6.c --- sys/netinet6/in6.c 8 Jul 2025 00:47:41 -0000 1.271 +++ sys/netinet6/in6.c 24 Jul 2025 20:33:13 -0000 @@ -1427,7 +1427,7 @@ in6_ifawithscope(struct ifnet *oifp, con * Ignore any deprecated addresses if * specified by configuration. */ - if (!ip6_use_deprecated) + if (!atomic_load_int(&ip6_use_deprecated)) continue; /* Index: sys/netinet6/in6_proto.c =================================================================== RCS file: /cvs/src/sys/netinet6/in6_proto.c,v retrieving revision 1.142 diff -u -p -r1.142 in6_proto.c --- sys/netinet6/in6_proto.c 24 Jul 2025 19:49:08 -0000 1.142 +++ sys/netinet6/in6_proto.c 24 Jul 2025 20:33:13 -0000 @@ -361,7 +361,7 @@ int ip6_hdrnestlimit = 10; /* [a] approp int ip6_dad_count = 1; /* [a] DupAddrDetectionTransmits */ int ip6_dad_pending; /* number of currently running DADs */ int ip6_auto_flowlabel = 1; /* [a] */ -int ip6_use_deprecated = 1; /* allow deprecated addr (RFC2462 5.5.4) */ +int ip6_use_deprecated = 1; /* [a] allow deprecated addr (RFC2462 5.5.4) */ int ip6_mcast_pmtu = 0; /* enable pMTU discovery for multicast? */ int ip6_neighborgcthresh = 2048; /* Threshold # of NDP entries for GC */ int ip6_maxdynroutes = 4096; /* Max # of routes created via redirect */ Index: sys/netinet6/ip6_input.c =================================================================== RCS file: /cvs/src/sys/netinet6/ip6_input.c,v retrieving revision 1.286 diff -u -p -r1.286 ip6_input.c --- sys/netinet6/ip6_input.c 24 Jul 2025 19:49:08 -0000 1.286 +++ sys/netinet6/ip6_input.c 24 Jul 2025 20:33:13 -0000 @@ -1453,10 +1453,10 @@ const struct sysctl_bounded_args ipv6ctl { IPV6CTL_DAD_COUNT, &ip6_dad_count, 0, 10 }, { IPV6CTL_AUTO_FLOWLABEL, &ip6_auto_flowlabel, 0, 1 }, { IPV6CTL_DEFMCASTHLIM, &ip6_defmcasthlim, 0, 255 }, + { IPV6CTL_USE_DEPRECATED, &ip6_use_deprecated, 0, 1 }, }; const struct sysctl_bounded_args ipv6ctl_vars[] = { - { IPV6CTL_USE_DEPRECATED, &ip6_use_deprecated, 0, 1 }, { IPV6CTL_MAXFRAGS, &ip6_maxfrags, 0, 1000 }, { IPV6CTL_MFORWARDING, &ip6_mforwarding, 0, 1 }, { IPV6CTL_MCAST_PMTU, &ip6_mcast_pmtu, 0, 1 }, @@ -1576,6 +1576,7 @@ ip6_sysctl(int *name, u_int namelen, voi case IPV6CTL_DAD_COUNT: case IPV6CTL_AUTO_FLOWLABEL: case IPV6CTL_DEFMCASTHLIM: + case IPV6CTL_USE_DEPRECATED: return (sysctl_bounded_arr( ipv6ctl_vars_unlocked, nitems(ipv6ctl_vars_unlocked), name, namelen, oldp, oldlenp, newp, newlen));