pf-tools commit: r582 [ccaillet-guest] - in /trunk: debian/changelog tools/dumpiplist.pl

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Thu Mar 6 16:06:01 UTC 2008


Author: ccaillet-guest
Date: Thu Mar  6 16:06:00 2008
New Revision: 582

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=582
Log:
* improving tool dumpiplist.pl (see -h or --help), and fixing duplicate IP
  entry (e.g. : anycast IPs ... )

Modified:
    trunk/debian/changelog
    trunk/tools/dumpiplist.pl

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=582&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Thu Mar  6 16:06:00 2008
@@ -23,7 +23,8 @@
   * Better substitution on Subst_vars, now if a %VAR% is not defined on SUBST
     hash, the returned string is not broken
   * adding %SECTIONNAME% handler on actions others than dpkg-purge and apt-get
-  * improving tool dumpiplist.pl (see -h or --help)
+  * improving tool dumpiplist.pl (see -h or --help), and fixing duplicate IP
+    entry (e.g. : anycast IPs ... )
   * adding the choice of different vlan for an interface like eth2 in function
     of the host number
   * adding the possibility for routes to be function of the host number
@@ -48,7 +49,7 @@
   * Update my email address.
   * Merge the remaining changes from 0.32.47-1 and 0.32.48-1.
 
- -- Christophe Caillet <quadchris at free.fr>  Tue, 04 Mar 2008 13:41:43 +0100
+ -- Christophe Caillet <quadchris at free.fr>  Thu, 06 Mar 2008 17:04:52 +0100
 
 pf-tools (0.32.48-1) unstable; urgency=low
 

Modified: trunk/tools/dumpiplist.pl
URL: http://svn.debian.org/wsvn/pf-tools/trunk/tools/dumpiplist.pl?rev=582&op=diff
==============================================================================
--- trunk/tools/dumpiplist.pl (original)
+++ trunk/tools/dumpiplist.pl Thu Mar  6 16:06:00 2008
@@ -80,7 +80,14 @@
 	my $order = {} ;
 	
 	foreach my $srv ( keys %{$ref_net} ) {
-		push ( @{$order->{$ref_net->{$srv}->{'order'}}}, $srv ) ;
+		my $srv_order ;
+		if ( ! defined $ref_net->{$srv}->{'order'} ) {
+			$srv_order = 999 ;
+		}
+		else {
+			$srv_order = $ref_net->{$srv}->{'order'} ;
+		}
+		push ( @{$order->{$srv_order}}, $srv ) ;
 	}
 # 	foreach my $prio ( sort keys %{$order} ) {
 # 		foreach my $srv ( @{$order->{$prio}} ) {
@@ -130,8 +137,11 @@
 			my $ref_srv = $ref_net->{$srv_type}->{'SRVLIST'}->{$srv} ;
 			foreach my $iface ( keys %{$ref_srv->{'zone'}} ) {
 				next if ( $iface !~ /^$srv\./ ) ;
-				$result->{$ref_srv->{'zone'}->{$iface}->{'FIELD'}}->{'hostname'} = $srv ;
-				$result->{$ref_srv->{'zone'}->{$iface}->{'FIELD'}}->{'iface'} = $ref_srv->{'ifup'}->{$iface} ;
+				my $entry = {
+					'hostname'	=> $srv,
+					'iface'		=> $ref_srv->{'ifup'}->{$iface}
+				} ;
+				push ( @{$result->{$ref_srv->{'zone'}->{$iface}->{'FIELD'}}}, $entry ) ;
 			}
 		}
 	}
@@ -201,7 +211,7 @@
 	else {
 		my $ip_list = get_all_ip ( $SRV_LIST ) ;
 		foreach my $ip ( sort { _ipcomp ( $a, $b ) } keys %{$ip_list} ) {
-			print $ip."\t".$ip_list->{$ip}->{'hostname'}."(".$ip_list->{$ip}->{'iface'}.")\n" ;
-		}
-	}
-}
+			print "$ip\t" . join(' ', map { "$_->{'hostname'}($_->{'iface'})" } @{ $ip_list->{$ip} }) . "\n" ;
+		}
+	}
+}




More information about the pf-tools-commits mailing list