cvs commit: src/sys/net if.c

Brooks Davis brooks at
Thu Aug 18 18:36:45 GMT 2005

brooks      2005-08-18 18:36:39 UTC

  FreeBSD src repository

  Modified files:
    sys/net              if.c 
  When we started calling if_findindex() from if_alloc() with an empty
  struct ifnet most of if_findindex() become a complex no-op.  Remove it
  and replace it with a corrected version of the four line for loop it
  devolved to plus some error handling.  This should probably be replaced
  with subr_unit at some point.
  Switch from checking ifaddr_byindex to ifnet_byindex when looking for
  empty indexes.  Since we're doing this from if_alloc/if_free, we can
  only be sure that ifnet_byindex will be correct.  This fixes panics when
  loading the ef(4) module.  The panics were caused by the fact that
  if_alloc was called four time before if_attach was called and thus
  ifaddr_byindex was not set and the same unit was allocated again.  This
  in turn caused the first if_attach to fail because the ifp was not the
  one in ifnet_byindex(ifp->if_index).
  Reported by:    "Wojciech A. Koszek" <dunstan at freebsd dot czest dot pl>
  PR:             kern/84987
  MFC After:      1 day
  Revision  Changes    Path
  1.244     +16 -56    src/sys/net/if.c

More information about the cvs-src mailing list