public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA
@ 2023-12-14 16:46 Stefan Hanreich
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 1/3] dhcp: fix function signatures in abstract class Stefan Hanreich
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Stefan Hanreich @ 2023-12-14 16:46 UTC (permalink / raw)
  To: pve-devel

Stefan Hanreich (3):
  dhcp: fix function signatures in abstract class
  zones: add method for getting MTU
  dhcp: dnsmasq: send mtu option via dhcp

 src/PVE/Network/SDN/Dhcp.pm               |  2 +-
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm       |  7 ++++++-
 src/PVE/Network/SDN/Dhcp/Plugin.pm        | 12 ++++++------
 src/PVE/Network/SDN/Zones.pm              |  8 ++++++++
 src/PVE/Network/SDN/Zones/Plugin.pm       |  7 +++++++
 src/PVE/Network/SDN/Zones/SimplePlugin.pm |  8 +++++++-
 6 files changed, 35 insertions(+), 9 deletions(-)

-- 
2.39.2




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pve-devel] [PATCH pve-network 1/3] dhcp: fix function signatures in abstract class
  2023-12-14 16:46 [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
@ 2023-12-14 16:46 ` Stefan Hanreich
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 2/3] zones: add method for getting MTU Stefan Hanreich
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Stefan Hanreich @ 2023-12-14 16:46 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 src/PVE/Network/SDN/Dhcp/Plugin.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/PVE/Network/SDN/Dhcp/Plugin.pm b/src/PVE/Network/SDN/Dhcp/Plugin.pm
index b99f598..6e985cd 100644
--- a/src/PVE/Network/SDN/Dhcp/Plugin.pm
+++ b/src/PVE/Network/SDN/Dhcp/Plugin.pm
@@ -28,12 +28,12 @@ sub add_ip_mapping {
 }
 
 sub configure_range {
-    my ($class, $dhcpid, $vnetid, $subnet_config, $range_config) = @_;
+    my ($class, $config, $dhcpid, $vnetid, $subnet_config, $range_config) = @_;
     die 'implement in sub class';
 }
 
 sub configure_subnet {
-    my ($class, $dhcpid, $vnetid, $subnet_config) = @_;
+    my ($class, $config, $dhcpid, $vnetid, $subnet_config) = @_;
     die 'implement in sub class';
 }
 
@@ -43,22 +43,22 @@ sub configure_vnet {
 }
 
 sub before_configure {
-    my ($class, $dhcp_config) = @_;
+    my ($class, $dhcpid) = @_;
     die 'implement in sub class';
 }
 
 sub after_configure {
-    my ($class, $dhcp_config) = @_;
+    my ($class, $dhcpid, $noerr) = @_;
     die 'implement in sub class';
 }
 
 sub before_regenerate {
-    my ($class) = @_;
+    my ($class, $noerr) = @_;
     die 'implement in sub class';
 }
 
 sub after_regenerate {
-    my ($class, $dhcp_config) = @_;
+    my ($class) = @_;
     die 'implement in sub class';
 }
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pve-devel] [PATCH pve-network 2/3] zones: add method for getting MTU
  2023-12-14 16:46 [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 1/3] dhcp: fix function signatures in abstract class Stefan Hanreich
@ 2023-12-14 16:46 ` Stefan Hanreich
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 3/3] dhcp: dnsmasq: send mtu option via dhcp Stefan Hanreich
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Stefan Hanreich @ 2023-12-14 16:46 UTC (permalink / raw)
  To: pve-devel

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 b55b967..c1f95fc 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -356,4 +356,11 @@ sub get_bridge_ifaces {
 
     return @bridge_ifaces;
 }
+
+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 c996bf3..9540449 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [pve-devel] [PATCH pve-network 3/3] dhcp: dnsmasq: send mtu option via dhcp
  2023-12-14 16:46 [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 1/3] dhcp: fix function signatures in abstract class Stefan Hanreich
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 2/3] zones: add method for getting MTU Stefan Hanreich
@ 2023-12-14 16:46 ` Stefan Hanreich
  2024-02-22 13:23 ` [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
  2024-04-22 12:06 ` Thomas Lamprecht
  4 siblings, 0 replies; 7+ messages in thread
From: Stefan Hanreich @ 2023-12-14 16:46 UTC (permalink / raw)
  To: pve-devel

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 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA
  2023-12-14 16:46 [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
                   ` (2 preceding siblings ...)
  2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 3/3] dhcp: dnsmasq: send mtu option via dhcp Stefan Hanreich
@ 2024-02-22 13:23 ` Stefan Hanreich
  2024-04-22 12:06 ` Thomas Lamprecht
  4 siblings, 0 replies; 7+ messages in thread
From: Stefan Hanreich @ 2024-02-22 13:23 UTC (permalink / raw)
  To: pve-devel

ping

still applies on current master

On 12/14/23 17:46, Stefan Hanreich wrote:
> Stefan Hanreich (3):
>   dhcp: fix function signatures in abstract class
>   zones: add method for getting MTU
>   dhcp: dnsmasq: send mtu option via dhcp
> 
>  src/PVE/Network/SDN/Dhcp.pm               |  2 +-
>  src/PVE/Network/SDN/Dhcp/Dnsmasq.pm       |  7 ++++++-
>  src/PVE/Network/SDN/Dhcp/Plugin.pm        | 12 ++++++------
>  src/PVE/Network/SDN/Zones.pm              |  8 ++++++++
>  src/PVE/Network/SDN/Zones/Plugin.pm       |  7 +++++++
>  src/PVE/Network/SDN/Zones/SimplePlugin.pm |  8 +++++++-
>  6 files changed, 35 insertions(+), 9 deletions(-)
> 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA
  2023-12-14 16:46 [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
                   ` (3 preceding siblings ...)
  2024-02-22 13:23 ` [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
@ 2024-04-22 12:06 ` Thomas Lamprecht
  2024-04-22 13:16   ` Stefan Hanreich
  4 siblings, 1 reply; 7+ messages in thread
From: Thomas Lamprecht @ 2024-04-22 12:06 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Hanreich

Am 14/12/2023 um 17:46 schrieb Stefan Hanreich:
> Stefan Hanreich (3):
>   dhcp: fix function signatures in abstract class
>   zones: add method for getting MTU
>   dhcp: dnsmasq: send mtu option via dhcp
> 
>  src/PVE/Network/SDN/Dhcp.pm               |  2 +-
>  src/PVE/Network/SDN/Dhcp/Dnsmasq.pm       |  7 ++++++-
>  src/PVE/Network/SDN/Dhcp/Plugin.pm        | 12 ++++++------
>  src/PVE/Network/SDN/Zones.pm              |  8 ++++++++
>  src/PVE/Network/SDN/Zones/Plugin.pm       |  7 +++++++
>  src/PVE/Network/SDN/Zones/SimplePlugin.pm |  8 +++++++-
>  6 files changed, 35 insertions(+), 9 deletions(-)
> 

seems OK from a high-level glance, would need a rebase now though


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA
  2024-04-22 12:06 ` Thomas Lamprecht
@ 2024-04-22 13:16   ` Stefan Hanreich
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Hanreich @ 2024-04-22 13:16 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion


On 4/22/24 14:06, Thomas Lamprecht wrote:
> seems OK from a high-level glance, would need a rebase now though

sent a rebased v2:
https://lists.proxmox.com/pipermail/pve-devel/2024-April/063588.html


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-22 13:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 16:46 [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 1/3] dhcp: fix function signatures in abstract class Stefan Hanreich
2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 2/3] zones: add method for getting MTU Stefan Hanreich
2023-12-14 16:46 ` [pve-devel] [PATCH pve-network 3/3] dhcp: dnsmasq: send mtu option via dhcp Stefan Hanreich
2024-02-22 13:23 ` [pve-devel] [PATCH pve-network 0/3] Advertise MTU via DHCP / RA Stefan Hanreich
2024-04-22 12:06 ` Thomas Lamprecht
2024-04-22 13:16   ` Stefan Hanreich

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