pf-tools commit: r601 [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 Jun 9 09:48:59 UTC 2008


Author: ccaillet-guest
Date: Mon Jun  9 09:48:59 2008
New Revision: 601

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=601
Log:
Adding the new syntax for avoiding duplication of values when we declare a
tagged interface (see README.doc for more explanations) 

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=601&op=diff
==============================================================================
--- trunk/README.doc (original)
+++ trunk/README.doc Mon Jun  9 09:48:59 2008
@@ -102,6 +102,50 @@
 	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>\.(TAG)?[\d]+
+
+  [optional]
+
+  You can use two different syntax for defining tagged (802.1Q) interface the first one
+  and the oldest is :
+
+    [host%%]
+	...
+	interface.eth1\.48	= vlan-abv1-nbpub
+
+  which defines the tagged interface eth1.48 on host in vlan vlan-abv1-nbpub. The constraint
+  with this one is that we MUST duplicate the value defined on vlan definition for tag and
+  the one defined when we declare the interface. When we use this one only a warning is shown
+  if the tag defined in interface declaration and the one defined in vlan declaration is
+  different.
+
+  The new one which is equivalent is :
+
+    [host%%]
+	...
+	interface.eth1\.TAG1	= vlan-abv1-nbpub
+
+  When we use this one the tag is automatically fetched from the vlan declaration and the
+  interface is declared in the same way as the older syntax. If the tag is not defined on vlan
+  declaration, an abort occured with a syntax error.
+
+  N.B. : the route(s) potentially defined, MUST BE declared with the same syntax as interface.
+  For exemple we MUST declare like :
+
+    [host%%]
+	...
+	interface.eth1\.TAG1	= vlan-abv1-nbpub
+	eth1\.TAG1.route1	= default gw-abv1.vlan-abv1-nbpub.private
+
+  or like :
+
+    [host%%]
+	...
+	interface.eth1\.48	= vlan-abv1-nbpub
+	eth1\.48.route1		= default gw-abv1.vlan-abv1-nbpub.private
+
+  If you mix the syntax IT DOESN'T WORK !!!
 
 * interface.<iface>.HOSTNUM
 

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=601&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Mon Jun  9 09:48:59 2008
@@ -13,8 +13,10 @@
     on certain configuration cases
   * Patching mk_dhcp and mk_pxelinux according to changes on HASH structure
     introduced by fixes on Mk_zone and Add_server
-
- -- Christophe Caillet <quadchris at free.fr>  Tue, 03 Jun 2008 17:06:39 +0200
+  * Adding the new syntax for avoiding duplication of values when we declare a
+    tagged interface (see README.doc for more explanations) 
+
+ -- Christophe Caillet <quadchris at free.fr>  Mon, 09 Jun 2008 11:42:30 +0200
 
 pf-tools (0.33-0WIP1) unstable; urgency=low
 

Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=601&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Mon Jun  9 09:48:59 2008
@@ -1023,8 +1023,16 @@
 		    $lan = $S->{'interface'}->{$i} ;
 		}
 		
-		if ( $i =~ /^(?:eth|bond)[\d]+\.([\d]+)$/ && $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} ) {
-		    Warn ( $ERR_SYNTAX, "Tag ".$1." differs from defined tag for vlan ".$lan." on ".$i." for host ".$mnam ) if ( $1 != $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} );
+		if ( $i =~ /^(?:eth|bond)[\d]+\.((TAG)?[\d]+)$/ ) {
+		    my $tag = $1 ;
+		    if ( defined $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} ) {
+			Warn ( $ERR_SYNTAX, "Tag ".$tag." differs from defined tag "
+				.$Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'}." for vlan ".$lan." on ".$i." for host ".$mnam )
+			    if ( $tag =~ /^[\d]+/ && $tag != $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} );
+		    }
+		    else {
+			Abort ( $ERR_SYNTAX, "Tag is not defined for vlan ".$lan ); # if ( $1 =~ /^TAG/ );
+		    }
 		}
 		
 		$nam = $mnam . "." . $lan;
@@ -1131,6 +1139,11 @@
 		    }
 		}
 
+		# Traduction du tag si format <iface>\.TAG[\d]+
+		if ( $j =~ /TAG[\d]+$/ ) {
+			$j =~ s/TAG[\d]+$/$Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'}/ ;
+		}
+
 		# Definition de l'entree dans /etc/network/interface
 		if ( defined( $S->{'dhcp'} ) && $i eq $S->{'dhcp'} ) {
 		    $M->{'ifup'}->{'dhcp'} = $j;




More information about the pf-tools-commits mailing list