Skip to content

Commit

Permalink
isisd: Add function to fill in an SRv6 Locator TLV
Browse files Browse the repository at this point in the history
Add a function to fill in an SRv6 Locator TLV with information from an
SRv6 locator (RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
  • Loading branch information
cscarpitta committed Sep 11, 2023
1 parent 791ca51 commit 6cd23c6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions isisd/isis_srv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@
/* Local variables and functions */
DEFINE_MTYPE_STATIC(ISISD, ISIS_SRV6_SID, "ISIS SRv6 Segment ID");

/**
* Fill in SRv6 Locator TLV with information from an SRv6 locator.
*
* @param loc SRv6 Locator configuration
* @param loc_tlv SRv6 Locator TLV to be updated
*/
void isis_srv6_locator2tlv(const struct isis_srv6_locator *loc,
struct isis_srv6_locator_tlv *loc_tlv)
{
/* Set SRv6 Locator metric */
loc_tlv->metric = loc->metric;

/* Set SRv6 Locator flags */
loc_tlv->flags = loc->flags;

/* Set SRv6 Locator algorithm */
loc_tlv->algorithm = loc->algorithm;

/* Set SRv6 Locator prefix */
loc_tlv->prefix = loc->prefix;
}

/**
* Unset the SRv6 locator for a given IS-IS area.
*
Expand Down
5 changes: 5 additions & 0 deletions isisd/isis_srv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include "lib/srv6.h"

#include "isisd/isis_tlvs.h"

/* Maximum SRv6 SID Depths supported by the router */
#define SRV6_MAX_SEG_LEFT 3
#define SRV6_MAX_END_POP 3
Expand Down Expand Up @@ -112,4 +114,7 @@ extern void isis_srv6_area_term(struct isis_area *area);
void isis_srv6_init(void);
void isis_srv6_term(void);

void isis_srv6_locator2tlv(const struct isis_srv6_locator *loc,
struct isis_srv6_locator_tlv *loc_tlv);

#endif /* _FRR_ISIS_SRV6_H */

0 comments on commit 6cd23c6

Please sign in to comment.