diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2020-12-05 21:10:04 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2021-01-09 01:36:09 +0100 |
commit | 220e848cc5d558e0a1ac170ec939851249566f46 (patch) | |
tree | cadcf5ed5d8819403c12cad41a17fb31a140e65e /ldpd | |
parent | Merge pull request #7816 from pjdruddy/revert_labelmanager_statics (diff) | |
download | frr-220e848cc5d558e0a1ac170ec939851249566f46.tar.xz frr-220e848cc5d558e0a1ac170ec939851249566f46.zip |
ldpd: detect when route received from zebra hasn't changed
Add some code to detect when a route received from zebra hasn't
changed and ignore the notification in that case, preventing ldpd
from sending unnecessary label mappings.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/lde.h | 2 | ||||
-rw-r--r-- | ldpd/lde_lib.c | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ldpd/lde.h b/ldpd/lde.h index 660aeafb3..21769ffe0 100644 --- a/ldpd/lde.h +++ b/ldpd/lde.h @@ -129,7 +129,9 @@ struct fec_node { uint32_t pw_remote_status; void *data; /* fec specific data */ + uint8_t flags; }; +#define F_FEC_NHS_CHANGED 0x01 #define CHUNK_SIZE 64 struct label_chunk { diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 9db931677..d89cbb308 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -339,6 +339,8 @@ lde_kernel_insert(struct fec *fec, int af, union ldpd_addr *nexthop, fnh = fec_nh_find(fn, af, nexthop, ifindex, route_type, route_instance); if (fnh == NULL) { + fn->flags |= F_FEC_NHS_CHANGED; + fnh = fec_nh_add(fn, af, nexthop, ifindex, route_type, route_instance); /* @@ -415,11 +417,17 @@ lde_kernel_update(struct fec *fec) } else fnh->flags |= F_FEC_NH_NO_LDP; } else { + fn->flags |= F_FEC_NHS_CHANGED; lde_send_delete_klabel(fn, fnh); fec_nh_del(fnh); } } + if (!(fn->flags & F_FEC_NHS_CHANGED)) + /* return earlier if nothing has changed */ + return; + fn->flags &= ~F_FEC_NHS_CHANGED; + if (LIST_EMPTY(&fn->nexthops)) { RB_FOREACH(ln, nbr_tree, &lde_nbrs) lde_send_labelwithdraw(ln, fn, NULL, NULL); |