pf-tools commit: r574 [ccaillet-guest] - in /trunk: README.doc debian/changelog lib/PFTools/Net.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Mon Feb 4 10:44:09 UTC 2008


Author: ccaillet-guest
Date: Mon Feb  4 10:44:08 2008
New Revision: 574

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=574
Log:
* 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

Modified:
    trunk/README.doc
    trunk/debian/changelog
    trunk/lib/PFTools/Net.pm

Modified: trunk/README.doc
URL: http://svn.debian.org/wsvn/pf-tools/trunk/README.doc?rev=574&op=diff
==============================================================================
--- trunk/README.doc (original)
+++ trunk/README.doc Mon Feb  4 10:44:08 2008
@@ -45,6 +45,42 @@
     [host%%]
 	...
 	console.1 = default
+
+* <iface>.route%.HOSTNUM
+
+  [optional]
+
+  If defined the value of this directive reacts like <iface>.route% but is funtion
+  of the host number
+
+  Sample use :
+    To have a default route via gateway gw.vlan-srvcom.private for all hosts except
+    for host01 on eth2 which is on gw2.vlan-srvcom.private
+
+    [host%%]
+	...
+	eth2.route1.default	= default gw.vlan-srvcom.private
+	eth2.route1.1		= default gw2.vlan-srvcom.private
+
+  N.B. : If no exception is needed, use the default syntax <iface>.route% = <route_def>
+
+* interface.<iface>.HOSTNUM
+
+  [optional]
+
+  If defined, the value of this directive reacts like interface.<iface> but is
+  function of the host number
+
+  Sample use :
+
+    To have eth1 of host%% on vlan-filer except for host01 which is on vlan-linux
+
+    [host%%]
+	...
+	interface.eth1.default	= vlan-filer
+	interface.eth1.1	= vlan-linux
+
+  N.B. : if no exception is needed, use the default syntax interface.<iface> = <vlan>
 
 * ip.<vlan>.HOSTNUM
 

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=574&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Mon Feb  4 10:44:08 2008
@@ -24,6 +24,9 @@
     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)
+  * 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
 
   [ Thomas Parmelan ]
   * lib-net: if no comment is specified in a zone, network or server
@@ -35,7 +38,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>  Fri, 25 Jan 2008 14:44:33 +0100
+ -- Christophe Caillet <quadchris at free.fr>  Mon, 04 Feb 2008 11:28:46 +0100
 
 pf-tools (0.32.48-1) unstable; urgency=low
 

Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=574&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Mon Feb  4 10:44:08 2008
@@ -1046,8 +1046,20 @@
 		}
 
 		# Definition de l'entree DNS pour cette interface
-		my $lan = $S->{'interface'}->{$i};
-
+		my $lan ;
+		if ( ref ( $S->{'interface'}->{$i} ) eq 'HASH' ) {
+			if ( defined $S->{'interface'}->{$i}->{$mnamindexnum} ) {
+				$lan = $S->{'interface'}->{$i}->{$mnamindexnum} ;
+				print "Adding vlan $lan for interface $i on number $mnamindexnum\n" ;
+			} elsif ( ! defined $S->{'interface'}->{$i}->{'default'} ) {
+				Abort( $ERR_SYNTAX, "No default vlan defined for interface ".$i ) ;
+			} else {
+				$lan = $S->{'interface'}->{$i}->{'default'} ;
+				print "Adding default vlan $lan for interface $i\n" ;
+			}
+		}else {
+			$lan = $S->{'interface'}->{$i} ;
+		}
 		$nam = $mnam . "." . $lan;
 
 		my $addr = $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'network'};
@@ -1160,7 +1172,17 @@
 		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'} ) {
+				Abort ( $ERR_SYNTAX, "No default route defined for interface ".$i ) ;
+			    } else {
+				$M->{'route'}->{$j}->{$r} = $S->{$i}->{$r}->{'default'} ;
+			    }
+			} else {
+			    $M->{'route'}->{$j}->{$r} = $S->{$i}->{$r};
+			}
 		    }
 		}
 
@@ -1168,7 +1190,17 @@
 		my $dr;
 		foreach $dr ( keys %{ $S->{$i} } ) {
 		    if ( $dr =~ m/^delroute/ ) {
-			$M->{'delroute'}->{$j}->{$dr} = $S->{$i}->{$dr};
+			if ( ref ( $S->{$i}->{$r} ) eq 'HASH' ) {
+			    if ( defined $S->{$i}->{$r}->{$mnamindexnum} ) {
+				$M->{'delroute'}->{$j}->{$r} = $S->{$i}->{$r}->{$mnamindexnum} ;
+			    } elsif ( ! defined $S->{$i}->{$r}->{'default'} ) {
+				Abort ( $ERR_SYNTAX, "No default route defined for interface ".$i ) ;
+			    } else {
+				$M->{'delroute'}->{$j}->{$r} = $S->{$i}->{$r}->{'default'} ;
+			    }
+			} else {
+			    $M->{'delroute'}->{$j}->{$r} = $S->{$i}->{$r};
+			}
 		    }
 		}
 




More information about the pf-tools-commits mailing list