diff --git a/code/bngblaster/src/bbl_config.c b/code/bngblaster/src/bbl_config.c index dfe255e4..9a7e0ab0 100644 --- a/code/bngblaster/src/bbl_config.c +++ b/code/bngblaster/src/bbl_config.c @@ -1636,6 +1636,33 @@ json_parse_stream(json_t *stream, bbl_stream_config_s *stream_config) } stream_config->pps = bps / (stream_config->length * 8); } + value = json_object_get(stream, "Kbps"); + if(value) { + bps = json_number_value(value); + if(!bps) { + fprintf(stderr, "JSON config error: Invalid value for stream->Kbps\n"); + return false; + } + stream_config->pps = (bps*1000) / (stream_config->length * 8); + } + value = json_object_get(stream, "Mbps"); + if(value) { + bps = json_number_value(value); + if(!bps) { + fprintf(stderr, "JSON config error: Invalid value for stream->Mbps\n"); + return false; + } + stream_config->pps = (bps*1000000) / (stream_config->length * 8); + } + value = json_object_get(stream, "Gbps"); + if(value) { + bps = json_number_value(value); + if(!bps) { + fprintf(stderr, "JSON config error: Invalid value for stream->Gbps\n"); + return false; + } + stream_config->pps = (bps*1000000000) / (stream_config->length * 8); + } } if(!stream_config->pps) stream_config->pps = 1; diff --git a/docsrc/sources/configuration/streams.rst b/docsrc/sources/configuration/streams.rst index 407a1b99..697b1e53 100644 --- a/docsrc/sources/configuration/streams.rst +++ b/docsrc/sources/configuration/streams.rst @@ -109,7 +109,11 @@ and inner IPv4 header. The ``pps`` option supports also float numbers like 0.1, or 2.5 PPS and has priority over ``bps`` where the second is only a helper to calculate the ``pps`` -based on given ``bps`` and ``length``. +based on given ``bps`` and ``length``. The resulting rate in ``bps`` is the +layer 3 rate because ``length`` is also the layer 3 length (IP header + payload). +It is also supported to put the capital letters ``K`` (Kilo), ``M`` (Mega) +or ``G`` (Giga) in front of ``bps`` for better readability. +For example ``"Gbps": 1`` which is equal to ``"bps": 1000000000``. The options ``access-ipv4-source-address`` and ``access-ipv6-source-address`` can be used to test the BNG RPF functionality with traffic sent from source addresses