ifindex2ifnet could return NULL if if_detach() is used (pcmcia card

removal and such).
This commit is contained in:
itojun 2001-07-25 09:23:46 +00:00
parent efe956a93f
commit a21ce80cd6

View File

@ -1,5 +1,5 @@
/* $NetBSD: ip6_mroute.c,v 1.21 2001/07/22 13:34:11 wiz Exp $ */
/* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.22 2001/07/25 09:23:46 itojun Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@ -542,7 +542,12 @@ add_m6if(mifcp)
return EADDRINUSE; /* XXX: is it appropriate? */
if (mifcp->mif6c_pifi == 0 || mifcp->mif6c_pifi > if_index)
return ENXIO;
ifp = ifindex2ifnet[mifcp->mif6c_pifi];
/*
* XXX: some OSes can remove ifp and clear ifindex2ifnet[id]
* even for id between 0 and if_index.
*/
if ((ifp = ifindex2ifnet[mifcp->mif6c_pifi]) == NULL)
return ENXIO;
if (mifcp->mif6c_flags & MIFF_REGISTER) {
if (reg_mif_num == (mifi_t)-1) {