summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-07-28 13:13:34 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2010-07-28 13:13:34 +0200
commitac3ac49a71d4b290cfb28aecafc8ac4a69df7a64 (patch)
treeac45a031548bbacbe2fabc6c5f28c5ea1632bee8
parent1b180121a90ef98f3adce1a355d48d64c6fc3c4f (diff)
downloadbird-ac3ac49a71d4b290cfb28aecafc8ac4a69df7a64.tar
bird-ac3ac49a71d4b290cfb28aecafc8ac4a69df7a64.zip
Adds route resolvability test.
-rw-r--r--proto/bgp/attrs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 039828f..3e7c94a 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -1023,6 +1023,15 @@ bgp_rte_better(rte *new, rte *old)
eattr *x, *y;
u32 n, o;
+ /* RFC 4271 9.1.2.1. Route resolvability test */
+ /* non-NULL iface means it is either RTD_ROUTER or RTD_DEVICE route */
+ n = new->attrs->iface != NULL;
+ o = old->attrs->iface != NULL;
+ if (n > o)
+ return 1;
+ if (n < o)
+ return 0;
+
/* Start with local preferences */
x = ea_find(new->attrs->eattrs, EA_CODE(EAP_BGP, BA_LOCAL_PREF));
y = ea_find(old->attrs->eattrs, EA_CODE(EAP_BGP, BA_LOCAL_PREF));