From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v3 container/manager 0/4] fix #3413: Add `Disconnect` option for LXC networks
Date: Tue, 21 Feb 2023 09:05:46 +0100 [thread overview]
Message-ID: <20230221080550.43336-1-c.heiss@proxmox.com> (raw)
Add a `Disconnect` option for network interfaces on LXC containers, much
like it already exists for VMs. This has been requested in #3413 [0] and
seems useful, especially considering we already support the same thing
for VMs.
One thing to note is that LXC does not seem to support the notion of
setting an interface down. The `flags` property would suggest that this
possible [1], but AFAICS it does not work. I tried setting the value as
empty and to something else than "up" (since that is really the only
supported option [2][3]), which both had absolutely no effect.
Thus force the host-side link of the container network down and avoid
adding it to the designated bridge if the new option is set, effectively
disconnecting the container network.
The first two patches are cleanup-patches only and do not change
anything regarding functionality.
Testing
-------
Testing was done by starting a LXC container (w/ and w/o `link_down`
set), checking if the interface has (or not) LOWERLAYERDOWN set inside
the container (`ip address eth0`) and if packet transit works (or not)
using a simple `ping`. Same thing after toggeling the option on the
interface. Further, the interface(s) should (or should not) be listed
in `brctl show`. Same thing was done for hotplugged interfaces to a
running container.
Also tested with `ifreload -a` (thanks Wolfgang!) thrown in, which did
nothing unexpected: If `link_down` was set, interfaces stayed in
LOWERLAYERDOWN and unplugged from the bridge, and stayed UP and plugged
into the bridge when `link_down` was unset.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=3413
[1] https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html#lbAO
[2] https://github.com/lxc/lxc/blob/08f0e769/src/lxc/confile.c#L453-L467
[3] https://github.com/lxc/lxc/blob/08f0e769/src/lxc/confile.c#L5933-L5952
v1: https://lists.proxmox.com/pipermail/pve-devel/2023-February/055762.html
v2: https://lists.proxmox.com/pipermail/pve-devel/2023-February/055795.html
pve-container:
Christoph Heiss (3):
lxc: Fix some trailing whitespace
lxc: Avoid open-coding normal vs SDN-specific tap_plug()
lxc: Add `link_down` config to allow setting interfaces as disconnected
src/PVE/LXC.pm | 41 ++++++++++++++++++++++++++++++++++-------
src/PVE/LXC/Config.pm | 6 ++++++
src/lxcnetaddbr | 7 +++++--
3 files changed, 45 insertions(+), 9 deletions(-)
pve-manager:
Christoph Heiss (1):
lxc: Add `Disconnect` option for network interfaces
www/manager6/Parser.js | 3 +++
www/manager6/lxc/Network.js | 13 +++++++++++++
2 files changed, 16 insertions(+)
--
2.39.1
next reply other threads:[~2023-02-21 8:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 8:05 Christoph Heiss [this message]
2023-02-21 8:05 ` [pve-devel] [PATCH v3 container 1/4] lxc: Fix some trailing whitespace Christoph Heiss
2023-02-21 16:59 ` [pve-devel] applied: " Thomas Lamprecht
2023-02-21 8:05 ` [pve-devel] [PATCH v3 container 2/4] lxc: Avoid open-coding normal vs SDN-specific tap_plug() Christoph Heiss
2023-02-21 17:07 ` [pve-devel] applied: " Thomas Lamprecht
2023-02-22 9:34 ` Christoph Heiss
2023-02-21 8:05 ` [pve-devel] [PATCH v3 container 3/4] lxc: Add `link_down` config to allow setting interfaces as disconnected Christoph Heiss
2023-02-21 17:25 ` Thomas Lamprecht
2023-02-22 9:51 ` Christoph Heiss
2023-02-21 8:05 ` [pve-devel] [PATCH v3 manager 4/4] lxc: Add `Disconnect` option for network interfaces Christoph Heiss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230221080550.43336-1-c.heiss@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox