Hi,
The following patch addresses an irritating deficiency with static route
install / uninstall into the kernel: assume your zebra is configured
with some static route, say 192.68.1.0/24 via 192.69.1.1, installed into
the kernel/FIB. Then, add another nexthop to the same destination via
some other gateway, be it active or inactive. What happens in this case
is that the former route is uninstalled from the kernel, then the new
route (re-calculated with the newly added nexthop) is installed back
into it.
However, absurdly enough, this procedure of uninstall/reinstall happens
even if:
#1, the newly added nexthop is inactive, that is, has no matching
connected route to make it resolve into a reachable neighbor: in this
case there's clearly no need to reinstall anything, since nothing has
changed.
#2, the newly added nexthop is active, but the MULTIPATH_NUM limit is
exceeded: in this case, again, nothing needs to be reinstalled, since
the nexthop elements are added by chronological order into the nexthop
list, so the older ones are still the first to become active.
Note, that the same deficiency holds for nexthop removal, namely:
#1, even when an inactive nexthop is removed, the route is reinstalled.
#2, even when an active yet non-FIB nexthop is removed, the route is
reinstalled.
I figured this is worth fixing. Please note that:
- I believe this doesn't harm other behaviors, but I'd appreciate a
decent patch review (Paul?)
- sounds silly, but I didn't compile quagga with the new patch... (I
still don't have my automake tools updated, sorry ;-> ) I'll
appreciate it if someone verifies it passes. Thanks.
- I did test this fix in limited scenario, but it was applied to another
revision of the code that I'm running, so I'll appreciate it if someone
can verify that it does what it's aimed to do and doesn't screw up other
things. Thanks again. ;->
Also, this patch overrides a potential hazard in
zebra/zebra_rib.c/nexthop_active_check(), by which the returned value
may not be 0 or 1 (it's the result of CHECK_FLAG macro), but happens to
be so only because the checked flag NEXTHOP_FLAG_ACTIVE equals (1 << 0).
Otherwise, if the flag values are changed sometime in the future,
rib->nexthop_active_num in nexthop_active_update() may be evaluated to a
meaningless value.
Any comments are welcome!
(PS: same problem is present in zebra, AFAICT)
Thanks,
Gilad
The following patch addresses an irritating deficiency with static route
install / uninstall into the kernel: assume your zebra is configured
with some static route, say 192.68.1.0/24 via 192.69.1.1, installed into
the kernel/FIB. Then, add another nexthop to the same destination via
some other gateway, be it active or inactive. What happens in this case
is that the former route is uninstalled from the kernel, then the new
route (re-calculated with the newly added nexthop) is installed back
into it.
However, absurdly enough, this procedure of uninstall/reinstall happens
even if:
#1, the newly added nexthop is inactive, that is, has no matching
connected route to make it resolve into a reachable neighbor: in this
case there's clearly no need to reinstall anything, since nothing has
changed.
#2, the newly added nexthop is active, but the MULTIPATH_NUM limit is
exceeded: in this case, again, nothing needs to be reinstalled, since
the nexthop elements are added by chronological order into the nexthop
list, so the older ones are still the first to become active.
Note, that the same deficiency holds for nexthop removal, namely:
#1, even when an inactive nexthop is removed, the route is reinstalled.
#2, even when an active yet non-FIB nexthop is removed, the route is
reinstalled.
I figured this is worth fixing. Please note that:
- I believe this doesn't harm other behaviors, but I'd appreciate a
decent patch review (Paul?)
- sounds silly, but I didn't compile quagga with the new patch... (I
still don't have my automake tools updated, sorry ;-> ) I'll
appreciate it if someone verifies it passes. Thanks.
- I did test this fix in limited scenario, but it was applied to another
revision of the code that I'm running, so I'll appreciate it if someone
can verify that it does what it's aimed to do and doesn't screw up other
things. Thanks again. ;->
Also, this patch overrides a potential hazard in
zebra/zebra_rib.c/nexthop_active_check(), by which the returned value
may not be 0 or 1 (it's the result of CHECK_FLAG macro), but happens to
be so only because the checked flag NEXTHOP_FLAG_ACTIVE equals (1 << 0).
Otherwise, if the flag values are changed sometime in the future,
rib->nexthop_active_num in nexthop_active_update() may be evaluated to a
meaningless value.
Any comments are welcome!
(PS: same problem is present in zebra, AFAICT)
Thanks,
Gilad