From 7c2ea458fdc039ecb2b00472b1fec1d73cda5721 Mon Sep 17 00:00:00 2001 From: Sososhas <1248756005hfh@gmail.com> Date: Fri, 6 Oct 2023 14:02:02 +0300 Subject: [PATCH] added adding prefixes from L1 toL 2 on L1L2 router --- isisd/isis_lsp.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 950d5f359c08..e61821e97455 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1314,6 +1314,52 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) metric); } + if((lsp->level == IS_LEVEL_2) && (area->is_type == 3) && (lsp->hdr.lsp_bits != LSPBIT_ATT)) { + struct isis_lsp* lsp_tmp_ip; + struct isis_lsp* lsp_tmp_ipv6; + struct lspdb_head *head_tmp_ip = &area->lspdb[0]; + struct lspdb_head *head_tmp_ipv6 = &area->lspdb[0]; + if(head_tmp_ip) { + frr_each (lspdb, head_tmp_ip, lsp_tmp_ip) { + if (strcmp(lsp->tlvs->hostname, lsp_tmp_ip->tlvs->hostname) != 0) { + for (struct isis_item* i = lsp_tmp_ip->tlvs->extended_ip_reach.head; i; i = i->next){ + struct isis_extended_ip_reach *r = (struct isis_extended_ip_reach *)i; + int count = 0; + for (struct isis_item* l = lsp->tlvs->extended_ip_reach.head; l; l = l->next) { + struct isis_extended_ip_reach *rt = (struct isis_extended_ip_reach *)l; + if(prefix_same((struct prefix_ipv4*)&r->prefix,(struct prefix_ipv6*)&rt->prefix)){ + count++; + break; + } + } + if (count == 0) + lsp_build_internal_reach_ipv4(lsp, area, &r->prefix , r->metric); + } + } + } + } + + if(head_tmp_ipv6) { + frr_each (lspdb, head_tmp_ipv6, lsp_tmp_ipv6) { + if (strcmp(lsp->tlvs->hostname, lsp_tmp_ipv6->tlvs->hostname) != 0) { + for (struct isis_item* i = lsp_tmp_ipv6->tlvs->ipv6_reach.head; i; i = i->next){ + struct isis_ipv6_reach *r = (struct isis_ipv6_reach *)i; + int count = 0; + for (struct isis_item* l = lsp->tlvs->ipv6_reach.head; l; l = l->next) { + struct isis_ipv6_reach *rt = (struct isis_ipv6_reach *)l; + if(prefix_same((struct prefix_ipv6*)&r->prefix,(struct prefix_ipv6*)&rt->prefix)){ + count++; + break; + } + } + if (count == 0) + lsp_build_internal_reach_ipv6(lsp, area, &r->prefix , r->metric); + } + } + } + } + } + switch (circuit->circ_type) { case CIRCUIT_T_BROADCAST: if (level & circuit->is_type) {