-
Notifications
You must be signed in to change notification settings - Fork 12
msg-sim revamp, Linux support only
#152
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
base: main
Are you sure you want to change the base?
Conversation
0c2e625 to
98c5751
Compare
98c5751 to
acb2d38
Compare
msg-sim/README.md
Outdated
| sudo ifconfig lo0 mtu 16384 | ||
| # Remove the dummynet pipes | ||
| sudo dnctl pipe delete 1 | ||
| sudo HOME=$HOME $(which cargo) test # add your arguments here |
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.
I'm not super liking this - isn't there a better way? Maybe asking capabilities from the kernel? Or elevate priviledges inside the binary
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.
I hear that. This has been a forever pain point since I started using namespaces. Using plain sudo is just bad and I know. But you need the capabilities to fiddle with the networking stack, like CAP_NET_ADMIN (and something more). So an approach I tried briefly is to first compile the test binaries (--no-run flag), identify them, grant privileges with sudo, and then run them.
Still not incredible DX, so I'm postponing the problem for now until I think of something better.
Needed for a very helpful HashMap::get_disjoint_mut
db13e1c to
36632e9
Compare
36632e9 to
593f2c6
Compare
4e8aae7 to
2442bf3
Compare
Supersedes #72.
This PR is a complete re-work of the
msg-simcrate. First, MacOS support has been dropped. This allows to focus more on the networking stack we're the most interested in and maximise the feature completeness of the crate itself. Then, compared #72, this approach doesn't rely on wrappers over thetcbinary but creates appropriatertnetlinkrequests to manipulate the networking stack of the host. Moreover, the library offers an API to create a network of veth-linked devices where impairments can be added to individual links. Each "peer" in the network has a dedicated network device which lives in a completely isolated network namespace, so we can guarantee no interferences with the host environment.The network follows a central hub topology, where there is a namespace with a single bridge/switch where all peers veth devices attach to. This is the simplest design to allow discovery and network impairments between any two peers.
The
Networkabstraction is flexible enough to allow running arbitrary code tasks in the network namespace of the selected peer, without the need to create additional processes, runtimes etc each time.Here is an example of how it looks like in action, with a 1s latency impairment (from a test):
As of now, the impairments supported are the one provided by
netem(8). That includes latency, limit, loss, gap, duplicate and jitter.