[pve-devel] [PATCH pve-network 3/3] dhcp: dnsmasq: send mtu option via dhcp

Stefan Hanreich s.hanreich at proxmox.com
Thu Dec 14 17:46:47 CET 2023


Signed-off-by: Stefan Hanreich <s.hanreich at 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 2844943..614c267 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -164,7 +164,7 @@ sub configure_vnet {
 }
 
 sub before_configure {
-    my ($class, $dhcpid) = @_;
+    my ($class, $dhcpid, $zone_cfg) = @_;
 
     my $dbus_config = <<DBUSCFG;
 <!DOCTYPE busconfig PUBLIC
@@ -205,6 +205,8 @@ CFG
 	$default_config
     );
 
+    my $mtu = PVE::Network::SDN::Zones::get_mtu($zone_cfg);
+
     my $default_dnsmasq_config = <<CFG;
 except-interface=lo
 enable-ra
@@ -215,6 +217,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




More information about the pve-devel mailing list