Re: Global list of IPv6 addresses & icmp6
On 01/03/17(Wed) 22:52, Alexander Bluhm wrote: > 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(, _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() && (m->m_flags & M_LOOP)) > > + src = > > + > > I don't see why you move the link-local check before the route > lookup. But it should do not harm. It's a micro optimization. No need for a route lookup if we match the above conditions.
Re: Global list of IPv6 addresses & icmp6
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(, _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() && (m->m_flags & M_LOOP)) > + src = > + 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() && (m->m_flags & M_LOOP)) { > - /* > - * This is the case if the dst is our link-local address > - * and the sender is also ourselves. > - */ > - src = > + rtfree(rt); > + rt = NULL; > } > + This new line is too much. OK bluhm@