@@ -2261,22 +2261,50 @@ int smp_fetch_fc_rcvd_proxy(const struct arg *args, struct sample *smp, const ch
22612261
22622262/*
22632263 * This function checks the TLV type converter configuration.
2264- * It expects the corresponding TLV type as a string representing the number.
2265- * args[0] will be turned into the numerical value of the TLV type string.
2264+ * It expects the corresponding TLV type as a string representing the number
2265+ * or a constant. args[0] will be turned into the numerical value of the
2266+ * TLV type string.
22662267 */
22672268static int smp_check_tlv_type (struct arg * args , char * * err )
22682269{
22692270 int type ;
22702271 char * endp ;
2271-
2272- type = strtoul (args [0 ].data .str .area , & endp , 0 );
2273- if (endp && * endp != '\0' ) {
2274- memprintf (err , "Could not convert type '%s'" , args [0 ].data .str .area );
2275- return 0 ;
2272+ struct ist input = ist2 (args [0 ].data .str .area , args [0 ].data .str .data );
2273+
2274+ if (isteqi (input , ist ("ALPN" )) != 0 )
2275+ type = PP2_TYPE_ALPN ;
2276+ else if (isteqi (input , ist ("AUTHORITY" )) != 0 )
2277+ type = PP2_TYPE_AUTHORITY ;
2278+ else if (isteqi (input , ist ("CRC32C" )) != 0 )
2279+ type = PP2_TYPE_CRC32C ;
2280+ else if (isteqi (input , ist ("NOOP" )) != 0 )
2281+ type = PP2_TYPE_NOOP ;
2282+ else if (isteqi (input , ist ("UNIQUE_ID" )) != 0 )
2283+ type = PP2_TYPE_UNIQUE_ID ;
2284+ else if (isteqi (input , ist ("SSL" )) != 0 )
2285+ type = PP2_TYPE_SSL ;
2286+ else if (isteqi (input , ist ("SSL_VERSION" )) != 0 )
2287+ type = PP2_SUBTYPE_SSL_VERSION ;
2288+ else if (isteqi (input , ist ("SSL_CN" )) != 0 )
2289+ type = PP2_SUBTYPE_SSL_CN ;
2290+ else if (isteqi (input , ist ("SSL_CIPHER" )) != 0 )
2291+ type = PP2_SUBTYPE_SSL_CIPHER ;
2292+ else if (isteqi (input , ist ("SSL_SIG_ALG" )) != 0 )
2293+ type = PP2_SUBTYPE_SSL_SIG_ALG ;
2294+ else if (isteqi (input , ist ("SSL_KEY_ALG" )) != 0 )
2295+ type = PP2_SUBTYPE_SSL_KEY_ALG ;
2296+ else if (isteqi (input , ist ("NETNS" )) != 0 )
2297+ type = PP2_TYPE_NETNS ;
2298+ else {
2299+ type = strtoul (input .ptr , & endp , 0 );
2300+ if (endp && * endp != '\0' ) {
2301+ memprintf (err , "Could not convert type '%s'" , input .ptr );
2302+ return 0 ;
2303+ }
22762304 }
22772305
22782306 if (type < 0 || type > 255 ) {
2279- memprintf (err , "Invalid TLV Type '%s'" , args [ 0 ]. data . str . area );
2307+ memprintf (err , "Invalid TLV Type '%s'" , input . ptr );
22802308 return 0 ;
22812309 }
22822310
0 commit comments