net-misc/bird: BGP: fixed deterministic med crashes
Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
parent
61d7916c0d
commit
2434529370
3 changed files with 68 additions and 2 deletions
|
@ -11,4 +11,4 @@ RDEPEND=client? ( sys-libs/ncurses:= sys-libs/readline:= ) filecaps? ( acct-grou
|
||||||
SLOT=0
|
SLOT=0
|
||||||
SRC_URI=ftp://bird.network.cz/pub/bird/bird-3.0.0.tar.gz
|
SRC_URI=ftp://bird.network.cz/pub/bird/bird-3.0.0.tar.gz
|
||||||
_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef
|
_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef
|
||||||
_md5_=ae8cbecced856bffffd8e5856aee44c2
|
_md5_=5318e1294df51f16cef366fc818e68f7
|
||||||
|
|
|
@ -37,9 +37,10 @@ FILECAPS=(
|
||||||
)
|
)
|
||||||
|
|
||||||
PATCHES=(
|
PATCHES=(
|
||||||
"${FILESDIR}"/${P}-nest-rt-table.c.patch
|
|
||||||
"${FILESDIR}"/${P}-proto-lock.patch
|
"${FILESDIR}"/${P}-proto-lock.patch
|
||||||
|
"${FILESDIR}"/${P}-nest-rt-table.c.patch
|
||||||
"${FILESDIR}"/${P}-rt-table.c.patch
|
"${FILESDIR}"/${P}-rt-table.c.patch
|
||||||
|
"${FILESDIR}"/${P}-bgp-med.patch
|
||||||
)
|
)
|
||||||
|
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
|
|
65
net-misc/bird/files/bird-3.0.0-bgp-med.patch
Normal file
65
net-misc/bird/files/bird-3.0.0-bgp-med.patch
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
From c5b07695ce810e4345ed1811eadfce935c83b324 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maria Matejka <mq@ucw.cz>
|
||||||
|
Date: Tue, 7 Jan 2025 11:08:04 +0100
|
||||||
|
Subject: [PATCH] BGP: fixed deterministic med crashes
|
||||||
|
|
||||||
|
There were several places of forgotten NULL checks.
|
||||||
|
|
||||||
|
Thanks to Alarig Le Lay <alarig@swordarmor.fr> for reporting:
|
||||||
|
https://trubka.network.cz/pipermail/bird-users/2024-December/017990.html
|
||||||
|
---
|
||||||
|
nest/rt-table.c | 14 ++++++++++++--
|
||||||
|
proto/bgp/attrs.c | 8 ++++----
|
||||||
|
2 files changed, 16 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/nest/rt-table.c b/nest/rt-table.c
|
||||||
|
index 05191d743..fc6d0d4e0 100644
|
||||||
|
--- a/nest/rt-table.c
|
||||||
|
+++ b/nest/rt-table.c
|
||||||
|
@@ -2024,12 +2024,22 @@ rte_recalculate(struct rtable_private *table, struct rt_import_hook *c, struct n
|
||||||
|
do_recalculate:
|
||||||
|
/* Add the new route to the list right behind the old one */
|
||||||
|
if (new_stored)
|
||||||
|
+ {
|
||||||
|
+ /* There is the same piece of code several lines farther. Needs refactoring.
|
||||||
|
+ * The old_stored check is needed because of the possible jump from deterministic med */
|
||||||
|
+ if (old_stored)
|
||||||
|
{
|
||||||
|
atomic_store_explicit(&new_stored->next, atomic_load_explicit(&old_stored->next, memory_order_relaxed), memory_order_release);
|
||||||
|
atomic_store_explicit(&old_stored->next, new_stored, memory_order_release);
|
||||||
|
-
|
||||||
|
- table->rt_count++;
|
||||||
|
}
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ atomic_store_explicit(&new_stored->next, NULL, memory_order_release);
|
||||||
|
+ atomic_store_explicit(last_ptr, new_stored, memory_order_release);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ table->rt_count++;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* Find a new optimal route (if there is any) */
|
||||||
|
struct rte_storage * _Atomic *bp = &local_sentinel.next;
|
||||||
|
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
|
||||||
|
index 5dc06be51..db6542343 100644
|
||||||
|
--- a/proto/bgp/attrs.c
|
||||||
|
+++ b/proto/bgp/attrs.c
|
||||||
|
@@ -2689,10 +2689,10 @@ bgp_rte_recalculate(struct rtable_private *table, net *net,
|
||||||
|
struct rte_storage *new_stored, struct rte_storage *old_stored, struct rte_storage *old_best_stored)
|
||||||
|
{
|
||||||
|
struct rte_storage *key_stored = new_stored ? new_stored : old_stored;
|
||||||
|
- const struct rte *new = &new_stored->rte,
|
||||||
|
- *old = &old_stored->rte,
|
||||||
|
- *old_best = &old_best_stored->rte,
|
||||||
|
- *key = &key_stored->rte;
|
||||||
|
+ const struct rte *new = RTE_OR_NULL(new_stored),
|
||||||
|
+ *old = RTE_OR_NULL(old_stored),
|
||||||
|
+ *old_best = RTE_OR_NULL(old_best_stored),
|
||||||
|
+ *key = RTE_OR_NULL(key_stored);
|
||||||
|
|
||||||
|
u32 lpref = rt_get_preference(key);
|
||||||
|
u32 lasn = bgp_get_neighbor(key);
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
Loading…
Reference in a new issue