diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-02-01 13:03:53 -0200 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-02-01 21:48:54 -0200 |
| commit | be54d7449aebd657e378016a1228ec1b006936cc (patch) | |
| tree | dda8f5f10d88d90db3bd06eae0ec6e30d7dbde3c /ldpd/lde.c | |
| parent | 64dffe251ab5d1119b151731a22fa6d6cd4e6d50 (diff) | |
ldpd: fix a bug in the explicit-null command
Be more clever and update the label of the connected routes just once upon
a configuration change. This is not only more efficient but also fixes
a bug where no labels were updated when we didn't have any neighbors.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/lde.c')
| -rw-r--r-- | ldpd/lde.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/ldpd/lde.c b/ldpd/lde.c index 0aa422c23a..91b2b1727f 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -1266,8 +1266,8 @@ lde_change_egress_label(int af, int was_implicit) struct fec *f; struct fec_node *fn; + /* explicitly withdraw all null labels */ RB_FOREACH(ln, nbr_tree, &lde_nbrs) { - /* explicit withdraw */ if (was_implicit) lde_send_labelwithdraw(ln, NULL, MPLS_LABEL_IMPLNULL, NULL); @@ -1279,33 +1279,34 @@ lde_change_egress_label(int af, int was_implicit) lde_send_labelwithdraw(ln, NULL, MPLS_LABEL_IPV6NULL, NULL); } + } - /* advertise new label of connected prefixes */ - RB_FOREACH(f, fec_tree, &ft) { - fn = (struct fec_node *)f; - if (fn->local_label > MPLS_LABEL_RESERVED_MAX) - continue; - - switch (af) { - case AF_INET: - if (fn->fec.type != FEC_TYPE_IPV4) - continue; - break; - case AF_INET6: - if (fn->fec.type != FEC_TYPE_IPV6) - continue; - break; - default: - fatalx("lde_change_egress_label: unknown af"); - } + /* update label of connected routes */ + RB_FOREACH(f, fec_tree, &ft) { + fn = (struct fec_node *)f; + if (fn->local_label > MPLS_LABEL_RESERVED_MAX) + continue; - fn->local_label = egress_label(fn->fec.type); - lde_send_labelmapping(ln, fn, 0); + switch (af) { + case AF_INET: + if (fn->fec.type != FEC_TYPE_IPV4) + continue; + break; + case AF_INET6: + if (fn->fec.type != FEC_TYPE_IPV6) + continue; + break; + default: + fatalx("lde_change_egress_label: unknown af"); } + fn->local_label = egress_label(fn->fec.type); + RB_FOREACH(ln, nbr_tree, &lde_nbrs) + lde_send_labelmapping(ln, fn, 0); + } + RB_FOREACH(ln, nbr_tree, &lde_nbrs) lde_imsg_compose_ldpe(IMSG_MAPPING_ADD_END, ln->peerid, 0, NULL, 0); - } } static int |
