Date: Thu, 17 Apr 2008 18:35:23 -0700 (PDT) From: vijay singh <vijjus@rocketmail.com> To: freebsd-net@freebsd.org Subject: Regarding if_alloc() Message-ID: <490341.95478.qm@web33501.mail.mud.yahoo.com>
index | next in thread | raw e-mail
Hi all. How do we avoid a race in populating the ifindex_table? Id this is a TODO, as it seems from the code below, would it be acceptable if I wrote a patch and reused the ifnet_lock [IFNET_WLOCK, IFNET_WUNLOCK]?
if_alloc(u_char type)
{
struct ifnet *ifp;
ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
/*
* Try to find an empty slot below if_index. If we fail, take
* the next slot.
*
* XXX: should be locked!
*/
for (ifp->if_index = 1; ifp->if_index <= if_index; ifp->if_index++) {
if (ifnet_byindex(ifp->if_index) == NULL)
break;
}
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?490341.95478.qm>
