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
mininet: init at 2.3.0d4 #41261
mininet: init at 2.3.0d4 #41261
Conversation
Success on x86_64-linux (full log) Attempted: mininet Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: mininet Partial log (click to expand)
|
nixos/modules/programs/mininet.nix
Outdated
|
||
virtualisation.vswitch.enable = true; | ||
|
||
environment.systemPackages = with pkgs; [ |
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.
Would it be possible to add them in the PATH of a wrapper script instead?
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 wonder. I could write a wrapper for the official "mn" script but what about user scripts ? users would need to add these tools (iperf & co) themselves to PATH. People using mininet are likely to either use it in a VM or playing with iperf either way.
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.
Didn't they first attach to network namespaces with a certain command, then the PATH would be inherited in this environment, no? It has been a while since I used it.
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.
Here is where they mount the network namespace https://github.com/teto/mininet/blob/9a069563e1f4fb5b544249a05fe5557416183827/mnexec.c#L129, I am not sure how PATH behave wit namespaces. Commands are run by this same mnexec binary so I believe wrapping it should work. Will try this evening.
sha256 = "18w9vfszhnx4j3b8dd1rvrg8xnfk6rgh066hfpzspzqngd5qzakg"; | ||
}; | ||
|
||
patches = [ ./test.patch ]; |
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.
Why the patch is called test
?
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.
It mostly changes the makefile so makefile.patch ?
nixos/modules/programs/mininet.nix
Outdated
security.wrappers = { | ||
mnexec.source = "${pkgs.mininet}/bin/mnexec"; | ||
# I still have to run it with sudo | ||
# mn.source = "${pyEnv}/bin/mn"; |
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.
Would it be pertinent to create a systemd unit to run mn?
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.
mn is called by the python bindings when necessary so it is not necessary.
I use mininet only within a nix-shell but I guess people would expect the
which fails with |
Success on x86_64-linux (full log) Attempted: mininet Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: mininet Partial log (click to expand)
|
Nevertheless I found a behavior that doesn't seem normal anymore, like I would expect toPythonApplication to work on a pythonPackage @FRidh : |
@teto Maybe you could find some ideas in this commit nlewo@dbbf532. I've tryied to use it ( sudo ./result/bin/mn --test pingall) on my laptop but it failed (note i never used it and don't know too much about this). |
Thanks for trying, I think I will revert the changes aiming at providing |
pkgs/top-level/all-packages.nix
Outdated
# makeWrapper ${mnApp}/bin/mn \ | ||
# $out/bin/mn \ | ||
# --prefix PATH : "${pkgs.telnet}/bin/telnet" | ||
# ''; |
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.
Those lines should be removed from all-packages.nix. mn can be wrapped in the package.
nixos/modules/programs/mininet.nix
Outdated
virtualisation.vswitch.enable = true; | ||
|
||
security.wrappers = { | ||
mnexec.source = mnexecWrapped + "/bin/mnexec"; |
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 assume this allows every user to become root on the system.
Is this setuid wrapper really needed? At least it should be limited to a specific group.
I like to keep the python output separate from the mnexec output but made it mandatory (mininet is useless without it). |
while trying on my host, I keep getting this kind of error:
In this case mininet command is said to fail because EDIT: and also mininet works within a VM, it's just on my host that for some reason it can't run |
0804ed5
to
72a6a8c
Compare
I finally solved all problems, just waiting for mininet/mininet#815 to be merged before pushing a final branch. |
9077594
to
44184e7
Compare
I bumped the package that is now compatible with python3 ! While the patch was recgonized as useful it hasn't been merged yet so I say let's merge this and I will keep pushing for it to be merged (basically mininet assumes debian's |
@teto did I miss something, or should the
|
@flokli you should look into the python output. nix-build -A pythonPackages.mininet-python ~/nixpkgs
|
Mininet (https://github.com/mininet/mininet) is a popular network emulator that glues several components such as network namespaces, traffic control commands into a set of python bindings. It is then "easy" to describe a topology and run experiments on it.
Right, I pushed a change removing this description.
|
|
||
doCheck = false; | ||
|
||
buildInputs = [ python.pkgs.wrapPython which help2man pyEnv ]; |
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.
If you add setuptools
as pythonPath, wrapPython
should pick it up.
See also https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/rust/fetchcargo.nix#L8
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.
But is setuptools
really needed at runtime?
If it is only used at build time, then adding setuptools
to buildInputs
is all it takes.
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.
the makefile overrides PYTHONPATH which generates an error. In principle it should be needed only during install. I will try to send a patch upstream.
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.
ok, then for the time beeing.
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.
nevermind, the problem was something else. Is it ok now ?
nixos/modules/programs/mininet.nix
Outdated
# mn errors out without a telnet binary | ||
# pkgs.telnet brings an undesired ifconfig into PATH see #43105 | ||
# so we wrap it here instead | ||
makeWrapper ${pkgs.telnet}/bin/telnet $out/bin/telnet |
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.
ln -s ${pkgs.telnet}/bin/telnet $out/bin/telnet
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.
Why was this marked as resolved?
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.
Did you get a notification on resolution ? I marked it resolved (maybe too soon) because I fixed it locally.
@Mic92 does the latest commit address your concern ? |
Thanks! |
wow really good news. thanks for all the comments. |
Mininet (https://github.com/mininet/mininet) is a popular network emulator that
glues several components such as network namespaces, traffic control
commands into a set of python bindings. It is then "easy" to describe a
topology and run experiments on it.
To test it, you should rebuild with
programs.mininet.enable = true;
Then you can run
nix-shell -p 'python.withPackages(ps: [ps.mininet-python])' --verbose
and launch your own scripts or justsudo mn
Motivation for this change
I use it for experimentation
Things done
The current Makefile is very limiting so I submitted this PR mininet/mininet#803 but there is only one maintainer so it might take time for the patch to get in so I embedded it in nixpkgs.
Mininet can work with several openflow controllers. I have written nix packages for https://github.com/CPqD/ofsoftswitch13 (and its netbee dependency) but it didn't work so I fell back on openvswitch.
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)