diff options
| author | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-02-15 12:15:45 +0100 |
|---|---|---|
| committer | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-09-11 22:11:38 +0200 |
| commit | 1804d70cbd975ef8a014719df5833a9233663811 (patch) | |
| tree | 6befe7f27176abac2c060f7bfd54c7f6584d5626 | |
| parent | 2aaa75a6f3e63a176b025e7660a99359b90ee1df (diff) | |
isisd: Add func to build Sub-TLV from SRv6 End SID
Add a function to build an SRv6 End SID TLV (RFC 9352 section #7.2) to
advertise a specific SRv6 End SID passed as an argument.
Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
| -rw-r--r-- | isisd/isis_tlvs.c | 34 | ||||
| -rw-r--r-- | isisd/isis_tlvs.h | 3 |
2 files changed, 37 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 8d0047de76..da62725311 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -7732,6 +7732,40 @@ void isis_tlvs_set_purge_originator(struct isis_tlvs *tlvs, } } +/* Add an SRv6 End SID to the SRv6 End SID Sub-TLV */ +void isis_subtlvs_add_srv6_end_sid(struct isis_subtlvs *subtlvs, + struct isis_srv6_sid *sid) +{ + struct isis_srv6_end_sid_subtlv *sid_subtlv; + + if (!sid) + return; + + /* The SRv6 End SID Sub-TLV advertises SRv6 SIDs with Endpoint behaviors + * that do not require a particular neighbor in order to be correctly + * applied (e.g. End, End.DT6, ...). Before proceeding, let's make sure + * we are encoding one of the supported behaviors. */ + if (sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_DT6 && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_DT6_USID && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_DT4 && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_DT4_USID && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_DT46 && + sid->behavior != SRV6_ENDPOINT_BEHAVIOR_END_DT46_USID) + return; + + /* Allocate memory for the Sub-TLV */ + sid_subtlv = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*sid_subtlv)); + + /* Fill in the SRv6 End SID Sub-TLV according to the SRv6 SID + * configuration */ + isis_srv6_end_sid2subtlv(sid, sid_subtlv); + + /* Append the SRv6 End SID Sub-TLV to the Sub-TLVs list */ + append_item(&subtlvs->srv6_end_sids, (struct isis_item *)sid_subtlv); +} + /* 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) diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 552ffc151b..a03f9285c1 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_sid; struct isis_srv6_locator; struct isis_area_address { @@ -834,6 +835,8 @@ void isis_tlvs_set_purge_originator(struct isis_tlvs *tlvs, const uint8_t *generator, const uint8_t *sender); +void isis_subtlvs_add_srv6_end_sid(struct isis_subtlvs *subtlvs, + struct isis_srv6_sid *sid); void isis_tlvs_add_srv6_locator(struct isis_tlvs *tlvs, uint16_t mtid, struct isis_srv6_locator *loc); #endif |
