in src/parameter.c [237:378]
int verify_args(struct ntttcp_test *test)
{
if (test->server_role && test->client_role) {
PRINT_ERR("both sender and receiver roles provided");
return ERROR_ARGS;
}
if (!strcmp(test->mapping, "")) {
PRINT_ERR("no mapping provided");
return ERROR_ARGS;
}
if (test->domain == AF_INET6 && strcmp(test->bind_address, "0.0.0.0") == 0)
test->bind_address = "::";
if (test->domain == AF_INET6 && !strstr(test->bind_address, ":")) {
PRINT_ERR("invalid ipv6 address provided");
return ERROR_ARGS;
}
if (test->domain == AF_INET && !strstr(test->bind_address, ".")) {
PRINT_ERR("invalid ipv4 address provided");
return ERROR_ARGS;
}
if (!test->server_role && !test->client_role) {
PRINT_INFO("no role specified. use receiver role");
test->server_role = true;
}
if (test->client_role && test->multi_clients_mode) {
PRINT_ERR("multi-clients mode ('-M') is only for receiver role");
return ERROR_ARGS;
}
if (test->server_role && test->last_client) {
PRINT_ERR("last-client ('-L') is only for sender role");
return ERROR_ARGS;
}
if (test->server_ports > MAX_NUM_SERVER_PORTS) {
PRINT_INFO("too many number-of-server-ports. use the max value");
test->server_ports = MAX_NUM_SERVER_PORTS;
}
if (test->client_role && test->threads_per_server_port > MAX_THREADS_PER_SERVER_PORT) {
PRINT_INFO("too many threads-per-server-port. use the max value");
test->threads_per_server_port = MAX_THREADS_PER_SERVER_PORT;
}
if (test->client_role && test->conns_per_thread > MAX_CLIENT_CONNS_PER_THREAD) {
PRINT_INFO("too many connections-per-thread. use the max value");
test->conns_per_thread = MAX_CLIENT_CONNS_PER_THREAD;
}
if (test->server_ports < 1) {
PRINT_INFO("invalid number-of-server-ports provided. use 1");
test->server_ports = 1;
}
if (test->client_role && test->threads_per_server_port < 1) {
PRINT_INFO("invalid threads-per-server-port provided. use 1");
test->threads_per_server_port = 1;
}
if (test->client_role && test->conns_per_thread < 1) {
PRINT_INFO("invalid connections-per-thread provided. use 1");
test->conns_per_thread = 1;
}
if (test->client_role) {
if (test->use_epoll)
PRINT_DBG("ignore '-e' on sender role");
if (!test->exit_after_done)
PRINT_DBG("ignore '-H' on sender role");
}
if (test->server_role) {
if (test->client_base_port > 0)
PRINT_DBG("ignore '-f' on receiver role");
if (test->bandwidth_limit != 0)
PRINT_DBG("ignore '-B' on receiver role");
}
if (test->client_role) {
if (test->client_base_port > 0 && test->client_base_port <= 1024) {
test->client_base_port = DEFAULT_BASE_SRC_PORT;
PRINT_DBG("source port is too small. use the default value");
}
if ((int)(MAX_LOCAL_IP_PORT - test->client_base_port) <
(int)(test->server_ports * test->threads_per_server_port * test->conns_per_thread)) {
PRINT_ERR("source port is too high to provide a sufficient range of ports for your test");
}
if (test->bandwidth_limit != 0)
PRINT_INFO("Warning! '-B' is specified and the network bandwidth may be limited");
if (test->fq_rate_limit != 0)
PRINT_INFO("Warning! '--fq-rate-limit' is specified and the network bandwidth may be limited");
if (test->bandwidth_limit != 0 && test->fq_rate_limit != 0) {
PRINT_INFO("ignore '--fq-rate-limit' as '-B' is specified");
test->fq_rate_limit = 0;
}
}
if (test->protocol == UDP && test->send_buf_size > MAX_UDP_SEND_SIZE) {
PRINT_INFO("the UDP send size is too big. use the max value");
test->send_buf_size = MAX_UDP_SEND_SIZE;
}
if (test->show_interface_packets[0] == '-') {
PRINT_INFO("invalid network interface provided. ignore it");
test->show_interface_packets = "";
}
if (test->show_dev_interrupts[0] == '-') {
PRINT_INFO("invalid interrupt device provided. ignore it");
test->show_dev_interrupts = "";
}
if (test->duration < 0) {
test->duration = DEFAULT_TEST_DURATION;
PRINT_INFO("invalid test duration provided. use the default value");
}
if (test->duration == 0) {
PRINT_INFO("running test in continuous mode. please monitor throughput by other tools");
}
if (test->warmup < 0) {
test->warmup = DEFAULT_WARMUP_SEC;
PRINT_INFO("invalid test warm-up seconds provided. use the default value");
}
if (test->cooldown < 0) {
test->cooldown = DEFAULT_COOLDOWN_SEC;
PRINT_INFO("invalid test cool-down seconds provided. use the default value");
}
return NO_ERROR;
}