This example demonstrates use of the iperf library in KasperskyOS.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/iperf_separate_vfs
List of programs
Server – application that performs the functions of a network server using the iperf library. The application initializes the network connection and runs the network performance test in server mode.VfsNet – system program that supports network protocols.DCM – system program that lets you dynamically create IPC channels.EntropyEntity – system program that implements random number generation.DNetSrv – network card driver.When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:
BSP is a hardware platform support package (Board Support Package). Provides cross-platform configuration of peripherals for the Radxa ROCK 3A.Bcm2711MboxArmToVc – driver for working with the VideoCore (VC6) coprocessor via mailbox technology for Raspberry Pi 4 B.Initialization description
The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@ format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.
Security policy description
The security.psl file contains a description of a security policy for a KasperskyOS-based solution and is located in the ./einit/src directory. The declarations in the PSL file are provided with comments that explain the purpose of these declarations.
Resources
The ./resources/xdl/iperf_separate_vfs directory contains the Server.edl file, which is the EDL description of the Server program.
Operating scenario
The Server program performs the following actions:
DEFAULT_INTERFACE macro and with the timeout specified by the DEFAULT_TIMEOUT macro.DEFAULT_ADDR macro and the subnet mask specified by the DEFAULT_MASK macro.iperf_new_test() function.iperf_defaults() function.iperf_parse_arguments() function.run_test() function.iperf_free_test() function and exits the program with the EXIT_SUCCESS code upon successful termination.Building and running the example
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
By default, the example uses network software emulation (SLIRP) in QEMU. If you configured TAP interfaces for QEMU, you need to change the network settings for starting QEMU (QEMU_FLAGS variable) in the ./einit/CMakeLists.txt file to make sure that the example works correctly (for more details, see the comments in the file).
The example does not use DHCP, therefore the IP address of the network interface must be manually indicated in the code of the Server program (./server/src/main.cpp). SLIRP uses the default values.
The iperf library in the example is used in server mode. To connect to this server, install the iperf3 program on the host machine and run it by using the iperf3 -c localhost command. If you configured TAP interfaces, indicate the current IP address instead of localhost.
The first startup of the example may take a long time because the iperf client uses /dev/urandom to fill packets with random data. To avoid this, run the iperf client with the --repeating-payload parameter.
See Building and running examples section.
Page top