public inbox for pve-devel@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 3/3] dhcp: dnsmasq: send mtu option via dhcp
Date: Mon, 22 Apr 2024 15:15:34 +0200	[thread overview]
Message-ID: <20240422131534.260904-4-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/Dhcp.pm         | 2 +-
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 7 ++++++-
 src/PVE/Network/SDN/Dhcp/Plugin.pm  | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index 7876c08..d48de34 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -84,7 +84,7 @@ sub regenerate_config {
 
 	die "Could not find DHCP plugin: $dhcp_plugin_name" if !$dhcp_plugin;
 
-	eval { $dhcp_plugin->before_configure($zoneid) };
+	eval { $dhcp_plugin->before_configure($zoneid, $zone) };
 	die "Could not run before_configure for DHCP server $zoneid $@\n" if $@;
 
 	for my $vnetid (sort keys %{$vnet_cfg->{ids}}) {
diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
index c14f5d7..ae52d31 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -177,7 +177,7 @@ sub systemctl_service {
 }
 
 sub before_configure {
-    my ($class, $dhcpid) = @_;
+    my ($class, $dhcpid, $zone_cfg) = @_;
 
     my $dbus_config = <<DBUSCFG;
 <!DOCTYPE busconfig PUBLIC
@@ -218,6 +218,8 @@ CFG
 	$default_config
     );
 
+    my $mtu = PVE::Network::SDN::Zones::get_mtu($zone_cfg);
+
     my $default_dnsmasq_config = <<CFG;
 except-interface=lo
 enable-ra
@@ -228,6 +230,9 @@ dhcp-leasefile=$DNSMASQ_LEASE_ROOT/dnsmasq.$dhcpid.leases
 dhcp-hostsfile=$config_directory/ethers
 dhcp-ignore=tag:!known
 
+dhcp-option=26,$mtu
+ra-param=*,mtu:$mtu,0
+
 # Send an empty WPAD option. This may be REQUIRED to get windows 7 to behave.
 dhcp-option=252,"\\n"
 
diff --git a/src/PVE/Network/SDN/Dhcp/Plugin.pm b/src/PVE/Network/SDN/Dhcp/Plugin.pm
index 6e985cd..1757915 100644
--- a/src/PVE/Network/SDN/Dhcp/Plugin.pm
+++ b/src/PVE/Network/SDN/Dhcp/Plugin.pm
@@ -43,7 +43,7 @@ sub configure_vnet {
 }
 
 sub before_configure {
-    my ($class, $dhcpid) = @_;
+    my ($class, $dhcpid, $zone_config) = @_;
     die 'implement in sub class';
 }
 
-- 
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:16 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 ` [pve-devel] [PATCH pve-network v2 2/3] zones: add method for getting MTU Stefan Hanreich
2024-04-22 13:15 ` Stefan Hanreich [this message]
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-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal