@@ -102,6 +102,7 @@ static const struct tok lsa_opaque_values[] = {
102102 { LS_OPAQUE_TYPE_GRACE , "Graceful restart" },
103103 { LS_OPAQUE_TYPE_RI , "Router Information" },
104104 { LS_OPAQUE_TYPE_EP , "Extended Prefix" },
105+ { LS_OPAQUE_TYPE_EL , "Extended Link" },
105106 { 0 , NULL }
106107};
107108
@@ -192,8 +193,11 @@ static const struct tok lsa_opaque_te_tlv_link_type_sub_tlv_values[] = {
192193
193194static const struct tok lsa_opaque_ri_tlv_values [] = {
194195 { LS_OPAQUE_RI_TLV_CAP , "Router Capabilities" },
196+ { LS_OPAQUE_RI_TLV_SR_ALGO , "SR-Algorithm" },
195197 { LS_OPAQUE_RI_TLV_HOSTNAME , "Hostname" },
196198 { LS_OPAQUE_RI_TLV_SID_LABEL_RANGE , "SID/Label Range" },
199+ { LS_OPAQUE_RI_TLV_SR_LOCAL_BLOCK , "SR Local Block" },
200+ { LS_OPAQUE_RI_TLV_SRMS_PREFERENCE , "SRMS Preference" },
197201 { 0 , NULL }
198202};
199203
@@ -211,6 +215,12 @@ static const struct tok lsa_opaque_ri_tlv_cap_values[] = {
211215 { 0 , NULL }
212216};
213217
218+ static const struct tok lsa_opaque_ri_tlv_sr_algos [] = {
219+ { 0 , "Shortest Path First" },
220+ { 1 , "Strict Shortest Path First" },
221+ { 0 , NULL }
222+ };
223+
214224static const struct tok ospf_lls_tlv_values [] = {
215225 { OSPF_LLS_EO , "Extended Options" },
216226 { OSPF_LLS_MD5 , "MD5 Authentication" },
@@ -656,6 +666,14 @@ ospf_print_tos_metrics(netdissect_options *ndo,
656666 }
657667}
658668
669+ /*
670+ * The SID/Label Range TLV
671+ * https://datatracker.ietf.org/doc/html/rfc8665#section-3.2
672+ * and the SR Local Block TLV
673+ * https://datatracker.ietf.org/doc/html/rfc8665#section-3.3
674+ * have the same contents, so this function is used to
675+ * print both.
676+ */
659677static int
660678ospf_print_ri_lsa_sid_label_range_tlv (netdissect_options * ndo , const uint8_t * tptr ,
661679 u_int tlv_length )
@@ -739,15 +757,16 @@ ospf_print_ep_lsa_extd_prefix_tlv(netdissect_options *ndo, const uint8_t *tptr,
739757 algo = GET_U_1 (tptr + 3 );
740758
741759 if (subtlv_length == 7 ) {
742- ND_PRINT ("\n\t\t Label: %u, MT-ID: %u, Algorithm: %u" ,
743- GET_BE_U_3 (tptr + 4 ), mt_id , algo );
760+ ND_PRINT ("\n\t\t Label: %u" , GET_BE_U_3 (tptr + 4 ));
744761 } else if (subtlv_length == 8 ) {
745- ND_PRINT ("\n\t\t Index: %u, MT-ID: %u, Algorithm: %u, Flags [%s]" ,
746- GET_BE_U_4 (tptr + 4 ), mt_id , algo ,
747- bittok2str (ep_range_tlv_prefix_sid_subtlv_flag_values , "none" , flags ));
762+ ND_PRINT ("\n\t\t Index: %u" , GET_BE_U_4 (tptr + 4 ));
748763 } else {
749764 ND_PRINT ("\n\t\tBogus subTLV length %u" , subtlv_length );
765+ break ;
750766 }
767+ ND_PRINT ( ", MT-ID: %u, Algorithm: %s (%u), Flags [%s]" ,
768+ mt_id , tok2str (lsa_opaque_ri_tlv_sr_algos , "Unknown" , algo ), algo ,
769+ bittok2str (ep_range_tlv_prefix_sid_subtlv_flag_values , "none" , flags ));
751770 break ;
752771
753772 default :
@@ -883,7 +902,7 @@ ospf_print_lsa(netdissect_options *ndo,
883902 const struct aslametric * almp ;
884903 const struct mcla * mcp ;
885904 const uint8_t * lp ;
886- u_int tlv_type , tlv_length , rla_count , topology ;
905+ u_int tlv_type , tlv_length , rla_count , topology , num_tlv ;
887906 int ospf_print_lshdr_ret ;
888907 u_int ls_length ;
889908 const uint8_t * tptr ;
@@ -1099,14 +1118,32 @@ ospf_print_lsa(netdissect_options *ndo,
10991118 nd_printjnp (ndo , tptr , tlv_length );
11001119 break ;
11011120
1121+ case LS_OPAQUE_RI_TLV_SR_ALGO :
1122+ num_tlv = tlv_length ;
1123+ while (num_tlv >= 1 ) {
1124+ ND_PRINT ("\n\t %s (%u)" ,
1125+ tok2str (lsa_opaque_ri_tlv_sr_algos , "Unknown" , GET_U_1 (tptr + tlv_length - num_tlv )), GET_U_1 (tptr + tlv_length - num_tlv ));
1126+ num_tlv -- ;
1127+ }
1128+ break ;
1129+
11021130 case LS_OPAQUE_RI_TLV_SID_LABEL_RANGE :
1131+ case LS_OPAQUE_RI_TLV_SR_LOCAL_BLOCK :
11031132 ND_TCHECK_4 (tptr );
11041133 ND_PRINT ("\n\t Range size: %u" , GET_BE_U_3 (tptr ));
11051134 if (ospf_print_ri_lsa_sid_label_range_tlv (ndo , tptr + 4 , tlv_length - 4 ) == -1 ) {
11061135 return (ls_end );
11071136 }
11081137 break ;
11091138
1139+ case LS_OPAQUE_RI_TLV_SRMS_PREFERENCE :
1140+ if (tlv_length != 4 ) {
1141+ ND_PRINT ("\n\t Bogus SRMS Preference TLV length %u != 4" , tlv_length );
1142+ return (ls_end );
1143+ }
1144+ ND_PRINT ("\n\t SRMS Preference: %u" , GET_U_1 (tptr ));
1145+ break ;
1146+
11101147 default :
11111148 if (ndo -> ndo_vflag <= 1 ) {
11121149 if (!print_unknown_data (ndo , tptr , "\n\t " , tlv_length ))
0 commit comments