diff --git a/doc/userguide/upgrade.rst b/doc/userguide/upgrade.rst index e66dc70aa6..564f8198b2 100644 --- a/doc/userguide/upgrade.rst +++ b/doc/userguide/upgrade.rst @@ -57,6 +57,10 @@ Logging Changes - Alert verdict key is changed from to ``reject-target`` to ``reject_target`` +- App-layer stats protocols names replace dash by underscore, meaning + ``stats.app_layer.*.ftp-data`` becomes ``stats.app_layer.*.ftp_data``, + and same for bittorrent_dht + Other Changes ~~~~~~~~~~~~~ - ``engine-analysis`` output has been changed for keywords that now use the generic integers framework diff --git a/etc/schema.json b/etc/schema.json index c13808ce16..4767aff34a 100644 --- a/etc/schema.json +++ b/etc/schema.json @@ -5736,7 +5736,7 @@ "type": "object", "additionalProperties": false, "properties": { - "bittorrent-dht": { + "bittorrent_dht": { "description": "Errors encountered parsing BitTorrent DHT protocol", "$ref": "#/$defs/stats_applayer_error" @@ -5784,7 +5784,7 @@ "description": "Errors encountered parsing FTP", "$ref": "#/$defs/stats_applayer_error" }, - "ftp-data": { + "ftp_data": { "description": "Errors encountered parsing FTP data", "$ref": "#/$defs/stats_applayer_error" }, @@ -5914,7 +5914,7 @@ "type": "object", "additionalProperties": false, "properties": { - "bittorrent-dht": { + "bittorrent_dht": { "type": "integer", "description": "Number of flows for BitTorrent DHT protocol" }, @@ -5965,7 +5965,7 @@ "type": "integer", "description": "Number of flows for FTP" }, - "ftp-data": { + "ftp_data": { "type": "integer", "description": "Number of flows for FTP data protocol" }, @@ -6093,7 +6093,7 @@ "type": "object", "additionalProperties": false, "properties": { - "bittorrent-dht": { + "bittorrent_dht": { "type": "integer", "description": "Number of transactions for BitTorrent DHT protocol" @@ -6137,7 +6137,7 @@ "type": "integer", "description": "Number of transactions for FTP" }, - "ftp-data": { + "ftp_data": { "type": "integer", "description": "Number of transactions for FTP data protocol" }, diff --git a/src/app-layer.c b/src/app-layer.c index 3237fb6396..e5c075ccb9 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -1240,7 +1240,16 @@ void AppLayerSetupCounters(void) for (AppProto alproto = 0; alproto < g_alproto_max; alproto++) { if (alprotos[alproto] == 1) { const char *tx_str = "app_layer.tx."; - const char *alproto_str = AppLayerGetProtoName(alproto); + const char *alproto_raw = AppLayerGetProtoName(alproto); + char alproto_str[32]; + for (size_t i = 0; i < 32; i++) { + alproto_str[i] = alproto_raw[i]; + if (alproto_str[i] == 0) { + break; + } else if (alproto_str[i] == '-') { + alproto_str[i] = '_'; + } + } memset(ipprotos_all, 0, sizeof(ipprotos_all)); AppLayerProtoDetectSupportedIpprotos(alproto, ipprotos_all);