bwctld has been developed as a classic accept/fork daemon. The master daemon process listens for new network connections and also manages the resources for all child bwctld processes. Once a connection comes in, bwctld forks a child process to handle that request. The child process deals with all encryption and communication issues with the client, as well as dealing with all static resource limits. Static resource limits are the limits that are not dependent upon what is currently happening on the node. i.e. The request broker can easily determine if the given client is allowed to do UDP tests without talking to the master daemon. Once the request broker process determines the request is valid it makes are request to the master daemon for the resources and time period requested by the client. If the master daemon has the resources available (including the open time period) it grants the request.
The time period for the test is always requested by the client. It makes a request to the request broker process on each endpoint of the test in turn. The time period is requested by specifying two timestamps. The earliest time and the latest time the client is willing to settle for. The request broker returns a tentative reservation with the first open time that will fulfill the parameters of the test, or a request denied message. The client can then use the tentative reservation time as the earliest time in the request to the request broker on the other host. Eventually, an agreed upon time will be reached or the latest time will be reached. If the request broker can not fulfill the request before the latest time specified in the request it will return a server too busy message. If the client gets the same time from both servers, it must then confirm the reservation with a start session message within a configurable timeout period at least before the reservation time.
Once the client sends the the start session message, the request broker forks off a peer agent that is responsible for verifying the time offset to the other endpoint of the test and initializing the communication socket that will be used to trade results of the test.
If the test endpoint systems have a reasonably close idea of the time, and they can communicate, the peer agent forks off the test process. The test process waits until the scheduled start time and then executes iperf with the correct command-line. (Experience is showing that a closer integration with the testing process (iperf) may be needed in the future.)
The image above shows a dashed blue line around the processes that occur on each host. Currently the client is constrained to one of the given hosts, but that is a limitation that is likely to go away. (This will probably only be available for AES authenticated requests. If this is done for IP/netmask authenticated transactions it opens BWCTL up as a likely target to generate DOS attacks.)