[pve-devel] [PATCH pve-network 2/7] dhcp: enable-ra on layer3 zones only

Alexandre Derumier aderumier at odiso.com
Tue Dec 19 09:32:11 CET 2023


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm       | 4 ++--
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm   | 2 +-
 src/PVE/Network/SDN/Zones/Plugin.pm       | 2 +-
 src/PVE/Network/SDN/Zones/SimplePlugin.pm | 9 +++++++++
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
index 169ce56..b488613 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -208,8 +208,6 @@ CFG
 
     my $default_dnsmasq_config = <<CFG;
 except-interface=lo
-enable-ra
-quiet-ra
 bind-dynamic
 no-hosts
 dhcp-leasefile=$DNSMASQ_LEASE_ROOT/dnsmasq.$dhcpid.leases
@@ -230,6 +228,8 @@ dhcp-name-match=set:wpad-ignore,wpad
 dhcp-ignore-names=tag:wpad-ignore
 CFG
 
+    $default_dnsmasq_config .= "enable-ra\nquiet-ra\n" if $options->{dhcp_ra};
+
     PVE::Tools::file_set_contents(
 	"$config_directory/00-default.conf",
 	$default_dnsmasq_config
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index c806564..3c3278a 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -275,7 +275,7 @@ sub generate_sdn_config {
 sub get_options {
     my ($class, $plugin_config, $zoneid) = @_;
 
-    my $options = { vrf => "vrf_$zoneid"};
+    my $options = { vrf => "vrf_$zoneid", dhcp_ra => 1};
 
     return $options;
 }
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 07e8389..7804b1c 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -132,7 +132,7 @@ sub controller_reload {
 sub get_options {
     my ($class, $plugin_config, $zoneid) = @_;
 
-    my $options = { vrf => 'default'};
+    my $options = { vrf => 'default', dhcp_ra => undef};
     return $options;
 }
 
diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index c996bf3..58a75a0 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -130,6 +130,15 @@ sub generate_sdn_config {
     return $config;
 }
 
+
+sub get_options {
+    my ($class, $plugin_config, $zoneid) = @_;
+
+    my $options = { vrf => 'default', dhcp_ra => 1};
+
+    return $options;
+}
+
 sub vnet_update_hook {
     my ($class, $vnet_cfg, $vnetid, $zone_cfg) = @_;
 
-- 
2.39.2




More information about the pve-devel mailing list