all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network v2 2/3] zones: add method for getting MTU
Date: Mon, 22 Apr 2024 15:15:33 +0200	[thread overview]
Message-ID: <20240422131534.260904-3-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20240422131534.260904-1-s.hanreich@proxmox.com>

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 src/PVE/Network/SDN/Zones.pm              | 8 ++++++++
 src/PVE/Network/SDN/Zones/Plugin.pm       | 7 +++++++
 src/PVE/Network/SDN/Zones/SimplePlugin.pm | 8 +++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index 5bd3536..c1c7745 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -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;
 
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 247d0b2..26cc0da 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -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;
diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index 65e9ad4..1416d39 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -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;
 
 
-- 
2.39.2


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2024-04-22 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 13:15 [pve-devel] [PATCH network v2 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
2024-04-22 13:15 ` [pve-devel] [PATCH pve-network v2 1/3] dhcp: fix function signatures in abstract class Stefan Hanreich
2024-04-22 13:15 ` Stefan Hanreich [this message]
2024-04-22 13:15 ` [pve-devel] [PATCH pve-network v2 3/3] dhcp: dnsmasq: send mtu option via dhcp Stefan Hanreich
2024-04-22 14:22 ` [pve-devel] applied: [PATCH network v2 0/3] Advertise MTU via DHCP / RA Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240422131534.260904-3-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal