summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2023-03-12 21:19:12 +0100
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2023-09-11 22:11:28 +0200
commitdce3e4515f09769e4a7bc610eae96ffb3a93f7c6 (patch)
treedc33a76db4e3dddf8ebf2676d07dd3959969a7a9 /isisd
parentisisd: Add free func for Sub-Sub-TLVs in general (diff)
downloadfrr-dce3e4515f09769e4a7bc610eae96ffb3a93f7c6.tar.xz
frr-dce3e4515f09769e4a7bc610eae96ffb3a93f7c6.zip
isisd: Add pack func for Sub-Sub-TLVs in general
Add a function to pack all the Sub-Sub-TLVs passed as an argument. At this time, this function does not pack any Sub-Sub-TLVs because no Sub-Sub-TLVs have been defined yet. This function will be extended in future commits to pack specific Sub-Sub-TLVs, as they become supported. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_tlvs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index 50110a4e2..117c90a8a 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -2014,6 +2014,25 @@ static void isis_free_subsubtlvs(struct isis_subsubtlvs *subsubtlvs)
XFREE(MTYPE_ISIS_SUBSUBTLV, subsubtlvs);
}
+static int isis_pack_subsubtlvs(struct isis_subsubtlvs *subsubtlvs,
+ struct stream *s)
+{
+ int rv;
+ size_t subsubtlv_len_pos = stream_get_endp(s);
+
+ if (STREAM_WRITEABLE(s) < 1)
+ return 1;
+
+ stream_putc(s, 0); /* Put 0 as Sub-Sub-TLVs length, filled in later */
+
+ size_t subsubtlv_len = stream_get_endp(s) - subsubtlv_len_pos - 1;
+ if (subsubtlv_len > 255)
+ return 1;
+
+ stream_putc_at(s, subsubtlv_len_pos, subsubtlv_len);
+ return 0;
+}
+
/* Functions related to subtlvs */
static struct isis_subtlvs *isis_alloc_subtlvs(enum isis_tlv_context context)