diff options
author | paul <paul> | 2006-01-18 14:52:52 +0000 |
---|---|---|
committer | paul <paul> | 2006-01-18 14:52:52 +0000 |
commit | af887b5111ada0e8cd961e9479aa9d39796a80c8 (patch) | |
tree | 0bc5674824e5cebe0c0bd17ef34eac99f7b68a48 | |
parent | eac314c7c49f6c0ec502be08e244f91bfc778739 (diff) |
2006-01-18 Gunnar Stigen <gunnar.stigen@axxessit.no>
* zebra_rib.c: Take interface metric into account.
-rw-r--r-- | zebra/ChangeLog | 4 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog index a40d3e93..b33180f7 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,7 @@ +2006-01-18 Gunnar Stigen <gunnar.stigen@axxessit.no> + + * zebra_rib.c: Take interface metric into account. + 2006-01-17 Paul Jakma <paul.jakma@sun.com> * kernel_socket.c: (ifam_read) Read metric from RTM_NEWADDR. diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index fb983bdb..5d9cb2f6 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -919,10 +919,23 @@ rib_process (struct work_queue *wq, void *data) if (rib->distance == DISTANCE_INFINITY) continue; - /* Newly selected rib. */ - if (! select || rib->distance < select->distance - || rib->type == ZEBRA_ROUTE_CONNECT) - select = rib; + /* Newly selected rib, the common case. */ + if (!select) + { + select = rib; + continue; + } + + /* filter route selection in following order: + * - lower distance beats higher + * - connected beats other types + * - lower metric beats higher for equal distance + * - last, hence oldest, route wins tie break. + */ + if ((rib->type == ZEBRA_ROUTE_CONNECT) + || (rib->distance <= select->distance)) + if (rib->metric <= select->metric) + select = rib; } /* Deleted route check. */ |