rtbrick / bngblaster

The BNG Blaster is an open-source network tester for access and routing protocols.
https://rtbrick.github.io/bngblaster/
BSD 3-Clause "New" or "Revised" License
210 stars 34 forks source link

start-rate configuration is ineffective #284

Closed olivier-matz-6wind closed 1 month ago

olivier-matz-6wind commented 1 month ago

Bug description

The "start-rate" configuration in "sessions" section seems to have no effect. If we set the rate to 1 session per second, the effective rate is much higher.

To Reproduce

Version (bngblaster -v):

Version: 0.9.6
Compiler: GNU (11.4.0)
IO Modes: packet_mmap_raw (default), packet_mmap, raw

JSON configuration:

{
    "interfaces": {
        "qdisc-bypass": false,
        "access": [
        {
            "interface": "eth0",
            "type": "ipoe",
            "vlan-mode": "N:1"
        }
    ]
    },
    "dhcp": {
        "enable": true
    },
    "dhcpv6": {
        "enable": false
    },
    "access-line": {
    },
    "sessions": {
        "max-outstanding": 500,
        "start-rate": 1,
        "stop-rate": 1,
        "reconnect": true,
        "count": 10000
    },
    "ipoe": {
        "ipv4": true,
        "ipv6": false
    }
}

Expected behavior

The start rate should be limited to 1 session/s.

Additional context

Looking at the code, we can indeed see that bbl_ctrl_job() (which is called every second if my understanding is correct) only decrements the "rate" variable in case of teardown, but there is no such mechanism for session setup. Adding it would actually limit the number of session setups per second, but it would maybe be too "bursty". For instance, if the rate is 100, bngblaster would create a burst of 100 sessions every second.

I'm aware that the "max-outstanding" could also help to limit the rate.

GIC-de commented 1 month ago

This issue is fixed in latest dev branch and will be included in next release.