diff options
| author | Russ White <russ@riw.us> | 2024-07-26 14:45:01 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-26 14:45:01 -0400 | 
| commit | 7f10381374f451b6550ae8c456f27101381c19f8 (patch) | |
| tree | 51b35f88a861a280683c6753c775b3e2b5d83946 /isisd/isis_lsp.c | |
| parent | 1f5a663cb51b909ef79b329a140bb24089187827 (diff) | |
| parent | 4e76df05476e728d3bdd53821c0f20e4139db1f8 (diff) | |
Merge pull request #15797 from pguibert6WIND/isis_srv6_ls_subnet
isis, lib: add isis srv6 end sid to ls_prefix
Diffstat (limited to 'isisd/isis_lsp.c')
| -rw-r--r-- | isisd/isis_lsp.c | 50 | 
1 files changed, 50 insertions, 0 deletions
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index bda7ed89a4..391d42fba1 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -2341,6 +2341,56 @@ static int lsp_handle_adj_state_change(struct isis_adjacency *adj)  }  /* + * Iterate over all SRv6 locator TLVs + */ +int isis_lsp_iterate_srv6_locator(struct isis_lsp *lsp, uint16_t mtid, +				  lsp_ip_reach_iter_cb cb, void *arg) +{ +	bool pseudo_lsp = LSP_PSEUDO_ID(lsp->hdr.lsp_id); +	struct isis_lsp *frag; +	struct listnode *node; + +	if (lsp->hdr.seqno == 0 || lsp->hdr.rem_lifetime == 0) +		return LSP_ITER_CONTINUE; + +	/* Parse LSP */ +	if (lsp->tlvs) { +		if (!pseudo_lsp) { +			struct isis_item_list *srv6_locator_reachs; +			struct isis_srv6_locator_tlv *r; + +			srv6_locator_reachs = +				isis_lookup_mt_items(&lsp->tlvs->srv6_locator, +						     mtid); + +			for (r = srv6_locator_reachs +					 ? (struct isis_srv6_locator_tlv *) +						   srv6_locator_reachs->head +					 : NULL; +			     r; r = r->next) { +				if ((*cb)((struct prefix *)&r->prefix, +					  r->metric, false /* ignore */, +					  r->subtlvs, arg) == LSP_ITER_STOP) +					return LSP_ITER_STOP; +			} +		} +	} + +	/* Parse LSP fragments if it is not a fragment itself */ +	if (!LSP_FRAGMENT(lsp->hdr.lsp_id)) +		for (ALL_LIST_ELEMENTS_RO(lsp->lspu.frags, node, frag)) { +			if (!frag->tlvs) +				continue; + +			if (isis_lsp_iterate_srv6_locator(frag, mtid, cb, +							  arg) == LSP_ITER_STOP) +				return LSP_ITER_STOP; +		} + +	return LSP_ITER_CONTINUE; +} + +/*   * Iterate over all IP reachability TLVs in a LSP (all fragments) of the given   * address-family and MT-ID.   */  | 
