[pve-devel] [PATCH network] sdn: write frr config if the frr.conf.local file exists
Gabriel Goller
g.goller at proxmox.com
Thu Oct 2 14:47:28 CEST 2025
On 01.10.2025 12:06, Stefan Hanreich wrote:
>Tested this on my machine, works as advertised. The general idea of
>regenerating the FRR config anytime we reload SDN also makes sense to
>me, since it allows users to have a FRR config and potentially create
>controllers / fabrics at a later time and not have to worry about their
>frr.conf getting overwritten accidentally.
>
>Reviewed-by: Stefan Hanreich <s.hanreich at proxmox.com>
>Tested-by: Stefan Hanreich <s.hanreich at proxmox.com>
>
>On 9/19/25 3:25 PM, Gabriel Goller wrote:
>> [snip]
>> diff --git a/src/PVE/Network/SDN/Frr.pm b/src/PVE/Network/SDN/Frr.pm
>> index b607b32c248d..e77eba182177 100644
>> --- a/src/PVE/Network/SDN/Frr.pm
>> +++ b/src/PVE/Network/SDN/Frr.pm
>> @@ -32,6 +32,22 @@ string that is a FRR configuration line.
>> use PVE::RESTEnvironment qw(log_warn);
>> use PVE::Tools qw(file_get_contents file_set_contents run_command);
>>
>> +my $FRR_CONF_LOCAL_FILE = "/etc/frr/frr.conf.local";
>> +
>> +=head3 local_frr_config_exists
>> +
>> +Returns true if the `/etc/frr/frr.conf.local` file exists, otherwise false.
>> +
>> +=cut
>> +
>> +sub local_frr_config_exists {
>> + if (-e $FRR_CONF_LOCAL_FILE) {
>> + return 1;
>> + } else {
>> + return 0;
>> + }
>> +}
>> +
>> =head3 read_local_frr_config
>>
>> Returns the contents of `/etc/frr/frr.conf.local` as a string if it exists, otherwise undef.
>> @@ -39,8 +55,8 @@ Returns the contents of `/etc/frr/frr.conf.local` as a string if it exists, othe
>> =cut
>>
>> sub read_local_frr_config {
>> - if (-e "/etc/frr/frr.conf.local") {
>> - return file_get_contents("/etc/frr/frr.conf.local");
>> + if (-e $FRR_CONF_LOCAL_FILE) {
>
>small nit: potentially use the helper here, if we define one anyway?
good point, will send a v2 soon!
>+ return file_get_contents($FRR_CONF_LOCAL_FILE);
>> }
>> }
Thanks for the review!
More information about the pve-devel
mailing list