diff options
author | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-02-14 16:24:56 +0100 |
---|---|---|
committer | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-09-11 22:11:35 +0200 |
commit | 5579ca40ef7043319e701c990132ebc5b8628b77 (patch) | |
tree | 28b05af3c963eb3c6a7ba5d8541d09dc5aec072c /isisd | |
parent | isisd: Pack SID Struct when packing Sub-Sub-TLVs (diff) | |
download | frr-5579ca40ef7043319e701c990132ebc5b8628b77.tar.xz frr-5579ca40ef7043319e701c990132ebc5b8628b77.zip |
isisd: Add unpack func for SID Struct Sub-Sub-TLV
Add a function to unpack an SRv6 SID Structure Sub-Sub-TLV
(RFC 9352 section #9).
Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_tlvs.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index f575a67ec..a1535632f 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -2035,6 +2035,33 @@ static int pack_subsubtlv_srv6_sid_structure( return 0; } +static int unpack_subsubtlv_srv6_sid_structure( + enum isis_tlv_context context, uint8_t tlv_type, uint8_t tlv_len, + struct stream *s, struct sbuf *log, void *dest, int indent) +{ + struct isis_subsubtlvs *subsubtlvs = dest; + struct isis_srv6_sid_structure_subsubtlv sid_struct = {}; + + sbuf_push(log, indent, "Unpacking SRv6 SID Structure...\n"); + if (tlv_len != 4) { + sbuf_push( + log, indent, + "Invalid SRv6 SID Structure Sub-Sub-TLV size. (Expected 4 bytes, got %hhu)\n", + tlv_len); + return 1; + } + + sid_struct.loc_block_len = stream_getc(s); + sid_struct.loc_node_len = stream_getc(s); + sid_struct.func_len = stream_getc(s); + sid_struct.arg_len = stream_getc(s); + + subsubtlvs->srv6_sid_structure = + copy_subsubtlv_srv6_sid_structure(&sid_struct); + + return 0; +} + static struct isis_item *copy_item(enum isis_tlv_context context, enum isis_tlv_type type, struct isis_item *item); |