On Wed, Mar 01, 2017 at 12:39:56PM +0100, Martin Pieuchot wrote: > Like for IPv4, I'd like to get rid of this global list. The reason is > that having fewer global data structures means fewer locking. > > Here's a trivial conversion to use the routing table in ICMPv6 echo > reply code. Note that it is safe to dereference ``rt->rt_ifa'' before > calling rtfree(9).
> @@ -1231,26 +1230,30 @@ icmp6_reflect(struct mbuf *m, size_t off > in6_embedscope(&t, &sa6_dst, NULL); > > /* > + * This is the case if the dst is our link-local address > + * and the sender is also ourselves. > + */ > + if (IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) > + src = &t; > + I don't see why you move the link-local check before the route lookup. But it should do not harm. > - if (ia6 == NULL && IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) { > - /* > - * This is the case if the dst is our link-local address > - * and the sender is also ourselves. > - */ > - src = &t; > + rtfree(rt); > + rt = NULL; > } > + This new line is too much. OK bluhm@