diff options
author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2022-01-17 12:45:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 12:45:12 +0100 |
commit | 4e4c027803cb148712b839a7335e26db9a3c8c60 (patch) | |
tree | 9f060f49484cf2d9f3b965dca9391f7b193f7b2d /bfdd | |
parent | Merge pull request #10350 from Drumato/fix-zebra-srv6-segment-routing-block (diff) | |
parent | *: rework renaming the default VRF (diff) | |
download | frr-4e4c027803cb148712b839a7335e26db9a3c8c60.tar.xz frr-4e4c027803cb148712b839a7335e26db9a3c8c60.zip |
Merge pull request #10183 from idryzhov/rework-vrf-rename
*: rework renaming the default VRF
Diffstat (limited to 'bfdd')
-rw-r--r-- | bfdd/bfd.c | 73 | ||||
-rw-r--r-- | bfdd/bfd.h | 1 | ||||
-rw-r--r-- | bfdd/ptm_adapter.c | 5 |
3 files changed, 1 insertions, 78 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index f4135fec1..c9a327490 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1946,19 +1946,6 @@ static int bfd_vrf_delete(struct vrf *vrf) return 0; } -static int bfd_vrf_update(struct vrf *vrf) -{ - if (!vrf_is_enabled(vrf)) - return 0; - - if (bglobal.debug_zebra) - zlog_debug("VRF update: %s(%u)", vrf->name, vrf->vrf_id); - - /* a different name is given; update bfd list */ - bfdd_sessions_enable_vrf(vrf); - return 0; -} - static int bfd_vrf_enable(struct vrf *vrf) { struct bfd_vrf_global *bvrf; @@ -2070,8 +2057,7 @@ static int bfd_vrf_disable(struct vrf *vrf) void bfd_vrf_init(void) { - vrf_init(bfd_vrf_new, bfd_vrf_enable, bfd_vrf_disable, - bfd_vrf_delete, bfd_vrf_update); + vrf_init(bfd_vrf_new, bfd_vrf_enable, bfd_vrf_disable, bfd_vrf_delete); } void bfd_vrf_terminate(void) @@ -2096,63 +2082,6 @@ struct bfd_vrf_global *bfd_vrf_look_by_session(struct bfd_session *bfd) return bfd->vrf->info; } -void bfd_session_update_vrf_name(struct bfd_session *bs, struct vrf *vrf) -{ - if (!vrf || !bs) - return; - /* update key */ - hash_release(bfd_key_hash, bs); - /* - * HACK: Change the BFD VRF in the running configuration directly, - * bypassing the northbound layer. This is necessary to avoid deleting - * the BFD and readding it in the new VRF, which would have - * several implications. - */ - if (yang_module_find("frr-bfdd") && bs->key.vrfname[0]) { - struct lyd_node *bfd_dnode; - char xpath[XPATH_MAXLEN], xpath_srcaddr[XPATH_MAXLEN + 32]; - char oldpath[XPATH_MAXLEN], newpath[XPATH_MAXLEN]; - char addr_buf[INET6_ADDRSTRLEN]; - int slen; - - /* build xpath */ - if (bs->key.mhop) { - inet_ntop(bs->key.family, &bs->key.local, addr_buf, sizeof(addr_buf)); - snprintf(xpath_srcaddr, sizeof(xpath_srcaddr), "[source-addr='%s']", - addr_buf); - } else - xpath_srcaddr[0] = 0; - inet_ntop(bs->key.family, &bs->key.peer, addr_buf, sizeof(addr_buf)); - slen = snprintf(xpath, sizeof(xpath), - "/frr-bfdd:bfdd/bfd/sessions/%s%s[dest-addr='%s']", - bs->key.mhop ? "multi-hop" : "single-hop", xpath_srcaddr, - addr_buf); - if (bs->key.ifname[0]) - slen += snprintf(xpath + slen, sizeof(xpath) - slen, - "[interface='%s']", bs->key.ifname); - else - slen += snprintf(xpath + slen, sizeof(xpath) - slen, - "[interface='*']"); - snprintf(xpath + slen, sizeof(xpath) - slen, "[vrf='%s']/vrf", - bs->key.vrfname); - - bfd_dnode = yang_dnode_getf(running_config->dnode, xpath, - bs->key.vrfname); - if (bfd_dnode) { - yang_dnode_get_path(lyd_parent(bfd_dnode), oldpath, - sizeof(oldpath)); - yang_dnode_change_leaf(bfd_dnode, vrf->name); - yang_dnode_get_path(lyd_parent(bfd_dnode), newpath, - sizeof(newpath)); - nb_running_move_tree(oldpath, newpath); - running_config->version++; - } - } - memset(bs->key.vrfname, 0, sizeof(bs->key.vrfname)); - strlcpy(bs->key.vrfname, vrf->name, sizeof(bs->key.vrfname)); - hash_get(bfd_key_hash, bs, hash_alloc_intern); -} - unsigned long bfd_get_session_count(void) { return bfd_key_hash->count; diff --git a/bfdd/bfd.h b/bfdd/bfd.h index dfe1a2030..473886901 100644 --- a/bfdd/bfd.h +++ b/bfdd/bfd.h @@ -774,7 +774,6 @@ void bfdd_zclient_unregister(vrf_id_t vrf_id); void bfdd_zclient_register(vrf_id_t vrf_id); void bfdd_sessions_enable_vrf(struct vrf *vrf); void bfdd_sessions_disable_vrf(struct vrf *vrf); -void bfd_session_update_vrf_name(struct bfd_session *bs, struct vrf *vrf); int ptm_bfd_notify(struct bfd_session *bs, uint8_t notify_state); diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index bf8f731d5..b0eb85e5f 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -721,11 +721,6 @@ void bfdd_sessions_enable_vrf(struct vrf *vrf) /* it may affect configs without interfaces */ TAILQ_FOREACH(bso, &bglobal.bg_obslist, bso_entry) { bs = bso->bso_bs; - /* update name */ - if (bs->vrf && bs->vrf == vrf) { - if (!strmatch(bs->key.vrfname, vrf->name)) - bfd_session_update_vrf_name(bs, vrf); - } if (bs->vrf) continue; if (bs->key.vrfname[0] && |