[PATCH pve-network] fix #5319: frr.local: add support for bgp-community

Alexandre Derumier alexandre.derumier at groupe-cyllene.com
Tue Apr 16 18:25:04 CEST 2024


Need to be inserted after ip prefix-list and before route map

Signed-off-by: Alexandre Derumier <alexandre.derumier at groupe-cyllene.com>
---
 src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 18eea47..c245ea2 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -424,17 +424,16 @@ sub generate_frr_vrf {
     push @{$final_config}, @config;
 }
 
-sub generate_frr_ip_protocol {
-   my ($final_config, $ips) = @_;
+sub generate_frr_simple_list {
+   my ($final_config, $rules) = @_;
 
-   return if !$ips;
+   return if !$rules;
 
    my @config = ();
    push @{$final_config}, "!";
-   foreach my $rule (sort @$ips) {
+   foreach my $rule (sort @$rules) {
 	push @{$final_config}, $rule;
    }
-
 }
 
 sub generate_frr_interfaces {
@@ -520,8 +519,9 @@ sub generate_controller_rawconfig {
     generate_frr_list($final_config, $config->{frr_access_list}, "access-list");
     generate_frr_list($final_config, $config->{frr_prefix_list}, "ip prefix-list");
     generate_frr_list($final_config, $config->{frr_prefix_list_v6}, "ipv6 prefix-list");
+    generate_frr_simple_list($final_config, $config->{frr_bgp_community_list});
     generate_frr_routemap($final_config, $config->{frr_routemap});
-    generate_frr_ip_protocol($final_config, $config->{frr_ip_protocol});
+    generate_frr_simple_list($final_config, $config->{frr_ip_protocol});
 
     push @{$final_config}, "!";
     push @{$final_config}, "line vty";
@@ -556,6 +556,9 @@ sub parse_merge_frr_local_config {
 	} elsif ($line =~ m/^interface (.+)$/) {
 	    $section = \$config->{'frr_interfaces'}->{$1};
 	    next;
+	} elsif ($line =~ m/^bgp community-list (.+)$/) {
+	    push(@{$config->{'frr_bgp_community_list'}}, $line);
+	    next;
 	} elsif ($line =~ m/address-family (.+)$/) {
 	    $section = \$config->{'frr'}->{'router'}->{$router}->{'address-family'}->{$1};
 	    next;
-- 
2.39.2




More information about the pve-devel mailing list