pf-tools commit: r583 [parmelan-guest] - in /branches/0.32-stable: README.doc debian/changelog dumpiplist.pl lib-conf lib-net

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


Author: parmelan-guest
Date: Thu Mar  6 16:16:56 2008
New Revision: 583

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=583
Log:
* Backport a few things from trunk 0.33-0WIP1 (see README.doc) :
  - Feature: non-contiguous IP adresses (specific IP address by HOSTNUM)
  - Feature: specific route by HOSTNUM
  - Feature: specific VLAN by HOSTNUM
  - Feature: interface bonding (generic or by HOSTNUM)
  - Feature: improved dumpiplist.pl
  - Bugfix: Subst_vars() wasn't doing the right thing when %VAR% was used
    but $SUBST{'VAR'} was not defined

Modified:
    branches/0.32-stable/README.doc
    branches/0.32-stable/debian/changelog
    branches/0.32-stable/dumpiplist.pl
    branches/0.32-stable/lib-conf
    branches/0.32-stable/lib-net

Modified: branches/0.32-stable/README.doc
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/README.doc?rev=583&op=diff
==============================================================================
--- branches/0.32-stable/README.doc (original)
+++ branches/0.32-stable/README.doc Thu Mar  6 16:16:56 2008
@@ -6,6 +6,28 @@
 
 ========================================================================
 private-network :
+
+* bonding
+
+  [optional]
+
+  This directive is used to define a bond interface. The value is a
+  comma-separated list of physical slave interfaces. The bond interface can be
+  used as a normal interface in the rest of the configuration.
+
+  Sample use :
+
+    To define a bond0 interface with slaves eth2 and eth3 on host%% (but with
+    slaves eth3 and eth4 for host01), assigning this interface an IP adress in
+    the vlan-filer VLAN, you can do this :
+
+    [host%%]
+	...
+	bonding.bond0.default = eth2,eth3
+	bonding.bond0.1       = eth3,eth4
+	...
+	interface.bond0       = vlan-filer
+
 
 * cmdline
 
@@ -46,6 +68,55 @@
 	...
 	console.1 = default
 
+* interface
+
+  [optional]
+
+  Define a (possibly tagged) network interface, and assign it to a VLAN.
+
+  Sample use :
+
+    [host%%]
+	...
+	interface.eth1.default = vlan-filer # eth1   on host%%
+	interface.eth1.2       = vlan-linux # eth1   on host02
+	interface.eth1\.2      = vlan-linux # eth1.2 on host%% (802.1q)
+	interface.eth1\.2.3    = vlan-linux # eth1.2 on host03 (802.1q)
+
+  For backward compatibility, "interface.eth1" is equivalent to
+  "interface.eth1.default".
+
+
+* ip
+
+  [optional]
+
+  Override iptstart definition for a specific HOSTNUM (this allows to have
+  non-contiguous IP adresses for host%%).
+
+  Sample use :
+
+    In this example, the last byte of the IP adresses on vlan-foo are :
+
+	host00 -> 10
+	host01 -> 11
+	host02 -> 12
+	host03 -> 13
+	...
+
+    [host%%]
+	...
+	ipstart.vlan-foo = 10
+
+    But after adding "ip.vlan-foo.2 = 42", they are :
+
+	host00 -> 10
+	host01 -> 11
+	host02 -> 42
+	host03 -> 13
+	...
+
+
 * pxetemplate
 
   [optional]
@@ -64,6 +135,24 @@
     [host%%]
 	...
 	pxetemplate.default = /path/to/my/pxe-template
+
+* route
+
+  [optional]
+
+  This directive allows to defines routes on network interfaces.
+
+  Sample use :
+
+    To define a default route for host%% via gw.vlan-srvcom.private on eth2,
+    but via gw2.vlan-srvcom.private for host01 :
+
+    [host%%]
+	...
+	eth2.route1.default = default gw.vlan-srvcom.private
+	eth2.route1.1       = default gw2.vlan-srvcom.private
+
+  For backward compatibility, "eth2.route1" is equivalent to "eth2.route1.default".
 
 
 ========================================================================

Modified: branches/0.32-stable/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/debian/changelog?rev=583&op=diff
==============================================================================
--- branches/0.32-stable/debian/changelog (original)
+++ branches/0.32-stable/debian/changelog Thu Mar  6 16:16:56 2008
@@ -1,3 +1,16 @@
+pf-tools (0.32.49-0.WIP) unstable; urgency=low
+
+  * Backport a few things from trunk 0.33-0WIP1 (see README.doc) :
+    - Feature: non-contiguous IP adresses (specific IP address by HOSTNUM)
+    - Feature: specific route by HOSTNUM
+    - Feature: specific VLAN by HOSTNUM
+    - Feature: interface bonding (generic or by HOSTNUM)
+    - Feature: improved dumpiplist.pl
+    - Bugfix: Subst_vars() wasn't doing the right thing when %VAR% was used
+      but $SUBST{'VAR'} was not defined
+
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>  Thu, 06 Mar 2008 17:07:32 +0100
+
 pf-tools (0.32.48-1) unstable; urgency=low
 
   [ Thomas Parmelan ]

Modified: branches/0.32-stable/dumpiplist.pl
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/dumpiplist.pl?rev=583&op=diff
==============================================================================
--- branches/0.32-stable/dumpiplist.pl (original)
+++ branches/0.32-stable/dumpiplist.pl Thu Mar  6 16:16:56 2008
@@ -1,9 +1,9 @@
-#!/usr/bin/perl -w
-# liste toute les adresses ip depuis le fichier private-network
-# prend le fichier private-network en argument et un 1 en second 
-# argument si on souhaite avoir les adresses pour les uml (implique alteon00 surtout)
-
-##  Copyright (C) 2005 Olivier MOLTENI <olivier at molteni.net>
+#!/usr/bin/perl
+##
+##  $Id$
+##
+##  Copyright (C) 2008 Christophe Caillet <quadchris at free.fr>
+##  Copyright (C) 2004 Stephane Pontier <shad at sitadelle.com>
 ##
 ##  This program is free software; you can redistribute it and/or
 ##  modify it under the terms of the GNU General Public License
@@ -20,113 +20,193 @@
 ##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 ##
 
+# liste toute les adresses ip depuis le fichier private-network
+# prend le fichier private-network en argument et un 1 en second
+# argument si on souhaite avoir les adresses pour les uml (implique alteon00 surtout)
 
 use strict;
-
-if ( @ARGV == 0 or @ARGV > 2)
-{
-	print "Usage: $0 fichier_private_network uml(0/1)\n";
-	exit
-}
-if ($ARGV[1])
-{
-	our $UML = 1;
-}
+use warnings;
+
+use Data::Dumper;
 
 require("lib-net");
 require("lib-conf");
-
-sub _ipcomp 
-{
-	my ($a,$b) = @_;
-	my ($suba1,$suba2,$suba3,$suba4,$supa) = split(/\./,$a);
-	my ($subb1,$subb2,$subb3,$subb4,$supb) = split(/\./,$b);
-
-	return 1 if ($suba1 > $subb1);
-	return -1 if ($suba1 < $subb1);
-	return 1 if ($suba2 > $subb2);
-	return -1 if ($suba2 < $subb2);
-	return 1 if ($suba3 > $subb3);
-	return -1 if ($suba3 < $subb3);
-	return 1 if ($suba4 > $subb4);
-	return -1 if ($suba4 < $subb4);
-	$supa = 0 if !defined ($supa);
-	$supb = 0 if !defined ($supb);
-	return 1 if ($supa gt $supb);
-	return -1 if ($supa lt $supb);
-	return 0;
-}
-
-use Data::Dumper;
-my $bighash= Load_conf ($ARGV[0]);
-
-#print Dumper ($bighash) ;
-my $nethash= {};
-foreach my $entry (keys %{$bighash})
-{
-#	print "On est sur la machine $entry\n";
-	if (defined($bighash->{$entry}->{'type'}) and $bighash->{$entry}->{'type'}=~/server/)
-	{# c'est une machine
-		foreach my $interface (keys %{$bighash->{$entry}->{'interface'}})
-		{
-			my ($ippatte, $netpatte, $netmaskpatte);
-			my $vlan = $bighash->{$entry}->{'interface'}->{$interface};
-			$netpatte = $bighash->{$vlan}->{'network'} ;
-			$netmaskpatte = $bighash->{$vlan}->{'netmask'} ;
-			if (defined($bighash->{$entry}->{'ipstart'}->{$vlan}))
-			{
-				$ippatte = $bighash->{$entry}->{'ipstart'}->{$vlan};
-			} else {
-				$ippatte = $bighash->{$entry}->{'ipstart'}->{'default'};
+require("lib-update");
+
+use Getopt::Long qw ( :config ignore_case_always bundling ) ;
+
+my $help	= 0 ;
+my $type	= '' ;
+my $src		= '' ;
+my $read	= 0 ;
+my $program	= $0;
+$program	=~ s%.*/%%; # cheap basename
+my $version	= sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
+
+sub _ipcomp {
+    my ( $a, $b ) = @_;
+    my ( $suba1, $suba2, $suba3, $suba4, $supa ) = split( /\./, $a );
+    my ( $subb1, $subb2, $subb3, $subb4, $supb ) = split( /\./, $b );
+
+    return 1  if ( $suba1 > $subb1 );
+    return -1 if ( $suba1 < $subb1 );
+    return 1  if ( $suba2 > $subb2 );
+    return -1 if ( $suba2 < $subb2 );
+    return 1  if ( $suba3 > $subb3 );
+    return -1 if ( $suba3 < $subb3 );
+    return 1  if ( $suba4 > $subb4 );
+    return -1 if ( $suba4 < $subb4 );
+    $supa = 0 if !defined($supa);
+    $supb = 0 if !defined($supb);
+    return 1  if ( $supa gt $supb );
+    return -1 if ( $supa lt $supb );
+    return 0;
+}
+
+sub Do_help_local {
+    print STDERR << "# ENDHELP";
+    $program - version $version
+
+Usage:	$program [options]
+	-h --help:	print help and exit
+	-s --src:	source file for private-network
+	-t --type:	specify a server type to extract from global confifuration
+	-r --read:	specify that output will be human readable
+
+# ENDHELP
+}
+
+sub order_servers ($) {
+	my ( $ref_net ) = @_ ;
+	my $result = [] ;
+	my $order = {} ;
+	
+	foreach my $srv ( keys %{$ref_net} ) {
+		$ref_net->{$srv}->{'order'} = 99999 unless defined $ref_net->{$srv}->{'order'}; # order is optional
+		push @{$order->{$ref_net->{$srv}->{'order'}}}, $srv;
+	}
+# 	foreach my $prio ( sort keys %{$order} ) {
+# 		foreach my $srv ( @{$order->{$prio}} ) {
+# 			push ( @{$result}, $srv ) ;
+# 		}
+# 	}
+	return $order ;
+}
+
+sub get_srv_iface ($$) {
+	my ( $srv_name, $ref_srv ) = @_ ;
+	my $ordered_vlan = {} ;
+	my $result = {} ;
+	foreach my $vlan ( keys %{$ref_srv->{'ifup'}} ) {
+		my $vlan_name = $vlan ;
+		$vlan_name =~ s/^$srv_name\.//;
+		$ordered_vlan->{$ref_srv->{'ifup'}->{$vlan}} = $vlan_name ;
+	}
+	foreach my $iface ( sort keys %{$ordered_vlan} ) {
+		$result->{$iface}->{'addr'} = $ref_srv->{'zone'}->{$srv_name.".".$ordered_vlan->{$iface}}->{'FIELD'} ;
+		$result->{$iface}->{'vlan'} = $ordered_vlan->{$iface} ;
+	}
+	return $result ;
+}
+
+sub get_srv_ip ($$) {
+	my ( $srv_type, $ref_net ) = @_ ;
+	my $result = {} ;
+	
+	foreach my $srv ( keys %{$ref_net->{$srv_type}->{'SRVLIST'}} ) {
+		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} ;
+		}
+	}
+	return $result ;
+}
+
+sub get_all_ip ($) {
+	my ( $ref_net ) = @_ ;
+	my $result = {} ;
+	
+	foreach my $srv_type ( keys %{$ref_net} ) {
+		foreach my $srv ( keys %{$ref_net->{$srv_type}->{'SRVLIST'}} ) {
+			my $ref_srv = $ref_net->{$srv_type}->{'SRVLIST'}->{$srv} ;
+			foreach my $iface ( keys %{$ref_srv->{'zone'}} ) {
+				next if ( $iface !~ /^$srv\./ ) ;
+				push @{ $result->{ $ref_srv->{'zone'}->{$iface}->{'FIELD'} } }, {
+				    hostname => $srv,
+				    iface => $ref_srv->{'ifup'}->{$iface},
+				};
 			}
-			if (!defined($bighash->{$entry}->{'number'}) or  $bighash->{$entry}->{'number'} <=1)
-			{
-				$bighash->{$entry}->{'number'} = 1;
+		}
+	}
+	return $result ;
+}
+
+GetOptions (
+	'help|h'	=> \$help,
+	'type|t=s'	=> \$type,
+	'read|r'	=> \$read,
+	'src|s=s'	=> \$src
+) || die "Didn't grok options on CLI\n" ;
+
+if ( $help ) {
+	Do_help_local () ;
+	exit 0 ;
+}
+
+if ( ! $src ) {
+	die "Source file for network description is not defined\n" ;
+} elsif ( ! -e $src ) {
+	die $src." source file doesn't exist\n" ;
+}
+
+my $PF_NET	= Init_lib_net ( Get_source ( $src ) );
+my $SRV_LIST	= $PF_NET->{'SERVERS'}->{'BY_NAME'} ;
+
+if ( $type && ! defined $SRV_LIST->{$type} ) {
+	die "Non existant server type ".$type."\n" ;
+}
+
+# print Dumper $PF_NET;
+if ( $type ) {
+	if ( $read ) {
+		foreach my $srv ( sort keys %{$SRV_LIST->{$type}->{'SRVLIST'}} ) {
+			print "\t".$srv."\n" ;
+			my $srv_net = get_srv_iface ( $srv, $SRV_LIST->{$type}->{'SRVLIST'}->{$srv} ) ;
+			foreach my $iface ( sort keys %{$srv_net} ) {
+				print "\t\t".$iface."(".$srv_net->{$iface}->{'vlan'}.")\t: ".$srv_net->{$iface}->{'addr'}."\n" ;
 			}
-#			print "INTERFACE:$interface	PATTE:$netpatte	MASK:$netmaskpatte	IP:$ippatte	VLAN:$vlan\n";
-			my $numberpatte;
-			for ($numberpatte=0; $numberpatte<$bighash->{$entry}->{'number'}; $numberpatte++)
-			{
-				# on est soit dans le nouvelle addressage avec un
-				# vlan en 10.128.0.0 et une ip de patte en 24.0
-				if ($ippatte=~ /(\d{1,3})\.(\d{0,3})/)
-				{#print "nouvel addr$ippatte\t";
-					my $ippatteXX= "$1." . ($2+$numberpatte);
-					$netpatte =~ s/(\d{1,3}\.\d{1,3}\.)\d{1,3}\.\d{1,3}/$1$ippatteXX/;
-				} else {#print "ancien addr$ippatte\t";
-					# soit en addressage de classe C avec
-					# un vlan en 217.19.192.0
-					# et une ip de patte en 96
-					my $ippatteXX= $ippatte+$numberpatte;
-					$netpatte =~ s/(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}/$1$ippatteXX/;
+		}
+	}
+	else {
+		my $srv_ip = get_srv_ip ( $type, $SRV_LIST ) ;
+		foreach my $ip ( sort { _ipcomp ( $a, $b ) } keys %{$srv_ip} ) {
+			print $ip."\t".$srv_ip->{$ip}->{'hostname'}."(".$srv_ip->{$ip}->{'iface'}.")\n" ;
+		}
+	}
+} else {
+	if ( $read ) {
+		my $srv_type_list = order_servers ( $SRV_LIST ) ;
+		foreach my $prio ( sort keys %{$srv_type_list} ) {
+			print "Server with deployment priority : ".$prio."\n" ;
+			foreach my $srv_type ( sort @{$srv_type_list->{$prio}} ) {
+				foreach my $srv ( sort keys %{$SRV_LIST->{$srv_type}->{'SRVLIST'}} ) {
+					print "\t".$srv."\n" ;
+					my $srv_net = get_srv_iface ( $srv, $SRV_LIST->{$srv_type}->{'SRVLIST'}->{$srv} ) ;
+					foreach my $iface ( sort keys %{$srv_net} ) {
+						print "\t\t".$iface."(".$srv_net->{$iface}->{'vlan'}.")\t: ".$srv_net->{$iface}->{'addr'}."\n" ;
+					}
 				}
-				my $ipkey= $netpatte;
-#				print "on a maintenant la machine $entry avec:$netpatte\n";
-				if (defined($nethash->{$ipkey}))
-				{
-					my $nmachine =  $entry;
-					$nmachine =~ s/%%/0$numberpatte/;
-					print "$nmachine($interface)\t" . $netpatte .": ip deja prise par ";
-					print "$nethash->{$ipkey}->{'machine'}($nethash->{$ipkey}->{'interface'}) \n";
-					$ipkey .= ".X"
-				}
-				my $machine =  $entry;
-				$machine =~ s/%%/0$numberpatte/;
-				$nethash->{$ipkey}->{'vlan'} = $vlan;
-				$nethash->{$ipkey}->{'ip'} = $netpatte;
-				$nethash->{$ipkey}->{'netmask'} = $netmaskpatte;
-				$nethash->{$ipkey}->{'interface'} = $interface;
-				$nethash->{$ipkey}->{'machine'} = $machine;
+				print "\n" ;
 			}
-
-		}
-	}
-}
-
-#foreach my $ownip (sort {$main::a <=> $main::b } keys %{$nethash})
-foreach my $ownip (sort {&_ipcomp($a,$b) } keys %{$nethash})
-{
-	print "$nethash->{$ownip}->{'ip'}\t" . $nethash->{$ownip}->{'machine'} . "(". $nethash->{$ownip}->{'interface'} .")\n";
-}
-
-
+			print "\n" ;
+		}
+	}
+	else {
+		my $ip_list = get_all_ip ( $SRV_LIST ) ;
+		foreach my $ip ( sort { _ipcomp ( $a, $b ) } keys %{$ip_list} ) {
+			print "$ip\t" . join(' ', map { "$_->{'hostname'}($_->{'iface'})" } @{ $ip_list->{$ip} }) . "\n";
+		}
+	}
+}

Modified: branches/0.32-stable/lib-conf
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/lib-conf?rev=583&op=diff
==============================================================================
--- branches/0.32-stable/lib-conf (original)
+++ branches/0.32-stable/lib-conf Thu Mar  6 16:16:56 2008
@@ -78,8 +78,12 @@
 sub Subst_vars {
     my ($str) = @_;
 
-    while ( $str =~ s/%([^%\s]*)%/$SUBST{"$1"}/ ) { }
-    return ($str);
+    foreach my $var (split '%', $str) {
+	next unless $var and defined $SUBST{$var};
+	$str =~ s/%$var%/$SUBST{$var}/;
+    }
+
+    return $str;
 }
 
 my $deferbuffer;

Modified: branches/0.32-stable/lib-net
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/lib-net?rev=583&op=diff
==============================================================================
--- branches/0.32-stable/lib-net (original)
+++ branches/0.32-stable/lib-net Thu Mar  6 16:16:56 2008
@@ -943,6 +943,26 @@
 	    }
 	    delete $M->{console} if $M->{console} and $M->{console} eq 'default';
 
+	    if ( defined $S->{'bonding'} ) {
+		foreach my $bond ( keys %{ $S->{'bonding'} } ) {
+		    if ( defined $S->{'bonding'}->{$bond}->{$mnamindexnum} ) {
+			@{ $M->{'bonding'}->{$bond} } = split ',', $S->{'bonding'}->{$bond}->{$mnamindexnum};
+		    }
+		    elsif ( defined $S->{'bonding'}->{$bond}->{'default'} ) {
+			@{ $M->{'bonding'}->{$bond} } = split ',', $S->{'bonding'}->{$bond}->{'default'};
+		    }
+		    else {
+			Abort( $ERR_SYNTAX, "No default bonding config defined for interface $bond" );
+		    }
+
+		    foreach my $iface ( @{ $M->{'bonding'}->{$bond} } ) {
+			if ( defined $S->{'interface'}->{$iface} ) {
+			    Abort( $ERR_SYNTAX, "Cannot define interface $iface: already used as a slave for $bond" );
+			}
+		    }
+		}
+	    }
+
             # vrrp?
             my $vrrp;
             foreach $j ( keys %{ $S->{vrrp} } ) {
@@ -977,11 +997,27 @@
                 # Definition de l'entree DNS pour cette interface
                 my $lan = $S->{interface}->{$i};
 
+		if (ref $lan eq 'HASH') {
+		    my $h = $lan;
+		    if ( defined $h->{$mnamindexnum} ) {
+			$lan = $h->{$mnamindexnum};
+		    }
+		    elsif ( defined $h->{'default'} ) {
+			$lan = $h->{'default'};
+		    }
+		    else {
+			Abort( $ERR_SYNTAX, "No default VLAN defined for interface $i" );
+		    }
+		}
+
                 $nam = $mnam . "." . $lan;
 
                 my $addr = $Z->{NETWORK}->{BY_NAME}->{$lan}->{network};
 
-                if ( defined $S->{ipstart}->{$lan} ) {
+		if ( defined $S->{'ip'}->{$lan}->{$mnamindexnum} ) {
+		    $start = $S->{'ip'}->{$lan}->{$mnamindexnum};
+		}
+                elsif ( defined $S->{ipstart}->{$lan} ) {
                     $start = $S->{ipstart}->{$lan};
                 }
                 elsif ( defined $S->{ipstart}->{default} ) {
@@ -996,8 +1032,9 @@
                 }
 
                 $M->{zone}->{$nam} = {};
-                $M->{zone}->{$nam}->{FIELD} =
-                  Address( $addr, $start, $ipindex );
+                $M->{zone}->{$nam}->{FIELD} = defined $S->{'ip'}->{$lan}->{$mnamindexnum}
+		    ? Address( $addr, $start, 0        )
+		    : Address( $addr, $start, $ipindex );
                 $M->{zone}->{$nam}->{TYPE} = 'A';
 
                 # Adresse ethernet (pas forcement avec dhcp, eg tftp)
@@ -1068,7 +1105,20 @@
                 my $r;
                 foreach $r ( keys %{ $S->{$i} } ) {
                     if ( $r =~ m/^route/ ) {
-                        $M->{route}->{$j}->{$r} = $S->{$i}->{$r};
+			if ( ref $S->{$i}->{$r} eq 'HASH' ) {
+			    if ( defined $S->{$i}->{$r}->{$mnamindexnum} ) {
+				$M->{'route'}->{$j}->{$r} = $S->{$i}->{$r}->{$mnamindexnum};
+			    }
+			    elsif ( defined $S->{$i}->{$r}->{'default'} ) {
+				$M->{'route'}->{$j}->{$r} = $S->{$i}->{$r}->{'default'};
+			    }
+			    else {
+				Abort( $ERR_SYNTAX, "No default route defined for interface $i" );
+			    }
+			}
+			else {
+			    $M->{'route'}->{$j}->{$r} = $S->{$i}->{$r};
+			}
                     }
                 }
 
@@ -1076,7 +1126,20 @@
                 my $dr;
                 foreach $dr ( keys %{ $S->{$i} } ) {
                     if ( $dr =~ m/^delroute/ ) {
-                        $M->{delroute}->{$j}->{$dr} = $S->{$i}->{$dr};
+			if ( ref $S->{$i}->{$dr} eq 'HASH' ) {
+			    if ( defined $S->{$i}->{$dr}->{$mnamindexnum} ) {
+				$M->{'delroute'}->{$j}->{$dr} = $S->{$i}->{$dr}->{$mnamindexnum};
+			    }
+			    elsif ( defined $S->{$i}->{$dr}->{'default'} ) {
+				$M->{'delroute'}->{$j}->{$dr} = $S->{$i}->{$dr}->{'default'};
+			    }
+			    else {
+				Abort( $ERR_SYNTAX, "No default delroute defined for interface $i" );
+			    }
+			}
+			else {
+			    $M->{'delroute'}->{$j}->{$dr} = $S->{$i}->{$dr};
+			}
                     }
                 }
 
@@ -1835,6 +1898,11 @@
         $net =~ s/^[^\.]+\.//;
         my $NET = $Z->{NETWORK}->{BY_NAME}->{$net};
 
+	if ( $M->{'ifup'}->{$nam} =~ /^bond/ ) {
+	    print "\tslaves          "
+		. join(' ', @{ $M->{'bonding'}->{ $M->{'ifup'}->{$nam} } } ) . "\n";
+	}
+
         if ($resolve) {
             print "\taddress         ", $M->{zone}->{$nam}->{FIELD}, "\n";
             print "\tnetmask         ", $NET->{netmask},   "\n";




More information about the pf-tools-commits mailing list