From 61d7916c0df4869fb5596b5782f6af637439a7ea Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Wed, 8 Jan 2025 01:00:52 +0100 Subject: [PATCH] net-misc/bird: Table: old best route refeed fix Signed-off-by: Alarig Le Lay --- metadata/md5-cache/net-misc/bird-2.14 | 2 +- metadata/md5-cache/net-misc/bird-2.15.1 | 2 +- metadata/md5-cache/net-misc/bird-2.16 | 2 +- metadata/md5-cache/net-misc/bird-3.0.0 | 4 +- net-misc/bird/bird-3.0.0.ebuild | 1 + .../bird/files/bird-3.0.0-rt-table.c.patch | 87 +++++++++++++++++++ 6 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 net-misc/bird/files/bird-3.0.0-rt-table.c.patch diff --git a/metadata/md5-cache/net-misc/bird-2.14 b/metadata/md5-cache/net-misc/bird-2.14 index 2802d10..4d16d18 100644 --- a/metadata/md5-cache/net-misc/bird-2.14 +++ b/metadata/md5-cache/net-misc/bird-2.14 @@ -11,5 +11,5 @@ LICENSE=GPL-2 RDEPEND=client? ( sys-libs/ncurses:= sys-libs/readline:= ) filecaps? ( acct-group/bird acct-user/bird ) libssh? ( net-libs/libssh:= ) SLOT=0 SRC_URI=ftp://bird.network.cz/pub/bird/bird-2.14.tar.gz -_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs fa554cc3cff825d21dfe3f24841e29cf multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef +_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef _md5_=861cb5ab3196d428acd2325c6e9a53de diff --git a/metadata/md5-cache/net-misc/bird-2.15.1 b/metadata/md5-cache/net-misc/bird-2.15.1 index c79b6ca..ed397b9 100644 --- a/metadata/md5-cache/net-misc/bird-2.15.1 +++ b/metadata/md5-cache/net-misc/bird-2.15.1 @@ -11,5 +11,5 @@ LICENSE=GPL-2 RDEPEND=client? ( sys-libs/ncurses:= sys-libs/readline:= ) filecaps? ( acct-group/bird acct-user/bird ) libssh? ( net-libs/libssh:= ) SLOT=0 SRC_URI=ftp://bird.network.cz/pub/bird/bird-2.15.1.tar.gz -_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs fa554cc3cff825d21dfe3f24841e29cf multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef +_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef _md5_=861cb5ab3196d428acd2325c6e9a53de diff --git a/metadata/md5-cache/net-misc/bird-2.16 b/metadata/md5-cache/net-misc/bird-2.16 index b082fce..3db174a 100644 --- a/metadata/md5-cache/net-misc/bird-2.16 +++ b/metadata/md5-cache/net-misc/bird-2.16 @@ -11,5 +11,5 @@ LICENSE=GPL-2 RDEPEND=client? ( sys-libs/ncurses:= sys-libs/readline:= ) filecaps? ( acct-group/bird acct-user/bird ) libssh? ( net-libs/libssh:= ) SLOT=0 SRC_URI=ftp://bird.network.cz/pub/bird/bird-2.16.tar.gz -_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs fa554cc3cff825d21dfe3f24841e29cf multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef +_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef _md5_=8a211251a3c532c78f3209ab72193c8e diff --git a/metadata/md5-cache/net-misc/bird-3.0.0 b/metadata/md5-cache/net-misc/bird-3.0.0 index d53b2ce..30485a9 100644 --- a/metadata/md5-cache/net-misc/bird-3.0.0 +++ b/metadata/md5-cache/net-misc/bird-3.0.0 @@ -10,5 +10,5 @@ LICENSE=GPL-2 RDEPEND=client? ( sys-libs/ncurses:= sys-libs/readline:= ) filecaps? ( acct-group/bird acct-user/bird ) libssh? ( net-libs/libssh:= ) SLOT=0 SRC_URI=ftp://bird.network.cz/pub/bird/bird-3.0.0.tar.gz -_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs fa554cc3cff825d21dfe3f24841e29cf multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef -_md5_=4dbfc03e077fb153238552e205be0ea5 +_eclasses_=gnuconfig ddeb9f8caff1b5f71a09c75b7534df79 toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 libtool 6b28392a775f807c8be5fc7ec9a605b9 autotools 7d91cc798a8afd8f4e0c6e9587296ebe fcaps 27152c9e4da035accb14a2d7879744ef +_md5_=ae8cbecced856bffffd8e5856aee44c2 diff --git a/net-misc/bird/bird-3.0.0.ebuild b/net-misc/bird/bird-3.0.0.ebuild index c42bb30..2a0a270 100644 --- a/net-misc/bird/bird-3.0.0.ebuild +++ b/net-misc/bird/bird-3.0.0.ebuild @@ -39,6 +39,7 @@ FILECAPS=( PATCHES=( "${FILESDIR}"/${P}-nest-rt-table.c.patch "${FILESDIR}"/${P}-proto-lock.patch + "${FILESDIR}"/${P}-rt-table.c.patch ) src_prepare() { diff --git a/net-misc/bird/files/bird-3.0.0-rt-table.c.patch b/net-misc/bird/files/bird-3.0.0-rt-table.c.patch new file mode 100644 index 0000000..13a6a71 --- /dev/null +++ b/net-misc/bird/files/bird-3.0.0-rt-table.c.patch @@ -0,0 +1,87 @@ +From 2e14832d36c83b2ab5b7fb28b701de554fa5fdd9 Mon Sep 17 00:00:00 2001 +From: Maria Matejka +Date: Tue, 7 Jan 2025 12:13:57 +0100 +Subject: [PATCH] Table: old best route refeed fix + +When refeeding with RA_OPTIMAL, the old best routes weren't announced, +leading to weird behavior of protocols, mostly kernel. Fixed. +--- + nest/rt-table.c | 30 ++++++++++++++++++++++++++---- + 1 file changed, 26 insertions(+), 4 deletions(-) + +diff --git a/nest/rt-table.c b/nest/rt-table.c +index fc6d0d4e0..18a445a62 100644 +--- a/nest/rt-table.c ++++ b/nest/rt-table.c +@@ -1485,11 +1485,18 @@ channel_notify_basic(void *_channel) + rte *new = &u->feed->block[i]; + rte *old = NULL; + for (uint o = oldpos; o < u->feed->count_routes; o++) +- if (new->src == u->feed->block[o].src) ++ if ((c->ra_mode == RA_ANY) && (new->src == u->feed->block[o].src)) + { + old = &u->feed->block[o]; + break; + } ++ else if ((c->ra_mode == RA_OPTIMAL) && ( ++ bmap_test(&c->export_accepted_map, u->feed->block[o].id) || ++ bmap_test(&c->export_rejected_map, u->feed->block[o].id))) ++ { ++ ASSERT_DIE(!old); ++ old = &u->feed->block[o]; ++ } + + rt_notify_basic(c, new, old); + +@@ -2542,10 +2549,14 @@ rt_feed_net_best(struct rt_exporter *e, struct rcu_unwinder *u, u32 index, bool + last_in_net = atomic_load_explicit(&n->best.last, memory_order_acquire); + first = rt_net_feed_validate_first(tr, first_in_net, last_in_net, first); + +- uint ecnt = 0; ++ uint ecnt = 0, ocnt = 0; + for (const struct rt_pending_export *rpe = first; rpe; + rpe = atomic_load_explicit(&rpe->next, memory_order_acquire)) ++ { + ecnt++; ++ if (rpe->it.old) ++ ocnt++; ++ } + + if (ecnt) { + const net_addr *a = (first->it.new ?: first->it.old)->net; +@@ -2558,10 +2569,11 @@ rt_feed_net_best(struct rt_exporter *e, struct rcu_unwinder *u, u32 index, bool + if (!ecnt && (!best || prefilter && !prefilter(f, best->rte.net))) + return NULL; + +- struct rt_export_feed *feed = rt_alloc_feed(!!best, ecnt); ++ struct rt_export_feed *feed = rt_alloc_feed(!!best + ocnt, ecnt); ++ uint bpos = 0; + if (best) + { +- feed->block[0] = best->rte; ++ feed->block[bpos++] = best->rte; + feed->ni = NET_TO_INDEX(best->rte.net); + } + else +@@ -2575,8 +2587,18 @@ rt_feed_net_best(struct rt_exporter *e, struct rcu_unwinder *u, u32 index, bool + if (e >= ecnt) + RT_READ_RETRY(tr); + else ++ { + feed->exports[e++] = rpe->it.seq; ++ if (rpe->it.old) ++ { ++ ASSERT_DIE(bpos < !!best + ocnt); ++ feed->block[bpos] = *rpe->it.old; ++ feed->block[bpos].flags |= REF_OBSOLETE; ++ bpos++; ++ } ++ } + ++ ASSERT_DIE(bpos == !!best + ocnt); + ASSERT_DIE(e == ecnt); + } + +-- +GitLab +