At Thu, 17 Apr 2008 18:35:23 -0700 (PDT),
vijay singh wrote:
>
> 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]?
>
It is almost always acceptable to submit a patch :-)
>
> 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;
> }
>
>
There are still parts of the network device infrastructure that need
some locking, and it would seem that this is one of them. I know
Brooks Davis was also looking at this stuff so he may comment as well.
Best,
George
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"