From 773253559e914b08465cc4509612c1c8c55a8cf2 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm <max@sdn.clinic> Date: Sun, 24 Jun 2018 11:12:49 +0200 Subject: [PATCH] Annotate route selection process and add eBGP vs. iBGP tie breaking. Signed-off-by: Maximilian Wilhelm <max@sdn.clinic> --- route/bgp_path.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/route/bgp_path.go b/route/bgp_path.go index 0ab7dc4b..1f100024 100644 --- a/route/bgp_path.go +++ b/route/bgp_path.go @@ -40,6 +40,11 @@ func (b *BGPPath) Compare(c *BGPPath) int8 { return -1 } + /* + * 9.1.2.2. Breaking Ties (Phase 2) + */ + + // a) if c.ASPathLen > b.ASPathLen { return 1 } @@ -48,6 +53,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 { return -1 } + // b) if c.Origin > b.Origin { return 1 } @@ -56,6 +62,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 { return -1 } + // c) if c.MED > b.MED { return 1 } @@ -64,6 +71,18 @@ func (b *BGPPath) Compare(c *BGPPath) int8 { return -1 } + // d) + if c.EBGP && !b.EBGP { + return -1 + } + + if !c.EBGP && b.EBGP { + return 1 + } + + // e) TODO: interiour cost (hello IS-IS and OSPF) + + // f) if c.BGPIdentifier < b.BGPIdentifier { return 1 } @@ -72,6 +91,7 @@ func (b *BGPPath) Compare(c *BGPPath) int8 { return -1 } + // g) if c.Source < b.Source { return 1 } -- GitLab