Static routes after `configure` CLI command
Hello! In CLI command line, after 'configure' command, pointer to static routes in neighbor structure not valid. This patch delete heighbors. Perhaps there is a better solution. diff --git a/nest/neighbor.c b/nest/neighbor.c index f8159d3..7fc449a 100644 --- a/nest/neighbor.c +++ b/nest/neighbor.c @@ -379,6 +379,37 @@ neigh_prune_one(neighbor *n) sl_free(neigh_slab, n); } . + +void +neigh_prune_proto(struct proto *p) +{ + neighbor *n; + node *m; + int i; + + for(i=0; i<NEIGH_HASH_SIZE; i++) + WALK_LIST_DELSAFE(n, m, neigh_hash_table[i]) + if (n->proto == p ) + { + rem_node(&n->n); + if (n->scope >= 0) + rem_node(&n->if_n); + sl_free(neigh_slab, n); + } + WALK_LIST_DELSAFE(n, m, sticky_neigh_list) + if (n->proto == p ) + { + rem_node(&n->n); + if (n->scope >= 0) + rem_node(&n->if_n); + sl_free(neigh_slab, n); + } +} + + + + + /** * neigh_prune - prune neighbor cache * diff --git a/proto/static/static.c b/proto/static/static.c index 849067b..8a7d1a0 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -559,6 +559,8 @@ static_reconfigure(struct proto *p, struct proto_config *new) WALK_LIST(r, o->other_routes) static_match(p, r, n); . + neigh_prune_proto(p); + /* Now add all new routes, those not changed will be ignored by static_install() */ WALK_LIST(r, n->iface_routes) {
On Mon, Dec 03, 2018 at 03:06:02PM +0500, Vladimir Osmolovskiy wrote:
Hello! In CLI command line, after 'configure' command, pointer to static routes in neighbor structure not valid.
Hello Thanks for the bugreport. In which version and under what circumstances it happens (e.g. 'configure' with the same config file or after some changes to static routes)? -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
On the master branch. Config file don't change. protocol static { route 20.1.100.0 /24 multipath via 10.10.10.2 weight 10; } As far as I understand the source code, when configuring, all static routes are deleted ( *static.c* <https://gitlab.labs.nic.cz/labs/bird/blob/master/proto/static/static.c> :557-560 ). After that static routes adding again ( *static.c* <https://gitlab.labs.nic.cz/labs/bird/blob/master/proto/static/static.c> :563-570 ). If neighbor 10.10.10.2 periodic up/down, neigh_hash_table may contain incorrect data and call segfault пн, 3 дек. 2018 г. в 17:38, Ondrej Zajicek <santiago@crfreenet.org>:
On Mon, Dec 03, 2018 at 03:06:02PM +0500, Vladimir Osmolovskiy wrote:
Hello! In CLI command line, after 'configure' command, pointer to static routes in neighbor structure not valid.
Hello
Thanks for the bugreport. In which version and under what circumstances it happens (e.g. 'configure' with the same config file or after some changes to static routes)?
-- Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
On Mon, Dec 03, 2018 at 06:10:43PM +0500, Vladimir Osmolovskiy wrote:
On the master branch. Config file don't change.
protocol static { route 20.1.100.0 /24 multipath via 10.10.10.2 weight 10; }
Hi Seems that the issue is specific to static ECMP routes, which we forgot to clean up, attached patch should fix it. Does it help? -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
It works! Thank you!! пн, 3 дек. 2018 г. в 18:49, Ondrej Zajicek <santiago@crfreenet.org>:
On Mon, Dec 03, 2018 at 06:10:43PM +0500, Vladimir Osmolovskiy wrote:
On the master branch. Config file don't change.
protocol static { route 20.1.100.0 /24 multipath via 10.10.10.2 weight 10; }
Hi
Seems that the issue is specific to static ECMP routes, which we forgot to clean up, attached patch should fix it. Does it help?
-- Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Ondrej Zajicek -
Vladimir Osmolovskiy