summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_decide.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-04-12 14:32:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-04-12 14:32:02 +0000
commitcf15ea6afd9afb2f756e819126b4db8ed244adf9 (patch)
tree44a92901de0895b80ab82145c4c9cc1aca114a48 /usr.sbin/bgpd/rde_decide.c
parent69eb085e352c4a2ce2742b3774e248665379d0ac (diff)
Introduce a per prefix weight. The weight is used to tip prefixes with equal
long AS pathes in one or the other direction. It weights a prefix at a very late stage in the decision process. This is a nice bgpd feature to traffic engineer networks where most AS pathes are equally long. OK henning@
Diffstat (limited to 'usr.sbin/bgpd/rde_decide.c')
-rw-r--r--usr.sbin/bgpd/rde_decide.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index 6f3a7116df0..98117ae4ae0 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.40 2004/11/11 10:35:15 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.41 2005/04/12 14:32:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -154,21 +154,31 @@ prefix_cmp(struct prefix *p1, struct prefix *p2)
return -1;
}
- /* 7. nexthop costs. NOT YET -> IGNORE */
+ /*
+ * 7. local tie-breaker, this weight is here to tip equal long AS
+ * pathes in one or the other direction. It happens more and more
+ * that AS pathes are equally long and so traffic engineering needs
+ * a metric that weights a prefix at a very late stage in the
+ * decision process.
+ */
+ if ((asp1->weight - asp2->weight) != 0)
+ return (asp1->weight - asp2->weight);
+
+ /* 8. nexthop costs. NOT YET -> IGNORE */
/*
- * 8. older route (more stable) wins but only if route-age
+ * 9. older route (more stable) wins but only if route-age
* evaluation is enabled.
*/
if (rde_decisionflags() & BGPD_FLAG_DECISION_ROUTEAGE)
if ((p2->lastchange - p1->lastchange) != 0)
return (p2->lastchange - p1->lastchange);
- /* 9. lowest BGP Id wins */
+ /* 10. lowest BGP Id wins */
if ((p2->peer->remote_bgpid - p1->peer->remote_bgpid) != 0)
return (p2->peer->remote_bgpid - p1->peer->remote_bgpid);
- /* 10. lowest peer address wins (IPv4 is better than IPv6) */
+ /* 11. lowest peer address wins (IPv4 is better than IPv6) */
if (memcmp(&p1->peer->remote_addr, &p2->peer->remote_addr,
sizeof(p1->peer->remote_addr)) != 0)
return (-memcmp(&p1->peer->remote_addr, &p2->peer->remote_addr,