diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2020-04-02 00:51:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 00:51:22 +0200 |
commit | 16a064ef24727f9f0171a5bc86b771e51718b274 (patch) | |
tree | 3111d9c5167bb567d4d32e732afa8f2e929021bf /ldpd | |
parent | Merge pull request #6120 from donaldsharp/ospf6_const (diff) | |
parent | ldpd: fixing host-only configuration filter. (diff) | |
download | frr-16a064ef24727f9f0171a5bc86b771e51718b274.tar.xz frr-16a064ef24727f9f0171a5bc86b771e51718b274.zip |
Merge pull request #6109 from volta-networks/feat_ldp_host_only
ldpd: host only filter
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/lde.c | 50 | ||||
-rw-r--r-- | ldpd/lde.h | 1 | ||||
-rw-r--r-- | ldpd/ldpd.c | 13 |
3 files changed, 64 insertions, 0 deletions
diff --git a/ldpd/lde.c b/ldpd/lde.c index 23a2dbd76..ae883078d 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) { diff --git a/ldpd/lde.h b/ldpd/lde.h index a099f8d28..36196a3d0 100644 --- a/ldpd/lde.h +++ b/ldpd/lde.h @@ -183,6 +183,7 @@ void lde_req_del(struct lde_nbr *, struct lde_req *, int); struct lde_wdraw *lde_wdraw_add(struct lde_nbr *, struct fec_node *); void lde_wdraw_del(struct lde_nbr *, struct lde_wdraw *); void lde_change_egress_label(int); +void lde_change_host_label(int); struct lde_addr *lde_address_find(struct lde_nbr *, int, union ldpd_addr *); diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 0f9f055d0..741c8c465 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -1319,6 +1319,7 @@ merge_af(int af, struct ldpd_af_conf *af_conf, struct ldpd_af_conf *xa) int stop_init_backoff = 0; int remove_dynamic_tnbrs = 0; int change_egress_label = 0; + int change_host_label = 0; int reset_nbrs_ipv4 = 0; int reset_nbrs = 0; int update_sockets = 0; @@ -1349,6 +1350,12 @@ merge_af(int af, struct ldpd_af_conf *af_conf, struct ldpd_af_conf *xa) if ((af_conf->flags & F_LDPD_AF_EXPNULL) != (xa->flags & F_LDPD_AF_EXPNULL)) change_egress_label = 1; + + /* changing config of host only fec filtering */ + if ((af_conf->flags & F_LDPD_AF_ALLOCHOSTONLY) + != (xa->flags & F_LDPD_AF_ALLOCHOSTONLY)) + change_host_label = 1; + af_conf->flags = xa->flags; /* update the transport address */ @@ -1358,6 +1365,10 @@ merge_af(int af, struct ldpd_af_conf *af_conf, struct ldpd_af_conf *xa) } /* update ACLs */ + if (strcmp(af_conf->acl_label_allocate_for, + xa->acl_label_allocate_for)) + change_host_label = 1; + if (strcmp(af_conf->acl_label_advertise_to, xa->acl_label_advertise_to) || strcmp(af_conf->acl_label_advertise_for, @@ -1391,6 +1402,8 @@ merge_af(int af, struct ldpd_af_conf *af_conf, struct ldpd_af_conf *xa) case PROC_LDE_ENGINE: if (change_egress_label) lde_change_egress_label(af); + if (change_host_label) + lde_change_host_label(af); break; case PROC_LDP_ENGINE: if (stop_init_backoff) |