[pve-devel] [PATCH pve-network 1/3] dhcp: add vrf support

Stefan Hanreich s.hanreich at proxmox.com
Mon Dec 18 18:10:06 CET 2023



On 12/18/23 14:04, Alexandre Derumier wrote:
> launch dnsmasq in a vrf context with "ip vrf exec <vrfname> dnsmasq.."
> 
> use "default" vrf if plugin don't return a specific vrf
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  src/PVE/Network/SDN/Dhcp.pm             |  3 ++-
>  src/PVE/Network/SDN/Dhcp/Dnsmasq.pm     |  3 ++-
>  src/PVE/Network/SDN/Zones.pm            | 10 ++++++++++
>  src/PVE/Network/SDN/Zones/EvpnPlugin.pm |  6 ++++++
>  src/PVE/Network/SDN/Zones/Plugin.pm     |  6 ++++++
>  5 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
> index 7876c08..7b5e31f 100644
> --- a/src/PVE/Network/SDN/Dhcp.pm
> +++ b/src/PVE/Network/SDN/Dhcp.pm
> @@ -79,12 +79,13 @@ sub regenerate_config {
>          my $zone = $zone_cfg->{ids}->{$zoneid};
>          next if !$zone->{dhcp};
>  
> +	my $vrf = PVE::Network::SDN::Zones::get_vrf($zoneid);
>  	my $dhcp_plugin_name = $zone->{dhcp};
>  	my $dhcp_plugin = PVE::Network::SDN::Dhcp::Plugin->lookup($dhcp_plugin_name);
>  
>  	die "Could not find DHCP plugin: $dhcp_plugin_name" if !$dhcp_plugin;
>  
> -	eval { $dhcp_plugin->before_configure($zoneid) };
> +	eval { $dhcp_plugin->before_configure($zoneid, $vrf) };

In my MTU series I already additionally pass in the zone config to the
DHCP plugin, since I did a similar thing (creating a getter) for MTU -
maybe we can unify this approach and call
PVE::Network::SDN::Zones::get_xy() inside the DHCP plugins or outside as
well?

I think I prefer calling it inside the DHCP plugin, since we then only
need to add one parameter instead of adding one for every additional
thing we might want to pass to the dhcp plugin.

See https://lists.proxmox.com/pipermail/pve-devel/2023-December/061111.html




More information about the pve-devel mailing list