On 25/12/18(Tue) 10:25, Denis Fondras wrote: > On Mon, Dec 24, 2018 at 08:43:10PM -0200, Martin Pieuchot wrote: > > On 24/12/18(Mon) 17:31, Denis Fondras wrote: > > > Index: net/if_ethersubr.c > > > =================================================================== > > > RCS file: /cvs/src/sys/net/if_ethersubr.c,v > > > retrieving revision 1.256 > > > diff -u -p -r1.256 if_ethersubr.c > > > --- net/if_ethersubr.c 20 Dec 2018 23:00:55 -0000 1.256 > > > +++ net/if_ethersubr.c 24 Dec 2018 14:39:26 -0000 > > > @@ -243,7 +243,11 @@ ether_resolve(struct ifnet *ifp, struct > > > if (!ISSET(ifp->if_xflags, IFXF_MPLS)) > > > senderr(ENETUNREACH); > > > > > > - switch (dst->sa_family) { > > > + af = dst->sa_family; > > > + if (af == AF_MPLS) > > > + af = rt->rt_gateway->sa_family; > > > + > > > + switch (af) { > > > case AF_LINK: > > > if (satosdl(dst)->sdl_alen < sizeof(eh->ether_dhost)) > > > senderr(EHOSTUNREACH); > > > @@ -258,7 +262,6 @@ ether_resolve(struct ifnet *ifp, struct > > > break; > > > #endif > > > case AF_INET: > > > - case AF_MPLS: > > > error = arpresolve(ifp, rt, m, dst, eh->ether_dhost); > > > if (error) > > > return (error); > > > > This is much better. ok mpi@ > > > > I'd like to commit this safer version, still ok ?
Why are you checking for NULL? Did you encounter a valid MPLS rtentry without gateway? > Index: if_ethersubr.c > =================================================================== > RCS file: /cvs/src/sys/net/if_ethersubr.c,v > retrieving revision 1.256 > diff -u -p -r1.256 if_ethersubr.c > --- if_ethersubr.c 20 Dec 2018 23:00:55 -0000 1.256 > +++ if_ethersubr.c 25 Dec 2018 09:20:28 -0000 > @@ -243,7 +243,11 @@ ether_resolve(struct ifnet *ifp, struct > if (!ISSET(ifp->if_xflags, IFXF_MPLS)) > senderr(ENETUNREACH); > > - switch (dst->sa_family) { > + af = dst->sa_family; > + if (af == AF_MPLS && rt->rt_gateway != NULL) > + af = rt->rt_gateway->sa_family; > + > + switch (af) { > case AF_LINK: > if (satosdl(dst)->sdl_alen < sizeof(eh->ether_dhost)) > senderr(EHOSTUNREACH); > @@ -258,7 +262,6 @@ ether_resolve(struct ifnet *ifp, struct > break; > #endif > case AF_INET: > - case AF_MPLS: > error = arpresolve(ifp, rt, m, dst, eh->ether_dhost); > if (error) > return (error); > > >