Great, that definitely makes more sense then :)

I'm still wondering, shouldn't this block:
if (ip->instance_id == 0)
                done0++;
              iid = ip->instance_id + 1;

instead read:
if (iid == 0)
                done0++;
              iid = ip->instance_id + 1;

Otherwise the condition done0>1 will only be triggered if the same interface is in multiple areas with instance ID 0. I think we want the condition to be triggered if the same interface is in multiple areas, whatever the instance ID?

On 10 May 2012 02:28, Ondrej Zajicek <santiago@crfreenet.org> wrote:
On Wed, May 09, 2012 at 06:18:19PM +0200, Benjamin Paterson wrote:
>    I am intrigued by the following bit of code in BIRD 1.3.7
>    proto/ospf/iface.c
>    void
>    ospf_ifa_notify(struct proto *p, unsigned flags, struct ifa *a)
>    {
>    [...]
>    if (flags & IF_CHANGE_UP)
>        {
>          int done0 = 0;
>          struct ospf_area *oa;
>          WALK_LIST(oa, po->area_list)
>          {
>            int iid = 0;
>            struct ospf_iface_patt *ip;
>            while (ip = ospf_iface_patt_find(oa->ac, a->iface, iid))
>            {
>              ospf_iface_new(oa, a, ip);
>              if (ip->instance_id == 0)
>                done0++;
>              iid = ip->instance_id + 1;
>            }
>          }
>    I might be wrong here, but if I understand correctly, the code expects the
>    set of instance IDs configured on each interface to be of the form [| 0, n
>    |].

No, ospf_iface_patt_find() returns the first configured iface pattern
with lowest instance id which is greater or equal to iid argument, so
it would iterate through all relevant iface patterns and initialize
them. If you have just one relevant pattern with iid 5, the first call
would return that and second one (called with iid 6) would return NULL.

>    In addition, I haven't seen any option to manually set Instance IDs.

Oops, it seems that i forgot to add this option, probably in dilemma
whether it should be syntactically a regular option or some part of an
iface pattern key (as it is semantically a part of the key). I will fix
that.

--
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEUEARECAAYFAk+rC8QACgkQw1GB2RHercN5KQCdHpTRh8bdgUHhQ2k30GpJn4li
4BQAmILLroqL6+qUsIVf2hXxMqzodRQ=
=zSdI
-----END PGP SIGNATURE-----