diff options
| author | lynne <lynne@voltanet.io> | 2020-03-29 13:47:36 -0400 |
|---|---|---|
| committer | lynne <lynne@voltanet.io> | 2020-04-01 13:14:58 -0400 |
| commit | 8675356098c9d30b9e566c0434138f1a7578ebfe (patch) | |
| tree | 9c37f29eeb306696917716930d12db7cf1fbf78a /ldpd/lde.c | |
| parent | 6b4830dc1ea8fa38633d7ef65539a7b2d64d6ca7 (diff) | |
ldpd: fixing host-only configuration filter.
There is configuration in LDP to only create labels for
host-routes. If the user remove this configuration the code
was not readvertising non-host routes to it's LDP neighbors.
The issue is the same in reverse also. If the user adds this
configuration on an active LDP session the non-host routes were
not withdrawn.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Diffstat (limited to 'ldpd/lde.c')
| -rw-r--r-- | ldpd/lde.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ldpd/lde.c b/ldpd/lde.c index 64c12e0df5..d4113a7869 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -1637,6 +1637,56 @@ lde_change_egress_label(int af) NULL, 0); } +void +lde_change_host_label(int af) +{ + struct lde_nbr *ln; + struct fec *f; + struct fec_node *fn; + uint32_t new_label; + + RB_FOREACH(f, fec_tree, &ft) { + fn = (struct fec_node *)f; + + 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_host_label: unknown af"); + } + + /* + * If the local label has changed to NO_LABEL, send a label + * withdraw to all peers. + * If the local label has changed and it's different from + * NO_LABEL, send a label mapping to all peers advertising + * the new label. + * If the local label hasn't changed, do nothing + */ + new_label = lde_update_label(fn); + if (fn->local_label != new_label) { + if (new_label == NO_LABEL) + RB_FOREACH(ln, nbr_tree, &lde_nbrs) + lde_send_labelwithdraw(ln, fn, + NULL, NULL); + + fn->local_label = new_label; + if (fn->local_label != NO_LABEL) + 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 lde_address_add(struct lde_nbr *ln, struct lde_addr *lde_addr) { |
