[pve-devel] [PATCH pve-network 1/2] vxlanmulticast : fix mtu
Alexandre Derumier
aderumier at odiso.com
Thu Jun 6 08:20:13 CEST 2019
vxlan mtu must be 50bytes lower than physdev mtu
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Network/Network/VlanPlugin.pm | 3 +--
PVE/Network/Network/VxlanMulticastPlugin.pm | 7 +++++--
test/generateconfig.pl | 3 ++-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/PVE/Network/Network/VlanPlugin.pm b/PVE/Network/Network/VlanPlugin.pm
index 115d3be..063ae49 100644
--- a/PVE/Network/Network/VlanPlugin.pm
+++ b/PVE/Network/Network/VlanPlugin.pm
@@ -69,9 +69,8 @@ sub generate_network_config {
die "missing vlan tag" if !$tag;
- my $iface = $uplinks->{$uplink} ? $uplinks->{$uplink} : "uplink$uplink";
+ my $iface = $uplinks->{$uplink}->{name} ? $uplinks->{$uplink}->{name} : "uplink$uplink";
$iface .= ".$tag";
-
my $config = "\n";
$config .= "auto $iface\n";
$config .= "iface $iface inet manual\n";
diff --git a/PVE/Network/Network/VxlanMulticastPlugin.pm b/PVE/Network/Network/VxlanMulticastPlugin.pm
index 2f03f48..f544006 100644
--- a/PVE/Network/Network/VxlanMulticastPlugin.pm
+++ b/PVE/Network/Network/VxlanMulticastPlugin.pm
@@ -47,14 +47,17 @@ sub generate_network_config {
my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks) = @_;
my $tag = $vnet->{tag};
- my $mtu = $vnet->{mtu};
my $alias = $vnet->{alias};
my $multicastaddress = $plugin_config->{'multicast-address'};
my $uplink = $plugin_config->{'uplink-id'};
my $vxlanallowed = $plugin_config->{'vxlan-allowed'};
die "missing vxlan tag" if !$tag;
- my $iface = $uplinks->{$uplink} ? $uplinks->{$uplink} : "uplink$uplink";
+ my $iface = $uplinks->{$uplink}->{name} ? $uplinks->{$uplink}->{name} : "uplink$uplink";
+
+ my $mtu = 1450;
+ $mtu = $uplinks->{$uplink}->{mtu} - 50 if $uplinks->{$uplink}->{mtu};
+ $mtu = $vnet->{mtu} if $vnet->{mtu};
my $config = "\n";
$config .= "auto vxlan$tag\n";
diff --git a/test/generateconfig.pl b/test/generateconfig.pl
index fa4e74f..4921d97 100644
--- a/test/generateconfig.pl
+++ b/test/generateconfig.pl
@@ -35,7 +35,8 @@ sub generate_network_config {
my $interface = $interfaces_config->{ifaces}->{$id};
if (my $uplink = $interface->{'uplink-id'}) {
die "uplink-id $uplink is already defined on $uplinks->{$uplink}" if $uplinks->{$uplink};
- $uplinks->{$interface->{'uplink-id'}} = $id;
+ $interface->{name} = $id;
+ $uplinks->{$interface->{'uplink-id'}} = $interface;
}
}
--
2.11.0
More information about the pve-devel
mailing list