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.
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.
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
mempirate
left a comment
There was a problem hiding this comment.
Lgtm. I mainly reviewed the architecture and didn't go into TC and netem specifics too much, if it works it's good. 2 points:
- Maybe add an extensive, real-world example somewhere in the
msg/examplesrepo. It should be realistic. - I'd like a builder pattern on LinkImpairment, like
LinkImpairment::default().with_latency(x).with_bandwidth(y). But can be in a follow-up if you want
|
|
||
| let class_request = DrrClassRequest::new( | ||
| QdiscRequestInner::new(if_index) | ||
| .with_parent(TcHandle::from(0x0001_0000)) // Parent: drr root (1:0) |
There was a problem hiding this comment.
I think you have this as a constans somewhere already? Or maybe as a function...
In any case, I'd say it's best to have a unified definition where possible
1f2fad8 to
645fc20
Compare
Code reviewI found 2 issues related to CLAUDE.md compliance: Issue 1: MSRV Documentation Mismatch
Issue 2: macOS Support Documentation No Longer Accurate
See links: |
645fc20 to
b0310d0
Compare
b0310d0 to
f6babf0
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.