From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <s.hanreich@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 0FAE9BB993
 for <pve-devel@lists.proxmox.com>; Mon, 18 Dec 2023 18:10:40 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id DCA701E4AA
 for <pve-devel@lists.proxmox.com>; Mon, 18 Dec 2023 18:10:09 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Mon, 18 Dec 2023 18:10:08 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1ABC048322
 for <pve-devel@lists.proxmox.com>; Mon, 18 Dec 2023 18:10:08 +0100 (CET)
Message-ID: <30ebe48d-dee8-41a3-a13a-d4a8d7de137d@proxmox.com>
Date: Mon, 18 Dec 2023 18:10:06 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: pve-devel@lists.proxmox.com
References: <20231218130431.1857324-1-aderumier@odiso.com>
 <20231218130431.1857324-2-aderumier@odiso.com>
From: Stefan Hanreich <s.hanreich@proxmox.com>
In-Reply-To: <20231218130431.1857324-2-aderumier@odiso.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.484 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [evpnplugin.pm, zones.pm, plugin.pm, dhcp.pm, dnsmasq.pm,
 proxmox.com]
Subject: Re: [pve-devel] [PATCH pve-network 1/3] dhcp: add vrf support
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 18 Dec 2023 17:10:40 -0000



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