]> git.proxmox.com Git - mirror_frr.git/commit
bgpd: allow bestpath to handle mutliple locally-originated paths
authorDonald Sharp <sharpd@nvidia.com>
Wed, 16 Sep 2020 19:04:16 +0000 (15:04 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 9 Oct 2020 20:01:32 +0000 (16:01 -0400)
commit33c6e933c93339a265754275de8da516f3b6e7f2
treec62a5e4325dde0e52163e5efbe0b44fe209cc6be
parent9ef306be26f055c5c4215d7345b93e2991de01a4
bgpd: allow bestpath to handle mutliple locally-originated paths

Current code in bgp bestpath selection would accept the newest
locally originated path as the best path.  Making the selection
non-deterministic.  Modify the code to always come to the
same bestpath conclusion when you have multiple locally originated
paths in bestpath selection.

Before:

eva# conf
eva(config)# router bgp 323
eva(config-router)# address-family ipv4 uni
eva(config-router-af)# redistribute connected
eva(config-router-af)# network 192.168.161.0/24
eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0
BGP routing table entry for 192.168.161.0/24
Paths: (2 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin)
      Last update: Wed Sep 16 15:03:03 2020
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin incomplete, metric 0, weight 32768, valid, sourced
      Last update: Wed Sep 16 15:02:52 2020
eva(config-router-af)# no redistribute connected
eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0
BGP routing table entry for 192.168.161.0/24
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (First path received)
      Last update: Wed Sep 16 15:03:03 2020
eva(config-router-af)#  redistribute connected
eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0
BGP routing table entry for 192.168.161.0/24
Paths: (2 available, best #2, table default)
  Not advertised to any peer
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin incomplete, metric 0, weight 32768, valid, sourced
      Last update: Wed Sep 16 15:03:32 2020
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin)
      Last update: Wed Sep 16 15:03:03 2020
eva(config-router-af)#

Notice the route choosen depends on order received

Fixed behavior:

eva# conf
eva(config)# router bgp 323
eva(config-router)# address-family ipv4 uni
eva(config-router-af)# redistribute connected
eva(config-router-af)# network 192.168.161.0/24
eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0
BGP routing table entry for 192.168.161.0/24
Paths: (2 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin)
      Last update: Wed Sep 16 15:03:03 2020
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin incomplete, metric 0, weight 32768, valid, sourced
      Last update: Wed Sep 16 15:02:52 2020
eva(config-router-af)# no redistribute connected
eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0
BGP routing table entry for 192.168.161.0/24
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (First path received)
      Last update: Wed Sep 16 15:03:03 2020
eva(config-router-af)#  redistribute connected
eva(config-router-af)# do show bgp ipv4 uni 192.168.161.0
BGP routing table entry for 192.168.161.0/24
Paths: (2 available, best #2, table default)
  Not advertised to any peer
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin incomplete, metric 0, weight 32768, valid, sourced
      Last update: Wed Sep 16 15:03:32 2020
  Local
    0.0.0.0(eva) from 0.0.0.0 (192.168.161.245)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (Origin)
      Last update: Wed Sep 16 15:03:03 2020
eva(config-router-af)#

Ticket: CM-31490
Found-by: Trey Aspelund <taspelund@nvidia.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_route.c