]> git.proxmox.com Git - pve-network.git/commitdiff
zones: add method for getting MTU
authorStefan Hanreich <s.hanreich@proxmox.com>
Mon, 22 Apr 2024 13:15:33 +0000 (15:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Apr 2024 13:22:08 +0000 (15:22 +0200)
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
src/PVE/Network/SDN/Zones.pm
src/PVE/Network/SDN/Zones/Plugin.pm
src/PVE/Network/SDN/Zones/SimplePlugin.pm

index 5bd3536e1259ff1ef73fb6bb383c16d77fd97978..c1c7745f894e4c15fddec4035080ada8a46514f3 100644 (file)
@@ -27,6 +27,7 @@ PVE::Network::SDN::Zones::SimplePlugin->register();
 PVE::Network::SDN::Zones::Plugin->init();
 
 my $local_network_sdn_file = "/etc/network/interfaces.d/sdn";
+my $default_mtu = 1500;
 
 sub sdn_zones_config {
     my ($cfg, $id, $noerr) = @_;
@@ -369,5 +370,12 @@ sub del_bridge_fdb {
     $plugin->del_bridge_fdb($plugin_config, $iface, $macaddr);
 }
 
+sub get_mtu {
+    my ($zone_config) = @_;
+
+    my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($zone_config->{type});
+    return $plugin->get_mtu($zone_config) // $default_mtu;
+}
+
 1;
 
index 247d0b2b90e4ea90afaf706edd596dcca94d4fba..26cc0dabc097043bcfe6c7e48ad7464c8a8288c1 100644 (file)
@@ -361,4 +361,11 @@ sub datacenter_config {
     return PVE::Cluster::cfs_read_file('datacenter.cfg');
 }
 
+
+sub get_mtu {
+    my ($class, $plugin_config) = @_;
+
+    die "please implement inside plugin";
+}
+
 1;
index 65e9ad438ba75c537699a776351eaf9a91e063a2..1416d39b9e266bd2f51c71ac77f98941013039a6 100644 (file)
@@ -56,7 +56,7 @@ sub generate_sdn_config {
 
     my $mac = $vnet->{mac};
     my $alias = $vnet->{alias};
-    my $mtu = $plugin_config->{mtu} if $plugin_config->{mtu};
+    my $mtu = $class->get_mtu($plugin_config);
 
     # vnet bridge
     my @iface_config = ();
@@ -144,6 +144,12 @@ sub vnet_update_hook {
     }
 }
 
+sub get_mtu {
+    my ($class, $plugin_config) = @_;
+
+    return $plugin_config->{mtu};
+}
+
 1;