Just panic if_com_alloc[type]() fails. On Thu, Jul 19, 2018 at 5:20 PM, Aaron LI <[email protected]> wrote: > On Thu, 19 Jul 2018 17:00:44 +0800 > Sepherosa Ziehau <[email protected]> wrote: > >> How about move the following logic into if_alloc(): >> >> + ifp = sc->tun_ifp = if_alloc(IFT_PPP); >> + if (ifp == NULL) >> + /* XXX: should return an error */ >> + panic("%s%d: failed to if_alloc() interface", TUN, >> minor(dev)); >> >> i.e. if_alloc never fails. > > But the if_alloc() can return NULL if if_com_alloc[type]() fails, so does > if_alloc() need some work? > > On the other hand, the code ported from FreeBSD all uses if_alloc() but > checks its return value. By making if_alloc() never fail will simplify its > use. > > What do you think on improving the if_alloc()-related code? > > > Cheers, > -- > Aaron
-- Tomorrow Will Never Die
