Skip to content
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

bwtest NAT support #47

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

mirabilos
Copy link
Contributor

On top of the changes in #46 this adds NAT support to the bandwidth tester:

  • the receiver now only gets its local port to listen to as command line argument and binds to INADDR_ANY on this port
    • the background thread is not yet started
    • the outgoing feedback sockaddr_in is initialised with AF_UNSPEC to signal it’s not fully initialised yet
  • the sender binds to a local ephemeral address and contacts the server by means of its “decoder” IP and port (unchanged)
  • the receiver gets the first packet and looks at the sender information from recvfrom(2) / recvmsg(2) msg_name and “records” that as outgoing feedback address
    • it also displays which IP:port the “connection” comes from
    • the background thread is then started
  • any further packets have their sender IP/port checked against the saved address and are verbosely discarded if they don’t match, to avoid mixing different senders in the same receiver program

This has been tested with the receiver on a public IPv4 and the sender behind NAT; it should also work with the sender behind multiple NATs as on Campus-IT PoC.

The totally inefficient and not-working NAT punching from the existing code has been removed as well.

mirabilos and others added 30 commits June 30, 2020 13:37
• whitespace cleanup / harmonisation
• const
• some ordering without side effects
• comments
• correct type *_MAX constant
still works:
 58.1  Transmit rate = 202059kbps, PLR =  0.00%( 0.00%), RTT = 0.000s, Queue delay = 0.000s
some contributors use git implementations that utterly hose symlinks
@mirabilos
Copy link
Contributor Author

I’ve added -reverse mode, in which the receiver may be behind NAT and connects to the sender, which waits for a dummy packet (sent by the receiver in a new temporary preconnect thread) and then sends to the IP/port where the dummy packet came from.

This makes it possible to test asymmetric connections that are one-sided behind NAT.

@IngJohEricsson
Copy link
Contributor

IngJohEricsson commented Jun 30, 2022 via email

@mirabilos
Copy link
Contributor Author

mirabilos commented Jun 30, 2022 via email

only variables of volatile sig_atomic_t type are signal-safe…
@IngJohEricsson
Copy link
Contributor

Hi
This one got stuck a little too long. Is it possible that you can do a new pull request based on the latest code ? I understand that the NAT handling stuff is very useful so it would definitely be goo to have it in
/Ingemar

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.

3 participants