summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hanreich <s.hanreich@proxmox.com>2024-04-22 15:15:34 +0200
committerThomas Lamprecht <t.lamprecht@proxmox.com>2024-04-22 15:22:08 +0200
commite19974f44685cebaa54fe6831b0c403cef4eed0a (patch)
treed0836f2550f8357025d78fb406f29f885a9a8ee1
parent41e8c887c11ffbd446fbeb1869d15a846e2b1432 (diff)
dhcp: dnsmasq: send mtu option via dhcp
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
-rw-r--r--src/PVE/Network/SDN/Dhcp.pm2
-rw-r--r--src/PVE/Network/SDN/Dhcp/Dnsmasq.pm7
-rw-r--r--src/PVE/Network/SDN/Dhcp/Plugin.pm2
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';
}