I remember adding the missing ipif_refrele() to ipif_get_next_ipif() to make
this work, but then taking it out again... My recollection is that it's
generally better to walk the ipif list under ill_lock; if you use
ipif_get_next_ipif() you grab and release ill_lock 2*N times (N being the
number of ipifs checked until you find a match). It's only when the code
inside the loop can't work under ill_lock that you have no choice but using
refheld ipifs.

http://cvs.opensolaris.org/source/xref/on/usr/src/uts/common/inet/ip/ip_if.c#23048
is an example of walking the ipif list under ill_lock.

Blaise

----- Original Message ----- 
From: "Darren Reed" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 13, 2006 7:27 AM
Subject: [networking-discuss] On using ipif_get_next_ipif in a loop


> Looking inside of ip_if.c (), there's a function named
> ipif_get_next_ipif().  It has the appearance of being
> suitable for use in a loop such as this:
>
> for (ipif = ipif_get_next_ipif(NULL, ill); ipif != NULL; ipif =
> ipif_get_next_ipif(ipif, ill))
>         if (ipif->something == something_to_match)
>                 break;
>
> But this leaves behind lots of ref-held ipif's.
>
> Looking through ip in Solaris, there are no existing
> examples of this kind of use that I can find.
>
> Was this function meant to be used that way?
>
> To my way of thinking, it should be suitable for this
> and a bug filed against it to allow for this and to
> possibly create an ipif_get_first_ipif()?
>
> Darren
>
> _______________________________________________
> networking-discuss mailing list
> [email protected]
>

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to