cvs commit: src/share/man/man9 ifnet.9 src/sys/compat/ndis kern_ndis.c subr_ndis.c src/sys/contrib/altq/altq altq_rio.c src/sys/contrib/dev/oltr if_oltr.c if_oltr_pci.c if_oltrvar.h src/sys/contrib/pf/net if_pflog.c if_pflog.h if_pfsync.c ...

Andrew Gallatin gallatin at cs.duke.edu
Fri Jun 10 21:08:24 GMT 2005


Brooks Davis [brooks at FreeBSD.org] wrote:
>   Stop embedding struct ifnet at the top of driver softcs. Instead the
>   struct ifnet or the layer 2 common structure it was embedded in have
>   been replaced with a struct ifnet pointer to be filled by a call to the
>   new function, if_alloc(). The layer 2 common structure is also allocated
>   via if_alloc() based on the interface type. It is hung off the new
>   struct ifnet member, if_l2com.
>   
>   This change removes the size of these structures from the kernel ABI and
>   will allow us to better manage them as interfaces come and go.

What is the appropriate way to detach an interface now?  I used to
call just ether_ifdetach(ifp); Now I call both if_detach and if_free.
Eg:

    ether_ifdetach(ifp);
    if_free(ifp);


However, it looks like the ifp is getting leaked because I now
see:
    myri0: if_free_type: value was not if_alloced, skipping


I think this is because if_detatch() will remove the device from
the global ifnet list, so the check in if_free() will always fail:

    if (ifp != ifnet_byindex(ifp->if_index))


Thanks,

Drew




More information about the cvs-src mailing list