diff options
author | bz <bz@FreeBSD.org> | 2011-03-02 17:13:07 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2011-03-02 17:13:07 +0000 |
commit | 9791856c179074baee547d95afd0c7b32ea1d064 (patch) | |
tree | 5f732afa48789643ace8b2ec6a690cfd8243243e | |
parent | 604eda6c6c8657267ab5b99f38cbc45146b06651 (diff) | |
download | FreeBSD-src-9791856c179074baee547d95afd0c7b32ea1d064.zip FreeBSD-src-9791856c179074baee547d95afd0c7b32ea1d064.tar.gz |
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
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 654f206..02e3dc7 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -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; } |