-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix --bind-dev options for TCP streams. (#1099) #1153
Conversation
netdial() honors --bind-dev option but iperf_tcp_connect() doesn't, as a result, only the control socket is bound to the device, but not the data socket. Instead of duplicaing code from netdial to iperf_tcp_connect(), this fix extracts a common util function create_socket() from netdial() and let iperf_tcp_connect() call create_socket() to create a socket with optional bindings. Tested on Raspberry Pi 3 with eth0 and wlan0.
The create_socket lines are really long and should be split across multiple lines, but the logic itself seems good and worked for me in my testing. |
esnet#1153 From: Shuo Chen <chenshuo@chenshuo.com> Date: Thu, 27 May 2021 14:24:07 -0700 Subject: [PATCH] Fix --bind-dev options for TCP streams. (esnet#1099) netdial() honors --bind-dev option but iperf_tcp_connect() doesn't, as a result, only the control socket is bound to the device, but not the data socket. Instead of duplicaing code from netdial to iperf_tcp_connect(), this fix extracts a common util function create_socket() from netdial() and let iperf_tcp_connect() call create_socket() to create a socket with optional bindings. Tested on Raspberry Pi 3 with eth0 and wlan0. Signed-off-by: David Ahern <dsahern@gmail.com>
esnet/iperf#1153 From: Shuo Chen <chenshuo@chenshuo.com> Date: Thu, 27 May 2021 14:24:07 -0700 Subject: [PATCH] Fix --bind-dev options for TCP streams. (#1099) netdial() honors --bind-dev option but iperf_tcp_connect() doesn't, as a result, only the control socket is bound to the device, but not the data socket. Instead of duplicaing code from netdial to iperf_tcp_connect(), this fix extracts a common util function create_socket() from netdial() and let iperf_tcp_connect() call create_socket() to create a socket with optional bindings. Tested on Raspberry Pi 3 with eth0 and wlan0. Signed-off-by: David Ahern <dsahern@gmail.com>
esnet/iperf#1153 From: Shuo Chen <chenshuo@chenshuo.com> Date: Thu, 27 May 2021 14:24:07 -0700 Subject: [PATCH] Fix --bind-dev options for TCP streams. (#1099) netdial() honors --bind-dev option but iperf_tcp_connect() doesn't, as a result, only the control socket is bound to the device, but not the data socket. Instead of duplicaing code from netdial to iperf_tcp_connect(), this fix extracts a common util function create_socket() from netdial() and let iperf_tcp_connect() call create_socket() to create a socket with optional bindings. Tested on Raspberry Pi 3 with eth0 and wlan0. Signed-off-by: David Ahern <dsahern@gmail.com>
Thanks for the PR! I've been playing with this. So far so good. Recording my test setup for posterity: Server: FreeBSD 13.0-RELEASE, vtnet0 10.0.2.7/24 (management), vtnet1 192.168.156.102/24 On the server, do On the client, do On the client do With stock With the patch in this PR, binding to enp0s8 should still give the same results as not binding at all, but binding to enp0s9 should get all of the packets to go over enp0s9. (This seems to be what's happening, thus "so far so good".) Now going to study the code changes. Thanks for the remarks in the PR about your approach to the problem, that tells me what to look for and how to interpret the diffs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great...it seems to work and I understand what you did. I especially like that the code is now shorter.
netdial() honors --bind-dev option but iperf_tcp_connect() doesn't,
as a result, only the control socket is bound to the device, but not
the data socket.
Instead of duplicaing code from netdial to iperf_tcp_connect(), this
fix extracts a common util function create_socket() from netdial() and
let iperf_tcp_connect() call create_socket() to create a socket with
optional bindings.
Tested on Raspberry Pi 3 with eth0 and wlan0.
Version of iperf3 (or development branch, such as
master
or3.1-STABLE
) to which this pull request applies:Issues fixed (if any): Bind to non-primary interface seems to not work #1099
Brief description of code changes (suitable for use as a commit message):
See above.