From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 49AE56B980 for ; Mon, 21 Mar 2022 08:06:00 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 39D83257D for ; Mon, 21 Mar 2022 08:05:30 +0100 (CET) Received: from bastionodiso.odiso.net (bastionodiso.odiso.net [185.151.191.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 94C222565 for ; Mon, 21 Mar 2022 08:05:28 +0100 (CET) Received: from kvmformation3.odiso.net (formationkvm3.odiso.net [10.3.94.12]) by bastionodiso.odiso.net (Postfix) with ESMTP id 59F2E404A1; Mon, 21 Mar 2022 08:05:28 +0100 (CET) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id 451D2174847; Mon, 21 Mar 2022 08:05:28 +0100 (CET) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Mon, 21 Mar 2022 08:05:27 +0100 Message-Id: <20220321070527.3842366-2-aderumier@odiso.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220321070527.3842366-1-aderumier@odiso.com> References: <20220321070527.3842366-1-aderumier@odiso.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.147 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% HEADER_FROM_DIFFERENT_DOMAINS 0.25 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.001 Envelope sender has no MX or A DNS records SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH V2 pve-common 1/1] network: tap_plug: fix mtu X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2022 07:06:00 -0000 - ovsint port mtu need to be set with ""ovs-vsctl set mtu-request" - update mtu on already existing interfaces (fwbr,fwln,tap,veth) if existing tap|veth interface is replugged on a different mtu bridge Signed-off-by: Alexandre Derumier --- src/PVE/Network.pm | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm index c83b1bb..d3eb5e0 100644 --- a/src/PVE/Network.pm +++ b/src/PVE/Network.pm @@ -219,6 +219,11 @@ my $bridge_disable_interface_learning = sub { my $bridge_add_interface = sub { my ($bridge, $iface, $tag, $trunks) = @_; + my $bridgemtu = read_bridge_mtu($bridge); + eval { + PVE::Tools::run_command(['/sbin/ip', 'link', 'set', $iface, 'mtu', $bridgemtu]); + }; + # drop link local address (it can't be used when on a bridge anyway) disable_ipv6($iface); iface_set_master($iface, $bridge); @@ -259,6 +264,9 @@ my $ovs_bridge_add_port = sub { push @$cmd, "trunks=". join(',', $trunks) if $trunks; push @$cmd, "vlan_mode=native-untagged" if $tag && $trunks; + my $bridgemtu = read_bridge_mtu($bridge); + push @$cmd, '--', 'set', 'Interface', $iface, "mtu_request=$bridgemtu"; + if ($internal) { # second command push @$cmd, '--', 'set', 'Interface', $iface, 'type=internal'; @@ -271,9 +279,12 @@ my $ovs_bridge_add_port = sub { }; my $activate_interface = sub { - my ($iface) = @_; + my ($iface, $mtu) = @_; - eval { run_command(['/sbin/ip', 'link', 'set', $iface, 'up']) }; + my $cmd = ['/sbin/ip', 'link', 'set', $iface, 'up']; + push (@$cmd, ('mtu', $mtu)) if $mtu; + + eval { run_command($cmd) }; die "can't activate interface '$iface' - $@\n" if $@; }; @@ -354,8 +365,9 @@ sub veth_create { # up vethpair disable_ipv6($veth); disable_ipv6($vethpeer); - &$activate_interface($veth); - &$activate_interface($vethpeer); + &$activate_interface($veth, $bridgemtu); + &$activate_interface($vethpeer, $bridgemtu); + } sub veth_delete { @@ -373,8 +385,10 @@ my $create_firewall_bridge_linux = sub { my ($vmid, $devid) = &$parse_tap_device_name($iface); my ($fwbr, $vethfw, $vethfwpeer) = &$compute_fwbr_names($vmid, $devid); + my $bridgemtu = read_bridge_mtu($bridge); + &$cond_create_bridge($fwbr); - &$activate_interface($fwbr); + &$activate_interface($fwbr, $bridgemtu); copy_bridge_config($bridge, $fwbr); veth_create($vethfw, $vethfwpeer, $bridge); @@ -395,15 +409,12 @@ my $create_firewall_bridge_ovs = sub { my $bridgemtu = read_bridge_mtu($bridge); &$cond_create_bridge($fwbr); - &$activate_interface($fwbr); + &$activate_interface($fwbr, $bridgemtu); &$bridge_add_interface($fwbr, $iface); &$ovs_bridge_add_port($bridge, $ovsintport, $tag, 1, $trunks); - &$activate_interface($ovsintport); - - # set the same mtu for ovs int port - run_command(['/sbin/ip', 'link', 'set', $ovsintport, 'mtu', $bridgemtu]); + &$activate_interface($ovsintport, $bridgemtu); &$bridge_add_interface($fwbr, $ovsintport); &$bridge_disable_interface_learning($ovsintport) if $no_learning; -- 2.30.2