On Tue, May 04, 2004 at 01:42:20PM +0100, Colin Percival wrote: > Could someone confirm for me that this looks sensible? I don't > know anything about this code, but if we're going to check that > 0 < ifp->if_index <= if_index, it seems that we should also be > checking that ifp->if_index corresponds to an interface which > still exists (rather than a gap left behind when an interface was > removed).
well, the problem here and elsewhere is whether we trust the rcvif field or not -- if we do, we must assume that if_index and ifadd_byindex() are all valid, because they are all set consistently in if_attach(). If the interface is gone, ifp is already bogus thus there is no point to check. So i'd vote to remove all the bogus checks here and elsewhere, rather than add newer ones. cheers luigi > Colin Percival > > Index: src/sys/netinet/ip_input.c > =================================================================== > RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v > retrieving revision 1.270 > diff -u -p -r1.270 ip_input.c > --- src/sys/netinet/ip_input.c 2 May 2004 15:10:16 -0000 1.270 > +++ src/sys/netinet/ip_input.c 4 May 2004 12:37:02 -0000 > @@ -2053,7 +2053,8 @@ ip_savecontrol(inp, mp, ip, m) > struct sockaddr_dl *sdl2 = &sdlbuf.sdl; > > if (((ifp = m->m_pkthdr.rcvif)) > - && ( ifp->if_index && (ifp->if_index <= if_index))) { > + && ( ifp->if_index && (ifp->if_index <= if_index)) && > + (ifaddr_byindex(ifp->if_index) != NULL)) { > sdp = (struct sockaddr_dl *) > (ifaddr_byindex(ifp->if_index)->ifa_addr); > /* > > _______________________________________________ > [EMAIL PROTECTED] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "[EMAIL PROTECTED]" _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"