Commit 54da37d0 authored by Timo Teräs's avatar Timo Teräs

main/quagga: rework the bgp route selection fix

parent d0c62ef3
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=quagga
pkgver=0.99.24.1
pkgrel=1
pkgrel=2
pkgdesc="A free routing daemon replacing Zebra supporting RIP, OSPF and BGP."
url="http://quagga.net/"
arch="all"
......@@ -13,7 +13,7 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
pkgusers="quagga"
pkggroups="quagga"
source="http://download.savannah.gnu.org/releases/quagga/quagga-$pkgver.tar.xz
bgpd-gr-route-selection-fix.patch
bgpd-route-selection-crash.patch
bgpd.initd
zebra.initd
zebra.confd
......@@ -71,17 +71,17 @@ package() {
install -o quagga -g quagga -d -m755 "$pkgdir"/etc/quagga
}
md5sums="b168db69435100ee04564c4fb39c7413 quagga-0.99.24.1.tar.xz
1fbfcff69bc7df56f9e6682012261004 bgpd-gr-route-selection-fix.patch
87b4a6aaf991425851f080e121fd804b bgpd-route-selection-crash.patch
09a77e2e84e71c43f5a449738c026261 bgpd.initd
916f1dd1a286ee7b862cda4fe56cbf21 zebra.initd
34e06a1d2bc602ce691abc9ed169dd15 zebra.confd"
sha256sums="6fd6baadb136a801c29c1dd72d0fe69da9f19ae498e87bff7057778361e43b14 quagga-0.99.24.1.tar.xz
66de5b7c097aeb1767001547e219af51e43f968bd241dec7f0c71b68b54855de bgpd-gr-route-selection-fix.patch
c5e9adaefbca5317a8a24c6e749da8ec18b445d7d0aed80792d050f5706f117d bgpd-route-selection-crash.patch
aab037454c6a70cd5cb45e14c47b7dfea358f8d81c7d12418edcf7e58a86c679 bgpd.initd
c1d7526581927e990e687cbd5d08447eb060f76a439475572785b5b90c60c460 zebra.initd
f7a52d383f60270a5a8fee5d4ac522c5c0ec2b7c4b5252cff54e260f32d9b323 zebra.confd"
sha512sums="71c340ce0f4e52c69892d8fed82d30956161b09b029fb0a82ba774664aa2303b493068664ea057870bec3c7c2a1ffea0a68fba0c400d6868efef691d7b055d2a quagga-0.99.24.1.tar.xz
3e3e1862739ed47da38720d87669ee0bfa2d6e2c2c65388727c92a22cad8b5bf9f4c302701cbd0cf3ac0186eeb1498aefed74c85d8f43ced41c78680fdbbc2ac bgpd-gr-route-selection-fix.patch
e61ae7530b819e24b4c4a4bbc3138395d63b46a882a10da838487b088f823a791897d55bab94ba8784dafd741cdaa04b57f2e7aab962b6bd607b67ae60c72cb3 bgpd-route-selection-crash.patch
13b5b57e10df013bd2d931abc49bf76b8c4dee59dbceab22c9f151ccb988b2c5f7167f2909027d5e0f990b59da8de115667b02484aee9a67d347625700f6cacd bgpd.initd
1638a4a64ffd066b1884f7e5a4243edab68739aabd83bd35ea8c9608af7b8623eece1d59fb08feead84e4386b6d1da4220764ccf5fd7f2a9959a8470d5cce86a zebra.initd
900972c6f98e561dfacf384111251db262326e8764b8c763a5ef639fa11c7949c03eef5e3bce324a4b1964fe45416d2db74ae1b6bc967f7d4ba48c2eeda017c4 zebra.confd"
During best path selection, if one of the candidates is a stale entry, do not
perform the neighbor address comparison as that information is invalid for
the stale entry. Attempting to perform the comparison results in a bgpd
exception.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index cca26d8..d30c643 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -540,7 +540,11 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
return 0;
}
- /* 11. Rourter-ID comparision. */
+ /* 11. Router-ID comparision. */
+ /* If one of the paths is "stale", the corresponding peer router-id will
+ * be 0 and would always win over the other path. If originator id is
+ * used for the comparision, it will decide which path is better.
+ */
if (newattr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))
new_id.s_addr = newattre->originator_id.s_addr;
else
@@ -565,6 +569,14 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
return 0;
/* 13. Neighbor address comparision. */
+ /* Do this only if neither path is "stale" as stale paths do not have
+ * valid peer information (as the connection may or may not be up).
+ */
+ if (CHECK_FLAG (exist->flags, BGP_INFO_STALE))
+ return 1;
+ if (CHECK_FLAG (new->flags, BGP_INFO_STALE))
+ return 0;
+
ret = sockunion_cmp (new->peer->su_remote, exist->peer->su_remote);
if (ret == 1)
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 34ba1ab..ad8642e 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -348,9 +348,9 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
*paths_eq = 0;
/* 0. Null check. */
- if (new == NULL)
+ if (new == NULL || new->peer->su_remote == NULL)
return 0;
- if (exist == NULL)
+ if (exist == NULL || exist->peer->su_remote == NULL)
return 1;
newattr = new->attr;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment