Download raw body.
have icmp6_reflect use route sourceaddr
On Thu, Jul 03, 2025 at 02:44:18PM +1000, David Gwynne wrote:
> this follows the pattern for source address selection in in6_src.c.
> this brings it into line with ipv4 and ipv6 pcb source address selection
> and ipv4 icmp_reflect source address selection.
Passes regress. OK bluhm@
> Index: icmp6.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/icmp6.c,v
> diff -u -p -r1.267 icmp6.c
> --- icmp6.c 12 Jun 2025 20:37:59 -0000 1.267
> +++ icmp6.c 3 Jul 2025 04:35:58 -0000
> @@ -1139,6 +1139,20 @@ icmp6_reflect(struct mbuf **mp, size_t o
> src = &ia6->ia_addr.sin6_addr;
> if (src == NULL)
> src = &ifatoia6(rt->rt_ifa)->ia_addr.sin6_addr;
> +
> + /* route sourceaddr may override src address selection */
> + if (ISSET(rt->rt_flags, RTF_GATEWAY)) {
> + struct sockaddr *sourceaddr;
> +
> + sourceaddr = rtable_getsource(rtableid, AF_INET6);
> + if (sourceaddr != NULL) {
> + struct ifaddr *ifa;
> + ifa = ifa_ifwithaddr(sourceaddr, rtableid);
> + if (ifa != NULL &&
> + ISSET(ifa->ifa_ifp->if_flags, IFF_UP))
> + src = &satosin6(sourceaddr)->sin6_addr;
> + }
> + }
> }
>
> ip6->ip6_src = *src;
>
>
have icmp6_reflect use route sourceaddr