Skip to content

Conversation

@scottlamb
Copy link

PLEASE NOTE the following text from the iperf3 license. Submitting a
pull request to the iperf3 repository constitutes "[making]
Enhancements available...publicly":

You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to Lawrence Berkeley National
Laboratory, without imposing a separate written license agreement for such
Enhancements, then you hereby grant the following license: a non-exclusive,
royalty-free perpetual license to install, use, modify, prepare derivative
works, incorporate into other computer software, distribute, and sublicense
such enhancements or derivative works thereof, in binary and source code form.

The complete iperf3 license is available in the LICENSE file in the
top directory of the iperf3 source tree.

  • Version of iperf3 (or development branch, such as master or
    3.1-STABLE) to which this pull request applies: master

  • Issues fixed (if any): none that I see

  • Brief description of code changes (suitable for use as a commit message): support --bind-dev on macOS

@bmah888
Copy link
Contributor

bmah888 commented Sep 26, 2025

Thanks for the pull request! Any suggestions on how to test this?

@scottlamb
Copy link
Author

Any suggestions on how to test this?

Hmm, not really because I don't know the status quo well, other than seeing there's a test_commands.sh in the repo (that does not appear to exercise --bind-dev on Linux). Are these manually run/evaluated as part of release qualification?

On my own system, I have a wifi interface en0 and often plug into a dock with a 2.5Gbps interface as en10, so I can see a dramatic difference in bitrate depending on which I choose as shown below. (fwiw, the syntax src/iperf3 --client slamb-workstation.home.slamb.org%en10 seems to have the same effect.)

[slamb@slamb-mbp ~/git/iperf]$ src/iperf3 --bind-dev en0 --client slamb-workstation.home.slamb.org
Connecting to host slamb-workstation.home.slamb.org, port 5201
[  7] local 192.168.1.218 port 57592 connected to 192.168.1.244 port 5201
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-1.01   sec  55.5 MBytes   463 Mbits/sec
[  7]   1.01-2.01   sec  56.0 MBytes   470 Mbits/sec
[  7]   2.01-3.01   sec  55.0 MBytes   461 Mbits/sec
[  7]   3.01-4.01   sec  50.5 MBytes   424 Mbits/sec
[  7]   4.01-5.01   sec  48.9 MBytes   410 Mbits/sec
[  7]   5.01-6.01   sec  48.2 MBytes   405 Mbits/sec
[  7]   6.01-7.01   sec  50.9 MBytes   427 Mbits/sec
[  7]   7.01-8.01   sec  52.9 MBytes   444 Mbits/sec
[  7]   8.01-9.01   sec  52.4 MBytes   439 Mbits/sec
[  7]   9.01-10.01  sec  53.1 MBytes   446 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-10.01  sec   523 MBytes   439 Mbits/sec                  sender
[  7]   0.00-10.01  sec   522 MBytes   437 Mbits/sec                  receiver

iperf Done.
[slamb@slamb-mbp ~/git/iperf]$ src/iperf3 --bind-dev en10 --client slamb-workstation.home.slamb.org
Connecting to host slamb-workstation.home.slamb.org, port 5201
[  7] local 192.168.1.148 port 57594 connected to 192.168.1.244 port 5201
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-1.01   sec   284 MBytes  2.37 Gbits/sec
[  7]   1.01-2.01   sec   280 MBytes  2.35 Gbits/sec
[  7]   2.01-3.01   sec   281 MBytes  2.35 Gbits/sec
[  7]   3.01-4.01   sec   280 MBytes  2.35 Gbits/sec
[  7]   4.01-5.01   sec   281 MBytes  2.35 Gbits/sec
[  7]   5.01-6.01   sec   281 MBytes  2.35 Gbits/sec
[  7]   6.01-7.01   sec   279 MBytes  2.34 Gbits/sec
[  7]   7.01-8.01   sec   282 MBytes  2.37 Gbits/sec
[  7]   8.01-9.01   sec   281 MBytes  2.35 Gbits/sec
[  7]   9.01-10.01  sec   280 MBytes  2.35 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  7]   0.00-10.01  sec  2.74 GBytes  2.36 Gbits/sec                  sender
[  7]   0.00-10.01  sec  2.74 GBytes  2.35 Gbits/sec                  receiver

iperf Done.
[slamb@slamb-mbp ~/git/iperf]$

It seems possible in principle to set up one or more fake NICs in some way or another on macOS, so that it can be tested without any particular hardware/network setup. I found this stackoverflow discussion about feth0/feth1. I'm playing with them a bit now and kinda struggling to make them work exactly as I expect. Or there's the better-documented utun devices, though you need a userspace program running to actually pass the packets between.

...and then maybe shape the traffic with something like pfctl+dummynet to change the observed rate/success/whatever (or do that from the program managing the utun devices).

...but these things are at least fiddly to set up properly and the feth devices are totally undocumented. Not sure if this is the kind of thing you're looking for.

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

Successfully merging this pull request may close these issues.

2 participants