summaryrefslogtreecommitdiff
path: root/isisd
diff options
context:
space:
mode:
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2023-02-24 22:27:25 +0100
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2023-09-11 22:11:38 +0200
commit2aaa75a6f3e63a176b025e7660a99359b90ee1df (patch)
tree2bbfdfff040af50450c095f490f443b5f6709d15 /isisd
parent7e340af13bdb9347e504edb4614dbc2ec777b303 (diff)
isisd: Add function to build TLV from SRv6 Locator
Add a function to build an SRv6 Locator TLV (RFC 9352 section #7.1) to advertise a specific SRv6 Locator passed as an argument. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_tlvs.c17
-rw-r--r--isisd/isis_tlvs.h4
2 files changed, 21 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index 9bf9d4a5eb..8d0047de76 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -7731,3 +7731,20 @@ void isis_tlvs_set_purge_originator(struct isis_tlvs *tlvs,
sizeof(tlvs->purge_originator->sender));
}
}
+
+/* Add an SRv6 Locator to the SRv6 Locator TLV */
+void isis_tlvs_add_srv6_locator(struct isis_tlvs *tlvs, uint16_t mtid,
+ struct isis_srv6_locator *loc)
+{
+ struct isis_srv6_locator_tlv *loc_tlv =
+ XCALLOC(MTYPE_ISIS_TLV, sizeof(*loc_tlv));
+
+ /* Fill in the SRv6 Locator TLV according to the SRv6 Locator
+ * configuration */
+ isis_srv6_locator2tlv(loc, loc_tlv);
+
+ /* Append the SRv6 Locator TLV to the TLVs list */
+ struct isis_item_list *l;
+ l = isis_get_mt_items(&tlvs->srv6_locator, mtid);
+ append_item(l, (struct isis_item *)loc_tlv);
+}
diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h
index b8a30534f7..552ffc151b 100644
--- a/isisd/isis_tlvs.h
+++ b/isisd/isis_tlvs.h
@@ -22,6 +22,7 @@ DECLARE_MTYPE(ISIS_SUBTLV);
struct lspdb_head;
struct sr_prefix_cfg;
+struct isis_srv6_locator;
struct isis_area_address {
struct isis_area_address *next;
@@ -832,4 +833,7 @@ isis_tlvs_lookup_mt_router_info(struct isis_tlvs *tlvs, uint16_t mtid);
void isis_tlvs_set_purge_originator(struct isis_tlvs *tlvs,
const uint8_t *generator,
const uint8_t *sender);
+
+void isis_tlvs_add_srv6_locator(struct isis_tlvs *tlvs, uint16_t mtid,
+ struct isis_srv6_locator *loc);
#endif