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 AD88F61459 for ; Fri, 18 Feb 2022 17:25:12 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A106B2BDD1 for ; Fri, 18 Feb 2022 17:25:12 +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 BBCDF2BDBF for ; Fri, 18 Feb 2022 17:25:11 +0100 (CET) Received: from kvmformation3.odiso.net (formationkvm3.odiso.net [10.3.94.12]) by bastionodiso.odiso.net (Postfix) with ESMTP id 148E54DCE; Fri, 18 Feb 2022 17:25:03 +0100 (CET) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id ED53113E21F; Fri, 18 Feb 2022 17:25:02 +0100 (CET) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Fri, 18 Feb 2022 17:25:01 +0100 Message-Id: <20220218162501.3423501-2-aderumier@odiso.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218162501.3423501-1-aderumier@odiso.com> References: <20220218162501.3423501-1-aderumier@odiso.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.099 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% HEADER_FROM_DIFFERENT_DOMAINS 0.249 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 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: Fri, 18 Feb 2022 16:25:12 -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 --- src/PVE/Network.pm | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm index d4d72d4..56ade27 100644 --- a/src/PVE/Network.pm +++ b/src/PVE/Network.pm @@ -211,6 +211,11 @@ sub disable_ipv6 { 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); @@ -251,6 +256,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'; @@ -263,9 +271,12 @@ my $ovs_bridge_add_port = sub { }; my $activate_interface = sub { - my ($iface) = @_; + my ($iface, $mtu) = @_; + + my $cmd = ['/sbin/ip', 'link', 'set', $iface, 'up']; + push (@$cmd, ('mtu', $mtu)) if $mtu; - eval { run_command(['/sbin/ip', 'link', 'set', $iface, 'up']) }; + eval { run_command($cmd) }; die "can't activate interface '$iface' - $@\n" if $@; }; @@ -309,8 +320,8 @@ 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 { @@ -328,8 +339,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); @@ -349,15 +362,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 - PVE::Tools::run_command(['/sbin/ip', 'link', 'set', $ovsintport, 'mtu', $bridgemtu]); + &$activate_interface($ovsintport, $bridgemtu); &$bridge_add_interface($fwbr, $ovsintport); }; -- 2.30.2