Prevent crashes from a race when (cloned) interfaces go away.

PR:		bin/152143
Submitted by:	Przemyslaw Frasunek (przemyslaw frasunek.com)
Tested by:	Przemyslaw Frasunek (przemyslaw frasunek.com)
MFC after:	1 week
This commit is contained in:
Bjoern A. Zeeb 2011-03-02 17:13:07 +00:00
parent 8f8ab00ff7
commit 5033bae6d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219184

View File

@ -667,14 +667,16 @@ rtadvd_input()
}
/*
* If we happen to receive data on an interface which is now down,
* just discard the data.
* If we happen to receive data on an interface which is now gone
* or down, just discard the data.
*/
if ((iflist[pi->ipi6_ifindex]->ifm_flags & IFF_UP) == 0) {
if (iflist[pi->ipi6_ifindex] == NULL ||
(iflist[pi->ipi6_ifindex]->ifm_flags & IFF_UP) == 0) {
syslog(LOG_INFO,
"<%s> received data on a disabled interface (%s)",
__func__,
if_indextoname(pi->ipi6_ifindex, ifnamebuf));
(iflist[pi->ipi6_ifindex] == NULL) ? "[gone]" :
if_indextoname(pi->ipi6_ifindex, ifnamebuf));
return;
}