Skip to content

Feature Request: Pure UDP Mode (No TCP) #1830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gryphon2411 opened this issue Feb 11, 2025 · 2 comments
Open

Feature Request: Pure UDP Mode (No TCP) #1830

gryphon2411 opened this issue Feb 11, 2025 · 2 comments

Comments

@gryphon2411
Copy link

Hi iperf3 team,

First of all, thanks for the amazing iperf3.

A quick request: could we get an option for UDP tests to disable the TCP control channel (e.g. --pure-udp)?

This is needed for environments where any TCP is blocked (firewalls, TCP-restricted connections etc.), unlike iperf2.

This would be incredibly helpful, since there is no other solution but to use iperf2.

Thanks a lot for considering.

@davidBar-On
Copy link
Contributor

davidBar-On commented Feb 22, 2025

@gryphon2411, I submitted PR #1843 that adds support for a UDP control socket, so no UDP should be used. It will be useful if you can test this PR and see that it does work in your system that blocks TCP.

As I commented in the PR, I am not sure about the reliability of the control interface between the server and the client, as packets over UDP socket may be lost. It will also be useful if you can comment about that (assuming that you can run the PR code successfully).

@gryphon2411
Copy link
Author

gryphon2411 commented May 3, 2025

Hi @davidBar-On,

Thank you for submitting PR #1843 and for the work on this feature!

Following your request, I've put together a Docker Compose environment to test the new --udp-control flag.

The included run-tests.sh script successfully demonstrates the intended functionality:

  1. Baseline iperf2 UDP test succeeds.
  2. The test simulating standard iperf3 (client without --udp-control) correctly fails against the PR server (using --udp-control).
  3. The test using the PR build with --udp-control on both client and server succeeds.

This confirms the basic operation of the UDP control channel feature.

While noting @swlars' comment regarding potential test divergence and prioritization, this test confirms the --udp-control flag functions as expected to enable UDP tests in environments where TCP control is not feasible.

Details and files for reproduction are below:

Dockerfile

# Dockerfile
FROM alpine:latest

# Install build tools, runtime libs, iperf2, and iproute2
RUN apk update && apk add --no-cache \
    build-base git autoconf automake libtool libstdc++ iperf iproute2

# Clone iperf3 repo and checkout PR #1843 branch
RUN git clone https://github.com/esnet/iperf.git /opt/iperf3-src && \
    cd /opt/iperf3-src && \
    git fetch origin pull/1843/head:pr1843 && git checkout pr1843

WORKDIR /opt/iperf3-src

# Configure and Compile iperf3 from PR source
RUN ./configure && make

# Install iperf3
RUN make install

# Rename installed binary to avoid conflicts and identify PR version
RUN mv /usr/local/bin/iperf3 /usr/local/bin/iperf3-pr1843

# Add run-tests.sh to the container and make it executable
COPY run-tests.sh /usr/local/bin/run-tests.sh
RUN chmod +x /usr/local/bin/run-tests.sh

# Clean up build dependencies and source files
RUN apk del build-base git autoconf automake libtool && \
    rm -rf /var/cache/apk/* /opt/iperf3-src

WORKDIR /

CMD ["/bin/sh"]

docker-compose.yml

services:
  iperf2-server:
    build: .
    image: iperf3-pr1843-test:latest
    container_name: iperf2-server
    command: sh -c "iperf -s -u"
    networks:
      - iperf-net

  iperf3-server:
    build: .
    image: iperf3-pr1843-test:latest
    container_name: iperf3-pr1843-server
    command: >
      sh -c "iperf3-pr1843 -s --udp-control"
    networks:
      - iperf-net

  iperf-client:
    build: .
    image: iperf3-pr1843-test:latest
    container_name: iperf-client
    command: /usr/local/bin/run-tests.sh
    depends_on:
      - iperf2-server
      - iperf3-server
    networks:
      - iperf-net

networks:
  iperf-net:
    driver: bridge

run-tests.sh

#!/bin/sh

# Exit immediately if a command exits with a non-zero status.
set -e

echo ""
echo "Tests starting..."

sleep 5 # Initial wait for servers

# --- Test 1 ---
CMD1="iperf -c iperf2-server -u -b 10M -t 5"
echo ""
echo "$CMD1"
$CMD1
sleep 2

# --- Test 2 ---
CMD2="iperf3-pr1843 -c iperf3-server -u -b 10M -t 3"
echo ""
echo "$CMD2"
set +e # Expect failure
$CMD2
EXIT_CODE=$?
set -e # Re-enable exit on error
if [ $EXIT_CODE -ne 0 ]; then
  echo "[Note: Command failed as expected with exit code $EXIT_CODE]"
fi
sleep 2

# --- Test 3 ---
CMD3="iperf3-pr1843 -c iperf3-server -u --udp-control -b 10M -t 5"
echo ""
echo "$CMD3"
$CMD3

echo ""
echo "Tests finished."

How to run:

# (In directory with the 3 files)
docker compose down --remove-orphans -v
docker compose build
docker compose up -d iperf2-server iperf3-server
docker compose run --rm iperf-client
docker compose down --remove-orphans -v

Hope this test setup is helpful. Thanks again for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants