summaryrefslogtreecommitdiff
path: root/net/openbgpd/files/patch-bgpd_rde_decide.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openbgpd/files/patch-bgpd_rde_decide.c')
-rw-r--r--net/openbgpd/files/patch-bgpd_rde_decide.c112
1 files changed, 10 insertions, 102 deletions
diff --git a/net/openbgpd/files/patch-bgpd_rde_decide.c b/net/openbgpd/files/patch-bgpd_rde_decide.c
index 68fa6768d8ea..84cafd11beef 100644
--- a/net/openbgpd/files/patch-bgpd_rde_decide.c
+++ b/net/openbgpd/files/patch-bgpd_rde_decide.c
@@ -1,27 +1,18 @@
Index: bgpd/rde_decide.c
===================================================================
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde_decide.c,v
-retrieving revision 1.1.1.1
+retrieving revision 1.1.1.6
retrieving revision 1.2
-diff -u -p -r1.1.1.1 -r1.2
---- bgpd/rde_decide.c 30 Jun 2009 05:46:15 -0000 1.1.1.1
+diff -u -p -r1.1.1.6 -r1.2
+--- bgpd/rde_decide.c 14 Feb 2010 20:19:57 -0000 1.1.1.6
+++ bgpd/rde_decide.c 22 Oct 2009 15:12:21 -0000 1.2
@@ -1,4 +1,4 @@
--/* $OpenBSD: rde_decide.c,v 1.51 2008/05/08 09:51:46 henning Exp $ */
+-/* $OpenBSD: rde_decide.c,v 1.58 2009/06/29 14:10:13 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.59 2009/08/06 08:53:11 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
-@@ -115,15 +115,15 @@ prefix_cmp(struct prefix *p1, struct pre
- if (p2 == NULL)
- return (1);
-
-- /* only prefixes in the Local-RIB are eligible */
-- if (!(p1->flags & F_LOCAL))
-- return (-1);
-- if (!(p2->flags & F_LOCAL))
-- return (1);
--
+@@ -118,6 +118,12 @@ prefix_cmp(struct prefix *p1, struct pre
asp1 = p1->aspath;
asp2 = p2->aspath;
@@ -34,104 +25,21 @@ diff -u -p -r1.1.1.1 -r1.2
/* only loop free pathes are eligible */
if (asp1->flags & F_ATTR_LOOP)
return (-1);
-@@ -201,9 +201,16 @@ prefix_cmp(struct prefix *p1, struct pre
- &p2->aspath->peer->remote_addr,
- sizeof(p1->aspath->peer->remote_addr)));
+@@ -204,7 +210,7 @@ prefix_cmp(struct prefix *p1, struct pre
+ }
-+ /* 12. for announced prefixes prefer dynamic routes */
-+ if ((asp1->flags & F_ANN_DYNAMIC) != (asp2->flags & F_ANN_DYNAMIC)) {
-+ if (asp1->flags & F_ANN_DYNAMIC)
-+ return (1);
-+ else
-+ return (-1);
-+ }
-+
fatalx("Uh, oh a politician in the decision process");
- /* NOTREACHED */
-- return (0);
+ return(0); /* NOTREACHED */
}
/*
-@@ -212,59 +219,59 @@ prefix_cmp(struct prefix *p1, struct pre
- * The to evaluate prefix must not be in the prefix list.
- */
- void
--prefix_evaluate(struct prefix *p, struct pt_entry *pte)
-+prefix_evaluate(struct prefix *p, struct rib_entry *re)
- {
- struct prefix *xp;
-
-- if (rde_noevaluate()) {
-+ if (re->flags & F_RIB_NOEVALUATE || rde_noevaluate()) {
- /* decision process is turned off */
- if (p != NULL)
-- LIST_INSERT_HEAD(&pte->prefix_h, p, prefix_l);
-- if (pte->active != NULL) {
-- pte->active->aspath->active_cnt--;
-- pte->active = NULL;
-+ LIST_INSERT_HEAD(&re->prefix_h, p, rib_l);
-+ if (re->active != NULL) {
-+ re->active->aspath->active_cnt--;
-+ re->active = NULL;
- }
- return;
- }
-
- if (p != NULL) {
-- if (LIST_EMPTY(&pte->prefix_h))
-- LIST_INSERT_HEAD(&pte->prefix_h, p, prefix_l);
-+ if (LIST_EMPTY(&re->prefix_h))
-+ LIST_INSERT_HEAD(&re->prefix_h, p, rib_l);
- else {
-- LIST_FOREACH(xp, &pte->prefix_h, prefix_l)
-+ LIST_FOREACH(xp, &re->prefix_h, rib_l)
- if (prefix_cmp(p, xp) > 0) {
-- LIST_INSERT_BEFORE(xp, p, prefix_l);
-+ LIST_INSERT_BEFORE(xp, p, rib_l);
- break;
-- } else if (LIST_NEXT(xp, prefix_l) == NULL) {
-+ } else if (LIST_NEXT(xp, rib_l) == NULL) {
- /* if xp last element ... */
-- LIST_INSERT_AFTER(xp, p, prefix_l);
-+ LIST_INSERT_AFTER(xp, p, rib_l);
- break;
- }
- }
+@@ -245,7 +251,7 @@ prefix_evaluate(struct prefix *p, struct
}
-- xp = LIST_FIRST(&pte->prefix_h);
-- if (xp == NULL || !(xp->flags & F_LOCAL) ||
-- xp->aspath->flags & F_ATTR_LOOP ||
-+ xp = LIST_FIRST(&re->prefix_h);
+ xp = LIST_FIRST(&re->prefix_h);
+- if (xp == NULL || xp->aspath->flags & F_ATTR_LOOP ||
+ if (xp == NULL || xp->aspath->flags & (F_ATTR_LOOP|F_ATTR_PARSE_ERR) ||
(xp->aspath->nexthop != NULL &&
xp->aspath->nexthop->state != NEXTHOP_REACH))
/* xp is ineligible */
- xp = NULL;
-
-- if (pte->active != xp) {
-+ if (re->active != xp) {
- /* need to generate an update */
-- if (pte->active != NULL)
-- pte->active->aspath->active_cnt--;
-+ if (re->active != NULL)
-+ re->active->aspath->active_cnt--;
-
- /*
-- * Send update with remove for pte->active and add for xp
-+ * Send update with remove for re->active and add for xp
- * but remember that xp may be NULL aka ineligible.
- * Additional decision may be made by the called functions.
- */
-- rde_generate_updates(xp, pte->active);
-- rde_send_kroute(xp, pte->active);
-+ rde_generate_updates(re->ribid, xp, re->active);
-+ if ((re->flags & F_RIB_NOFIB) == 0)
-+ rde_send_kroute(xp, re->active);
-
-- pte->active = xp;
-+ re->active = xp;
- if (xp != NULL)
- xp->aspath->active_cnt++;
- }