Do we have such functionality already in the iperf?
Funny you should ask. It is not currently there, but I was just looking for it
yesterday. (I put it on my list to consider adding to bwctl, so I was looking to
see if iperf had it yet.)
In fact, it should be fairly trivial to add using the sockopt SO_BINDTODEVICE.
But, it would probably be easier to implement using actual interface names such
as eth0, etc.
Given the interface address, it would be possible to see what addresses are
currently configured on each interface and then do this. But, I'm not sure it is
worth it. (There are some potentially complex cases.)
I'm off on vacation for the next couple of days, but if no one as done this by
the time I get back I will take a look.