-
Notifications
You must be signed in to change notification settings - Fork 226
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
new-chroot: set up new network namespace and add default route in it #118
new-chroot: set up new network namespace and add default route in it #118
Conversation
Few caveats,
|
Some software expects (implicitly or otherwise) that system always has default route properly configured. For example, you can't bind() UDP socket to all IP addresses and then join multicast group, w/o having default route. This is what ruby test suite does and fails due to missing default route when building ruby with --new-chroot while network access is disallowed. rpmbuild_networking option allows you to configure whether mock should set up build environment in way that it is possible to access network. This option affects only mock commands spawned with --new-chroot. Previously we added --private-network to nspawn command when rpmbuild_networking was set to False. This commit introduces a change in this regard. We never add --private-network to nspawn arguments, instead we setup network namespace ourselves and we also add default route pointing to loopback interface (only interface in the new namespace). This should fix build ruby's build failure and provide more "pleasant" build environment even when network access is disallowed. Note that this commit introduces new dependency which is pyroute2. We need pyroute2 in order to setup environment in new network namespace. Fixes #113
Above isn't entirely true because only unhandled exceptions are re-raised in a parent. I figured out that exception was raised in parent because actually exception handler from the child raised a new exception. I force pushed my branch where this is now fixed.
This is still true, but we are no longer getting the exception in the parent as it is handled by child's exception handler.
This is most likely a bug that I will report to upstream Python bug tracker. |
I have done few minor changes. |
I can't see any documentation of "rpmbuild_networking" config option in this PR :/ What is the default behavior actually? |
@voxik The behavior has been present there for some time. And it does not change. Previously we just passed option to systemd-nspawn and left nspawn to handle it. Now we do not pass the option to nspawn anymore and we handle the network namespaces ourself. |
Some software excepts (implicitly or otherwise) that system always has
default route properly configured. For example, you can't bind() UDP
socket to all IP addresses and then join multicast group, w/o having
default route. This is what ruby test-suite does and fails due to
missing default route when building ruby with --new-chroot while network
access is disallowed.
rpmbuild_networking option allows you to configure whether mock should
set up build environment in way that it is possible to access
network. This option affects only mock commands spawned with
--new-chroot. Previously we added --private-network to nspawn command
when rpmbuild_networking was set to False. This commit introduces a
change in this regard. We never add --private-network to nspawn
arguments, instead we setup network namespace ourselves and we also add
default route pointing to loopback interface (only interface in the new
namespace). This should fix build ruby's build failure and provide more
"pleasant" build environment even when network access is disallowed.
Note that this commit introduces new dependency which is pyroute2. We
need pyroute2 in order to setup environment in new network namespace.
Fixes #113