pf-tools/pf-tools: 4 new changesets

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Fri Dec 19 07:07:40 UTC 2014


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/c0663c4e160e
changeset: 1410:c0663c4e160e
user:      melkor <melkor at sitadelle.com>
date:      Thu Dec 18 16:43:20 2014 +0100
description:
bugfix

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/f0bb2b6af04b
changeset: 1411:f0bb2b6af04b
user:      melkor <melkor at sitadelle.com>
date:      Fri Dec 19 08:06:56 2014 +0100
description:
goodby lala

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/53c350ed4285
changeset: 1412:53c350ed4285
user:      melkor <melkor at sitadelle.com>
date:      Fri Dec 19 08:07:09 2014 +0100
description:
merge

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/f5eb7a4c28a4
changeset: 1413:f5eb7a4c28a4
user:      melkor <melkor at sitadelle.com>
date:      Fri Dec 19 08:07:32 2014 +0100
description:
merge

diffstat:

 lib/PFTools/Conf/Host.pm    |   2 +-
 lib/PFTools/Conf/Network.pm |  12 +++---------
 lib/PFTools/Utils.pm        |  19 ++++++++++++++-----
 t/13.conf.t                 |   6 +++---
 4 files changed, 21 insertions(+), 18 deletions(-)

diffs (98 lines):

diff -r d9ff1010e7ec -r f5eb7a4c28a4 lib/PFTools/Conf/Host.pm
--- a/lib/PFTools/Conf/Host.pm	Thu Dec 18 16:14:59 2014 +0100
+++ b/lib/PFTools/Conf/Host.pm	Fri Dec 19 08:07:32 2014 +0100
@@ -615,9 +615,9 @@
     # for some network, NetAddr::IP->prefix() return a range
     # something like '109.3.20.225-255'
     my $prefix = $subnet_ref->prefix();
-    $prefix =~ s{ \d+-[\d.]+ }{}xms;
     my $ip_address;
     if ($prefix) {
+        $prefix =~ s{ \d+-[\d.]+ }{}xms;
         if ( $ipstart =~ /\A $RE{net}{IPv4} \Z/xms ) {
             $ip_address = NetAddr::IP->new( $ipstart, $subnet_ref->mask() );
         }
diff -r d9ff1010e7ec -r f5eb7a4c28a4 lib/PFTools/Conf/Network.pm
--- a/lib/PFTools/Conf/Network.pm	Thu Dec 18 16:14:59 2014 +0100
+++ b/lib/PFTools/Conf/Network.pm	Fri Dec 19 08:07:32 2014 +0100
@@ -143,13 +143,7 @@
     }
 
     if ( $section_ref->{'state'} eq 'ROOT' ) {
-        if ( $global_config->{'SITE'}->{'ROOT'} ) {
-            carp
-                qq{WARNING: ROOT site is already defined: skipping $section_name};
-            return;
-        }
-
-        $global_config->{'SITE'}->{'ROOT'} = $section_name;
+        push @{ $global_config->{'SITE'}->{'ROOT'} }, $section_name;
     }
     else {
         push @{ $global_config->{'SITE'}->{'EDGE'} }, $section_name;
@@ -253,8 +247,8 @@
     foreach my $ip_type (qw( ipv4 ipv6 )) {
         next if not $pf_config->{'features'}->{$ip_type};
 
-        my $suffix      = get_suffix_from_ip_type($ip_type);
-        my $subnet_ref  = get_subnet_from_vlan( $ip_type, $section_ref );
+        my $suffix = get_suffix_from_ip_type($ip_type);
+        my $subnet_ref = get_subnet_from_vlan( $ip_type, $section_ref );
 
         next if !$subnet_ref;
 
diff -r d9ff1010e7ec -r f5eb7a4c28a4 lib/PFTools/Utils.pm
--- a/lib/PFTools/Utils.pm	Thu Dec 18 16:14:59 2014 +0100
+++ b/lib/PFTools/Utils.pm	Fri Dec 19 08:07:32 2014 +0100
@@ -1489,11 +1489,20 @@
         next if not $if_part->{$ip_type};
 
         my $ip = NetAddr::IP->new( $if_part->{$ip_type} );
-        push @iface_lines,
-            qq{\taddress\t\t} . $ip->addr(),
-            qq{\tnetmask\t\t} . $ip->mask(),
-            qq{\tnetwork\t\t} . $ip->network()->addr(),
-            qq{\tbroadcast\t} . $ip->broadcast()->addr();
+        if ($ip->{isv6}) {
+            my $cidr = $ip->cidr();
+            $cidr =~ s/\/(.*)$/$1/;
+            push @iface_lines,
+                qq{\taddress\t\t} . $ip->addr(),
+                qq{\tnetmask\t\t} . $ip->cidr(),
+                qq{\tnetwork\t\t} . $ip->network()->addr();
+        } else {
+            push @iface_lines,
+                qq{\taddress\t\t} . $ip->addr(),
+                qq{\tnetmask\t\t} . $ip->mask(),
+                qq{\tnetwork\t\t} . $ip->network()->addr(),
+                qq{\tbroadcast\t} . $ip->broadcast()->addr();
+        }
 
         # Routes
         # FIXME add test cases in t/* for non-default routes
diff -r d9ff1010e7ec -r f5eb7a4c28a4 t/13.conf.t
--- a/t/13.conf.t	Thu Dec 18 16:14:59 2014 +0100
+++ b/t/13.conf.t	Fri Dec 19 08:07:32 2014 +0100
@@ -872,11 +872,9 @@
 qr{ \A ERROR: [ ] Invalid [ ] non-hashref [ ] 'pf_config' }xms
     => q{Dies if non-hashref $pf_config};
 
-print "lala\n";
 $parsed_configuration
     = init_global_netconfig( q{COMMON:private-network}, $test_hash_subst,
     $test_pf_config );
-print "lala\n";
 
 $expected_configuration = {
     'DHCP' => {
@@ -931,7 +929,9 @@
         'EDGE' => [
             'cbv4'
         ],
-        'ROOT'    => 'cbv4-pfds',
+        'ROOT'    => [
+            'cbv4-pfds',
+        ],
         'BY_NAME' => {
             'cbv4-pfds' => {
                 'HOST' => {



More information about the pf-tools-commits mailing list