Skip to content

nspawn: wait for network namespace creation before interface setup#8633

Merged
filbranden merged 1 commit intosystemd:masterfrom
qmega:nspawn-veth-fix
Apr 5, 2018
Merged

nspawn: wait for network namespace creation before interface setup#8633
filbranden merged 1 commit intosystemd:masterfrom
qmega:nspawn-veth-fix

Conversation

@qmega
Copy link
Contributor

@qmega qmega commented Mar 31, 2018

This fixes #8599 for me. Not sure if this is the best solution, but I think it makes sense.

This is my first time hacking on systemd and I knew nothing about this code as of 3 hours ago, so apologies in advance for anything I might have done wrong. Happy to make changes if necessary.

cc @AlexMekkering @Toolybird @SjonHortensius who also had this issue.

@yuwata yuwata added the nspawn label Mar 31, 2018
Otherwise, network interfaces can be "moved" into the container's
namespace while it's still the same as the host namespace, in which case
e.g. host0 for a veth ends up on the host side instead of inside the
container.

Regression introduced in 0441378.

Fixes systemd#8599.
@qmega qmega force-pushed the nspawn-veth-fix branch from 533847e to 15cf053 Compare March 31, 2018 21:23
@qmega
Copy link
Contributor Author

qmega commented Mar 31, 2018

(Re-pushed because I had wrapped the commit message wrong. Magit update broke my hook.)

@poettering
Copy link
Member

looks superficially ok. I trust you tested this sufficiently?

@AlexMekkering @Toolybird @SjonHortensius any chance you can give this a whirl too?

Copy link
Contributor

@SjonHortensius SjonHortensius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have applied #8507 as well as this patch on top of the current Archlinux release to build 238-51 successfully.

Where the unpatched release creates host0@vb-xxx on the host instead of the container, leaving the container without a network; I can confirm this patch fixes this.

The host0 interface gets created inside the container which makes it have a successful network connection. I assume this will also fix any second or third container which previously failed

@filbranden filbranden merged commit 7511655 into systemd:master Apr 5, 2018
@qmega
Copy link
Contributor Author

qmega commented Apr 6, 2018

@poettering I tested with several combinations of network options to make sure it didn't deadlock, and it's been working for my own use case. I guess it's a moot point since it's already merged now, but yes, I've tested and I'm fairly confident that it isn't breaking anything.

@qmega qmega deleted the nspawn-veth-fix branch October 31, 2019 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Cannot run multiple unprivileged systemd-nspawn containers simultaneously

5 participants