@@ -901,6 +901,156 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
901901 lan -> neighbor_id );
902902 }
903903 }
904+ /* SRv6 End.X SID as per RFC9352 section #8.1 */
905+ if (IS_SUBTLV (exts , EXT_SRV6_ENDX_SID )) {
906+ struct isis_srv6_endx_sid_subtlv * adj ;
907+
908+ if (json ) {
909+ struct json_object * arr_adj_json , * flags_json ;
910+ arr_adj_json = json_object_new_array ();
911+ json_object_object_add (json , "srv6-endx-sid" ,
912+ arr_adj_json );
913+ for (adj = (struct isis_srv6_endx_sid_subtlv * )
914+ exts -> srv6_endx_sid .head ;
915+ adj ; adj = adj -> next ) {
916+ snprintfrr (cnt_buf , sizeof (cnt_buf ), "%pI6" ,
917+ & adj -> sid );
918+ flags_json = json_object_new_object ();
919+ json_object_string_addf (flags_json , "sid" ,
920+ "%pI6" , & adj -> sid );
921+ json_object_string_add (
922+ flags_json , "algorithm" ,
923+ sr_algorithm_string (adj -> algorithm ));
924+ json_object_int_add (flags_json , "weight" ,
925+ adj -> weight );
926+ json_object_string_add (
927+ flags_json , "behavior" ,
928+ seg6local_action2str (adj -> behavior ));
929+ json_object_string_add (
930+ flags_json , "flag-b" ,
931+ adj -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
932+ ? "1"
933+ : "0" );
934+ json_object_string_add (
935+ flags_json , "flag-s" ,
936+ adj -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
937+ ? "1"
938+ : "0" );
939+ json_object_string_add (
940+ flags_json , "flag-p" ,
941+ adj -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
942+ ? "1"
943+ : "0" );
944+ json_object_array_add (arr_adj_json , flags_json );
945+ if (adj -> subsubtlvs )
946+ isis_format_subsubtlvs (adj -> subsubtlvs ,
947+ NULL , json ,
948+ indent + 4 );
949+ }
950+ } else
951+ for (adj = (struct isis_srv6_endx_sid_subtlv * )
952+ exts -> srv6_endx_sid .head ;
953+ adj ; adj = adj -> next ) {
954+ sbuf_push (
955+ buf , indent ,
956+ "SRv6 End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c\n" ,
957+ & adj -> sid ,
958+ sr_algorithm_string (adj -> algorithm ),
959+ adj -> weight ,
960+ seg6local_action2str (adj -> behavior ),
961+ adj -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
962+ ? '1'
963+ : '0' ,
964+ adj -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
965+ ? '1'
966+ : '0' ,
967+ adj -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
968+ ? '1'
969+ : '0' );
970+ if (adj -> subsubtlvs )
971+ isis_format_subsubtlvs (adj -> subsubtlvs ,
972+ buf , NULL ,
973+ indent + 4 );
974+ }
975+ }
976+ /* SRv6 LAN End.X SID as per RFC9352 section #8.2 */
977+ if (IS_SUBTLV (exts , EXT_SRV6_LAN_ENDX_SID )) {
978+ struct isis_srv6_lan_endx_sid_subtlv * lan ;
979+ if (json ) {
980+ struct json_object * arr_adj_json , * flags_json ;
981+ arr_adj_json = json_object_new_array ();
982+ json_object_object_add (json , "srv6-lan-endx-sid" ,
983+ arr_adj_json );
984+ for (lan = (struct isis_srv6_lan_endx_sid_subtlv * )
985+ exts -> srv6_lan_endx_sid .head ;
986+ lan ; lan = lan -> next ) {
987+ snprintfrr (cnt_buf , sizeof (cnt_buf ), "%pI6" ,
988+ & lan -> sid );
989+ flags_json = json_object_new_object ();
990+ json_object_string_addf (flags_json , "sid" ,
991+ "%pI6" , & lan -> sid );
992+ json_object_int_add (flags_json , "weight" ,
993+ lan -> weight );
994+ json_object_string_add (
995+ flags_json , "algorithm" ,
996+ sr_algorithm_string (lan -> algorithm ));
997+ json_object_int_add (flags_json , "weight" ,
998+ lan -> weight );
999+ json_object_string_add (
1000+ flags_json , "behavior" ,
1001+ seg6local_action2str (lan -> behavior ));
1002+ json_object_string_add (
1003+ flags_json , "flag-b" ,
1004+ lan -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
1005+ ? "1"
1006+ : "0" );
1007+ json_object_string_add (
1008+ flags_json , "flag-s" ,
1009+ lan -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
1010+ ? "1"
1011+ : "0" );
1012+ json_object_string_add (
1013+ flags_json , "flag-p" ,
1014+ lan -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
1015+ ? "1"
1016+ : "0" );
1017+ json_object_string_addf (flags_json ,
1018+ "neighbor-id" , "%pSY" ,
1019+ lan -> neighbor_id );
1020+ json_object_array_add (arr_adj_json , flags_json );
1021+ if (lan -> subsubtlvs )
1022+ isis_format_subsubtlvs (lan -> subsubtlvs ,
1023+ NULL , json ,
1024+ indent + 4 );
1025+ }
1026+ } else
1027+ for (lan = (struct isis_srv6_lan_endx_sid_subtlv * )
1028+ exts -> srv6_lan_endx_sid .head ;
1029+ lan ; lan = lan -> next ) {
1030+ sbuf_push (
1031+ buf , indent ,
1032+ "SRv6 Lan End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c "
1033+ "Neighbor-ID: %pSY\n" ,
1034+ & lan -> sid ,
1035+ sr_algorithm_string (lan -> algorithm ),
1036+ lan -> weight ,
1037+ seg6local_action2str (lan -> behavior ),
1038+ lan -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
1039+ ? '1'
1040+ : '0' ,
1041+ lan -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
1042+ ? '1'
1043+ : '0' ,
1044+ lan -> flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
1045+ ? '1'
1046+ : '0' ,
1047+ lan -> neighbor_id );
1048+ if (lan -> subsubtlvs )
1049+ isis_format_subsubtlvs (lan -> subsubtlvs ,
1050+ buf , NULL ,
1051+ indent + 4 );
1052+ }
1053+ }
9041054 for (ALL_LIST_ELEMENTS_RO (exts -> aslas , node , asla ))
9051055 format_item_asla_subtlvs (asla , buf , indent );
9061056}
0 commit comments