Interface Instance IDs in OSPFv3
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 |]. In addition, I haven't seen any option to manually set Instance IDs. Is there any reason why this should be the case? I would like to manually set the instance ID to something other than 0, without necessarily having other protocol instances running on the same interface. Thanks - Benjamin
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."
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-----
On Thu, May 10, 2012 at 10:15:58AM +0200, Benjamin Paterson wrote:
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?
No. AFAIK having the same interface with different instance IDs in different areas is completely valid. You can think on instance ID feature as a kind of pseudo-vlan. The proper check would be triggered if the same interface is in multiple areas with the same instance ID, but check that just for IID 0 to make the check simple. -- 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."
On Thu, May 10, 2012 at 02:28:53AM +0200, Ondrej Zajicek wrote:
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.
Fixed in commit 0ec031f7400fbacdd86b40ae1870c58715a7f108. -- 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."
participants (2)
-
Benjamin Paterson -
Ondrej Zajicek