Skip to content
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

Can LXC_NET_NS be exported when net hook being executed? #3066

Closed
ss1h2a3tw opened this issue Jun 29, 2019 · 7 comments
Closed

Can LXC_NET_NS be exported when net hook being executed? #3066

ss1h2a3tw opened this issue Jun 29, 2019 · 7 comments

Comments

@ss1h2a3tw
Copy link
Contributor

Issue description

Since the net hook script may need to modify the network configs in the lxc's network namespace. Exporting this variable will be helpful.

@stgraber
Copy link
Member

Seems reasonable to me, can you send a PR that adds the environment variable?

@ss1h2a3tw
Copy link
Contributor Author

I found that the LXC_[NAMESPACE IDENTIFIER]_NS are not set even in the start-host hook. Is it intentional?

@ss1h2a3tw
Copy link
Contributor Author

But if LXC_PID are set, maybe this variable won't be needed. Because during starting the container, the script can get the namespace by /proc/PID/ns. Maybe moving the setenv of the LXC_PID forward will be a easier approach.

@stgraber
Copy link
Member

@brauner @tomponline I'm guessing you two will have a stronger opinion than I do

@tomponline
Copy link
Collaborator

@brauner has said in the past that LXC_PID can.be used for this as @ss1h2a3tw says.

@ss1h2a3tw
Copy link
Contributor Author

I found that the time that the hook being executed will differ by whether the lxc is running as root. If it is running as root, the hook will be executed before clone(). If not running as root, the hook will be executed after clone(). So LXC_PID or LXC_NET_NS will be only available for the hook if the user is not root.

@brauner
Copy link
Member

brauner commented Jul 1, 2019

For containers started as root neither LXC_PID nor LXC_NET_NS can be made available since it is done before the container is started. But I'm sure we could redesign this.

brauner pushed a commit to brauner/lxc that referenced this issue Jul 1, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Closes lxc#3066.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit to brauner/lxc that referenced this issue Jul 2, 2019
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: lxc#3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
brauner pushed a commit that referenced this issue Aug 11, 2019
Closes #3066.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants