On Tue, Dec 25, 2018 at 06:47:27PM -0200, Martin Pieuchot wrote:
> > Index: netinet/ip_icmp.c
> > ===================================================================
> > RCS file: /cvs/src/sys/netinet/ip_icmp.c,v
> > retrieving revision 1.181
> > diff -u -p -r1.181 ip_icmp.c
> > --- netinet/ip_icmp.c       28 Nov 2018 08:15:29 -0000      1.181
> > +++ netinet/ip_icmp.c       25 Dec 2018 20:11:37 -0000
> > @@ -676,11 +676,12 @@ freeit:
> >   * Reflect the ip packet back to the source
> >   */
> >  int
> > -icmp_reflect(struct mbuf *m, struct mbuf **op, truct in_ifaddr *ia)
> > +icmp_reflect(struct mbuf *m, struct mbuf **op, struct sockaddr *sa)
> >  {
> >     struct ip *ip = mtod(m, struct ip *);
> >     struct mbuf *opts = NULL;
> >     struct sockaddr_in sin;
> > +   struct in_ifaddr *ia = NULL;
> >     struct rtentry *rt = NULL;
> >     int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
> >     u_int rtableid;
> > @@ -700,12 +701,18 @@ icmp_reflect(struct mbuf *m, struct mbuf
> >     m_resethdr(m);
> >     m->m_pkthdr.ph_rtableid = rtableid;
> >  
> > +   if (sa != NULL) {
> > +           rt = rtalloc(sa, RT_RESOLVE, rtableid);
> > +           if (rtisvalid(rt) && rt->rt_ifa->ifa_addr->sa_family == AF_INET)
> > +                   ia = ifatoia(rt->rt_ifa);
> > +   }
> 
> This is worst than what we had.  Because this chunk of code is now only
> here because of a single caller of icmp_reflect(). 
> 
> Your IPv6 change doesn't use any `ia6' instead it uses `sa', can't we do
> the same here?
> 

the icmp6 diff uses a struct in6_ifaddr *ia6 :/

Reply via email to