* [PATCH pve-container] fix #7571: emit mtu in ifupdown-based LXC guests @ 2026-05-06 23:00 Ilan Karasik 2026-06-16 10:22 ` Fabian Grünbichler 0 siblings, 1 reply; 5+ messages in thread From: Ilan Karasik @ 2026-05-06 23:00 UTC (permalink / raw) To: pve-devel; +Cc: iamkarasik From: iamkarasik <ilankarasik@gmail.com> Signed-off-by: iamkarasik <ilankarasik@gmail.com> --- src/PVE/LXC/Setup/Debian.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm index 837397b..bbf73d5 100644 --- a/src/PVE/LXC/Setup/Debian.pm +++ b/src/PVE/LXC/Setup/Debian.pm @@ -284,6 +284,7 @@ sub setup_network { $net->{needsroute6} = 1; } } + $net->{mtu} = $d->{mtu} if defined($d->{mtu}); $networks->{ $d->{name} } = $net if keys %$net; } } @@ -337,6 +338,7 @@ sub setup_network { $interfaces .= "\tgateway $gw\n"; } } + $interfaces .= "\tmtu $net->{mtu}\n" if defined($net->{mtu}); foreach my $attr (@{ $section->{attr} }) { $interfaces .= "\t$attr\n"; } @@ -450,6 +452,7 @@ sub setup_network { || $aname eq 'netmask' || $aname eq 'gateway' || $aname eq 'broadcast' + || $aname eq 'mtu' ) { # skip } else { -- 2.51.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH pve-container] fix #7571: emit mtu in ifupdown-based LXC guests 2026-05-06 23:00 [PATCH pve-container] fix #7571: emit mtu in ifupdown-based LXC guests Ilan Karasik @ 2026-06-16 10:22 ` Fabian Grünbichler 2026-06-17 18:32 ` [PATCH v2] " Ilan Karasik 0 siblings, 1 reply; 5+ messages in thread From: Fabian Grünbichler @ 2026-06-16 10:22 UTC (permalink / raw) To: Ilan Karasik, pve-devel Hi! please see https://pve.proxmox.com/wiki/Developer_Documentation#Software_License_and_Copyright for our CLA requirements, and send a signed copy as instructed there. On May 7, 2026 1:00 am, Ilan Karasik wrote: > From: iamkarasik <ilankarasik@gmail.com> please add a short description of the commit/patch here, see our developer documentation for details: > Do not put in a literal description of the code diff, especially not > for simpler changes. The commit message should not focus on the > detailed what's done/changed but rather answer: > > Why this was done otherwise previously (or why this was missing > until now). > > Why the new approach is better or necessary (e.g., a > bug was found, requirements changed, a prerequisite was merged that > enables this). > > What the resulting effect is for users or developers > (if not already obvious from the subject line). If there should be > no visible/semantic change then explicitly stating so can also be > good for non-trivial changes. Thanks! > > Signed-off-by: iamkarasik <ilankarasik@gmail.com> > --- > src/PVE/LXC/Setup/Debian.pm | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm > index 837397b..bbf73d5 100644 > --- a/src/PVE/LXC/Setup/Debian.pm > +++ b/src/PVE/LXC/Setup/Debian.pm > @@ -284,6 +284,7 @@ sub setup_network { > $net->{needsroute6} = 1; > } > } > + $net->{mtu} = $d->{mtu} if defined($d->{mtu}); > $networks->{ $d->{name} } = $net if keys %$net; > } > } > @@ -337,6 +338,7 @@ sub setup_network { > $interfaces .= "\tgateway $gw\n"; > } > } > + $interfaces .= "\tmtu $net->{mtu}\n" if defined($net->{mtu}); > foreach my $attr (@{ $section->{attr} }) { > $interfaces .= "\t$attr\n"; > } > @@ -450,6 +452,7 @@ sub setup_network { > || $aname eq 'netmask' > || $aname eq 'gateway' > || $aname eq 'broadcast' > + || $aname eq 'mtu' > ) { > # skip > } else { > -- > 2.51.2 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] fix #7571: emit mtu in ifupdown-based LXC guests 2026-06-16 10:22 ` Fabian Grünbichler @ 2026-06-17 18:32 ` Ilan Karasik 2026-09-07 14:04 ` Fabian Grünbichler 0 siblings, 1 reply; 5+ messages in thread From: Ilan Karasik @ 2026-06-17 18:32 UTC (permalink / raw) To: pve-devel; +Cc: Ilan Karasik This fixes a bug where custom mtu settings applied to an LXC container are silently ignored during network setup for Debian-based guests using ifupdown. Because the Proxmox network setup was failing to write the mtu value to the guest's `/etc/network/interfaces` file, the container would always default to an mtu of 1500. This patch resolves the issue by writing the `mtu <value>` directive into the guest's network configuration file at /etc/network/interfaces. Signed-off-by: Ilan Karasik <ilankarasik@gmail.com> --- src/PVE/LXC/Setup/Debian.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm index 837397b..bbf73d5 100644 --- a/src/PVE/LXC/Setup/Debian.pm +++ b/src/PVE/LXC/Setup/Debian.pm @@ -284,6 +284,7 @@ sub setup_network { $net->{needsroute6} = 1; } } + $net->{mtu} = $d->{mtu} if defined($d->{mtu}); $networks->{ $d->{name} } = $net if keys %$net; } } @@ -337,6 +338,7 @@ sub setup_network { $interfaces .= "\tgateway $gw\n"; } } + $interfaces .= "\tmtu $net->{mtu}\n" if defined($net->{mtu}); foreach my $attr (@{ $section->{attr} }) { $interfaces .= "\t$attr\n"; } @@ -450,6 +452,7 @@ sub setup_network { || $aname eq 'netmask' || $aname eq 'gateway' || $aname eq 'broadcast' + || $aname eq 'mtu' ) { # skip } else { -- 2.51.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] fix #7571: emit mtu in ifupdown-based LXC guests 2026-06-17 18:32 ` [PATCH v2] " Ilan Karasik @ 2026-09-07 14:04 ` Fabian Grünbichler 2026-09-07 15:39 ` [PATCH v3] " Ilan Karasik 0 siblings, 1 reply; 5+ messages in thread From: Fabian Grünbichler @ 2026-09-07 14:04 UTC (permalink / raw) To: Ilan Karasik, pve-devel On June 17, 2026 8:32 pm, Ilan Karasik wrote: > This fixes a bug where custom mtu settings applied to an LXC container > are silently ignored during network setup for Debian-based guests > using ifupdown. > > Because the Proxmox network setup was failing to write the mtu value > to the guest's `/etc/network/interfaces` file, the container would > always default to an mtu of 1500. > > This patch resolves the issue by writing the `mtu <value>` directive into the > guest's network configuration file at /etc/network/interfaces. > > Signed-off-by: Ilan Karasik <ilankarasik@gmail.com> > --- > src/PVE/LXC/Setup/Debian.pm | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm > index 837397b..bbf73d5 100644 > --- a/src/PVE/LXC/Setup/Debian.pm > +++ b/src/PVE/LXC/Setup/Debian.pm > @@ -284,6 +284,7 @@ sub setup_network { > $net->{needsroute6} = 1; > } > } > + $net->{mtu} = $d->{mtu} if defined($d->{mtu}); > $networks->{ $d->{name} } = $net if keys %$net; > } > } > @@ -337,6 +338,7 @@ sub setup_network { > $interfaces .= "\tgateway $gw\n"; > } > } > + $interfaces .= "\tmtu $net->{mtu}\n" if defined($net->{mtu}); sorry for the long turnaround time! should we also set this higher up in the dhcp/manual part? > foreach my $attr (@{ $section->{attr} }) { > $interfaces .= "\t$attr\n"; > } > @@ -450,6 +452,7 @@ sub setup_network { > || $aname eq 'netmask' > || $aname eq 'gateway' > || $aname eq 'broadcast' > + || $aname eq 'mtu' > ) { > # skip > } else { > -- > 2.51.2 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3] fix #7571: emit mtu in ifupdown-based LXC guests 2026-09-07 14:04 ` Fabian Grünbichler @ 2026-09-07 15:39 ` Ilan Karasik 0 siblings, 0 replies; 5+ messages in thread From: Ilan Karasik @ 2026-09-07 15:39 UTC (permalink / raw) To: pve-devel; +Cc: iamkarasik From: iamkarasik <ilankarasik@gmail.com> This fixes a bug where custom mtu settings applied to an LXC container are silently ignored during network setup for Debian-based guests using ifupdown. Because the Proxmox network setup was failing to write the mtu value to the guest's `/etc/network/interfaces` file, the container would always default to an mtu of 1500. This patch resolves the issue by writing the `mtu <value>` directive into the guest's network configuration file at /etc/network/interfaces. This configuration applies to static, dhcp, and manual configurations. Signed-off-by: Ilan Karasik <ilankarasik@gmail.com> --- src/PVE/LXC/Setup/Debian.pm | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC/Setup/Debian.pm b/src/PVE/LXC/Setup/Debian.pm index 837397b..fd4a7d4 100644 --- a/src/PVE/LXC/Setup/Debian.pm +++ b/src/PVE/LXC/Setup/Debian.pm @@ -284,6 +284,7 @@ sub setup_network { $net->{needsroute6} = 1; } } + $net->{mtu} = $d->{mtu} if defined($d->{mtu}); $networks->{ $d->{name} } = $net if keys %$net; } } @@ -298,6 +299,7 @@ sub setup_network { my $done_auto = {}; my $done_v4_hash = {}; my $done_v6_hash = {}; + my $done_mtu_hash = {}; my ($os, $version) = ($conf->{ostype}, $self->{version}); my $print_section = sub { @@ -317,7 +319,12 @@ sub setup_network { if (!defined($net->{address})) { # no address => no iface line } elsif ($net->{address} =~ /^(dhcp|manual)$/) { - $interfaces .= "iface $ifname inet $1\n\n"; + $interfaces .= "iface $ifname inet $1\n"; + if (defined($net->{mtu}) && !$done_mtu_hash->{$ifname}) { + $interfaces .= "\tmtu $net->{mtu}\n"; + $done_mtu_hash->{$ifname} = 1; + } + $interfaces .= "\n"; } else { $interfaces .= "iface $ifname inet static\n"; if ( @@ -329,6 +336,10 @@ sub setup_network { $interfaces .= "\taddress $net->{address}\n" if defined($net->{address}); $interfaces .= "\tnetmask $net->{netmask}\n" if defined($net->{netmask}); } + if (defined($net->{mtu}) && !$done_mtu_hash->{$ifname}) { + $interfaces .= "\tmtu $net->{mtu}\n"; + $done_mtu_hash->{$ifname} = 1; + } remove_gateway_scripts($section->{attr}); if (defined(my $gw = $net->{gateway})) { if ($net->{needsroute}) { @@ -348,7 +359,12 @@ sub setup_network { if (!defined($net->{address6})) { # no address => no iface line } elsif ($net->{address6} =~ /^(auto|dhcp|manual)$/) { - $interfaces .= "iface $ifname inet6 $1\n\n"; + $interfaces .= "iface $ifname inet6 $1\n"; + if (defined($net->{mtu}) && !$done_mtu_hash->{$ifname}) { + $interfaces .= "\tmtu $net->{mtu}\n"; + $done_mtu_hash->{$ifname} = 1; + } + $interfaces .= "\n"; } else { $interfaces .= "iface $ifname inet6 static\n"; if ( @@ -360,6 +376,10 @@ sub setup_network { $interfaces .= "\taddress $net->{address6}\n" if defined($net->{address6}); $interfaces .= "\tnetmask $net->{netmask6}\n" if defined($net->{netmask6}); } + if (defined($net->{mtu}) && !$done_mtu_hash->{$ifname}) { + $interfaces .= "\tmtu $net->{mtu}\n"; + $done_mtu_hash->{$ifname} = 1; + } remove_gateway_scripts($section->{attr}); if (defined(my $gw = $net->{gateway6})) { if ($net->{needsroute6}) { @@ -450,6 +470,7 @@ sub setup_network { || $aname eq 'netmask' || $aname eq 'gateway' || $aname eq 'broadcast' + || $aname eq 'mtu' ) { # skip } else { -- 2.51.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-08 7:47 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-06 23:00 [PATCH pve-container] fix #7571: emit mtu in ifupdown-based LXC guests Ilan Karasik 2026-06-16 10:22 ` Fabian Grünbichler 2026-06-17 18:32 ` [PATCH v2] " Ilan Karasik 2026-09-07 14:04 ` Fabian Grünbichler 2026-09-07 15:39 ` [PATCH v3] " Ilan Karasik
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox