@@ -4235,6 +4235,7 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
4235
4235
{
4236
4236
size_t tlv_len , len_pos ;
4237
4237
uint8_t nb_algo ;
4238
+ size_t subtlv_len , subtlv_len_pos ;
4238
4239
bool sr_algo_subtlv_present = false;
4239
4240
4240
4241
if (!router_cap )
@@ -4391,6 +4392,58 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
4391
4392
router_cap -> algo [i ]);
4392
4393
}
4393
4394
}
4395
+
4396
+ /* And finish with MSDs if set as per RFC 9352 section #4 */
4397
+ if (router_cap -> srv6_msd .max_seg_left_msd +
4398
+ router_cap -> srv6_msd .max_end_pop_msd +
4399
+ router_cap -> srv6_msd .max_h_encaps_msd +
4400
+ router_cap -> srv6_msd .max_end_d_msd !=
4401
+ 0 ) {
4402
+ stream_putc (s , ISIS_SUBTLV_NODE_MSD );
4403
+
4404
+ subtlv_len_pos = stream_get_endp (s );
4405
+ /* Put 0 as Sub-TLV length for now, real length will be
4406
+ * adjusted later */
4407
+ stream_putc (s , 0 );
4408
+
4409
+ /* RFC 9352 section #4.1 */
4410
+ if (router_cap -> srv6_msd .max_seg_left_msd != 0 ) {
4411
+ stream_putc (s , ISIS_SUBTLV_SRV6_MAX_SL_MSD );
4412
+ stream_putc (
4413
+ s ,
4414
+ router_cap -> srv6_msd .max_seg_left_msd );
4415
+ }
4416
+
4417
+ /* RFC 9352 section #4.2 */
4418
+ if (router_cap -> srv6_msd .max_end_pop_msd != 0 ) {
4419
+ stream_putc (s ,
4420
+ ISIS_SUBTLV_SRV6_MAX_END_POP_MSD );
4421
+ stream_putc (
4422
+ s ,
4423
+ router_cap -> srv6_msd .max_end_pop_msd );
4424
+ }
4425
+
4426
+ /* RFC 9352 section #4.3 */
4427
+ if (router_cap -> srv6_msd .max_h_encaps_msd != 0 ) {
4428
+ stream_putc (s ,
4429
+ ISIS_SUBTLV_SRV6_MAX_H_ENCAPS_MSD );
4430
+ stream_putc (
4431
+ s ,
4432
+ router_cap -> srv6_msd .max_h_encaps_msd );
4433
+ }
4434
+
4435
+ /* RFC 9352 section #4.4 */
4436
+ if (router_cap -> srv6_msd .max_end_d_msd != 0 ) {
4437
+ stream_putc (s , ISIS_SUBTLV_SRV6_MAX_END_D_MSD );
4438
+ stream_putc (s ,
4439
+ router_cap -> srv6_msd .max_end_d_msd );
4440
+ }
4441
+
4442
+ /* Adjust Node MSD Sub-TLV length which depends on MSDs
4443
+ * presence */
4444
+ subtlv_len = stream_get_endp (s ) - subtlv_len_pos - 1 ;
4445
+ stream_putc_at (s , subtlv_len_pos , subtlv_len );
4446
+ }
4394
4447
}
4395
4448
4396
4449
/* Adjust TLV length which depends on subTLVs presence */
0 commit comments