Skip to content

Commit

Permalink
Добавлена поддержка агрегации ipv4 адресов
Browse files Browse the repository at this point in the history
  • Loading branch information
max197616 committed Sep 2, 2019
1 parent 46565ec commit 4bf0a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scripts/extfilter-quagga/extfilter_quagga.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ quagga_config=/etc/quagga/bgpd.conf
# путь к vtysh
vtysh = /bin/vtysh

# агрегация отдельных ipv4 адресов в сети
ipv4_aggregate_prefix = 32
6 changes: 4 additions & 2 deletions scripts/extfilter-quagga/extfilter_quagga.pl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
my $vtysh = $Config->{'BGP.vtysh'} || "/bin/vtysh";
my $route_to_null = (lc($Config->{'BGP.route_to_null'} || "true")) eq "true" ? 1 : 0;
my $do_subnets = (lc($Config->{'BGP.do_subnets'} || "true")) eq "true" ? 1 : 0;
my $ipv4_agg_prefix = $Config->{'BGP.ipv4_aggregate_prefix'} || "32";
$ipv4_agg_prefix = "/".$ipv4_agg_prefix if(index($ipv4_agg_prefix, "/") == -1);

my $update_soft_quagga=1;

Expand Down Expand Up @@ -124,8 +126,8 @@
next if($ip eq "0.0.0.0" || $ip eq "0000:0000:0000:0000:0000:0000:0000:0000");
if($ip =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)
{
$ip_cidr_null->add_any($ip) if($route_to_null);
$ip_cidr->add_any($ip);
$ip_cidr_null->add_any($ip.$ipv4_agg_prefix) if($route_to_null);
$ip_cidr->add_any($ip.$ipv4_agg_prefix);
} else
{
$ip6_cidr_null->add_any($ip) if($route_to_null);
Expand Down

0 comments on commit 4bf0a85

Please sign in to comment.