Skip to content

Commit

Permalink
isisd: added l1 to l2 distibution
Browse files Browse the repository at this point in the history
added adding prefixes with the best metric from the level-1 db
to the level-2 db on l1_l2 end system

Signed-off-by: Sososhas <[email protected]>

updted for checkout

Signed-off-by: Sososhas <[email protected]>
  • Loading branch information
Sashhkaa committed Oct 24, 2023
1 parent b6b0001 commit dd3de86
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions isisd/isis_lsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,61 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
lsp_build_internal_reach_ipv6(lsp, area, ipv6,
metric);
}

struct isis_adjacency *adj;
bool flag = false;

for (ALL_LIST_ELEMENTS_RO(area->adjacency_list, node, adj)) {
if (adj->level == IS_LEVEL_2)
flag = true;
}

if (flag && (lsp->level == IS_LEVEL_2) && (area->is_type == IS_LEVEL_1_AND_2) && (lsp->hdr.lsp_bits != LSPBIT_ATT)) {
struct isis_lsp *lsp_tmp;
struct lspdb_head *head_tmp = &area->lspdb[0];

if (head_tmp) {
frr_each (lspdb, head_tmp, lsp_tmp) {
if (strcmp(lsp->tlvs->hostname, lsp_tmp->tlvs->hostname) != 0) {
for (struct isis_item *i = lsp_tmp->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 (r->prefix.prefix.s_addr == rt->prefix.prefix.s_addr) {
if ((r->metric > rt->metric) || (r->metric == rt->metric))
count++;
break;
}
}
if (count == 0)
lsp_build_internal_reach_ipv4(lsp, area, &r->prefix, r->metric);
}
for (struct isis_item *i = lsp_tmp->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;
char prefixbuf_1[PREFIX2STR_BUFFER];
char prefixbuf_2[PREFIX2STR_BUFFER];

if (strcmp(prefix2str(&r->prefix, prefixbuf_1, sizeof(prefixbuf_1)),
prefix2str(&rt->prefix, prefixbuf_2, sizeof(prefixbuf_2))) == 0) {
if ((r->metric > rt->metric) || (r->metric == rt->metric))
count++;
break;
}
}
if (count == 0)
lsp_build_internal_reach_ipv6(lsp, area, &r->prefix, r->metric);
}
}
}
}
}

switch (circuit->circ_type) {
case CIRCUIT_T_BROADCAST:
Expand Down Expand Up @@ -1400,6 +1455,7 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
break;
case CIRCUIT_T_P2P: {
struct isis_adjacency *nei = circuit->u.p2p.neighbor;

if (nei && nei->adj_state == ISIS_ADJ_UP
&& (level & nei->circuit_t)) {
uint8_t ne_id[7];
Expand Down

0 comments on commit dd3de86

Please sign in to comment.