pf-tools/pf-tools: 6 new changesets

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Fri Jan 9 07:28:07 UTC 2015


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/d2a306a2a77a
changeset: 1432:d2a306a2a77a
user:      melkor <melkor at sitadelle.com>
date:      Wed Jan 07 16:39:43 2015 +0100
description:
new documentation version for new specifications

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/53ccec23dab3
changeset: 1433:53ccec23dab3
user:      melkor <melkor at sitadelle.com>
date:      Fri Jan 09 08:18:23 2015 +0100
description:
bugfix

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/aa6fc04b4998
changeset: 1434:aa6fc04b4998
user:      melkor <melkor at sitadelle.com>
date:      Fri Jan 09 08:18:48 2015 +0100
description:
bugfix

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/1cf93b5069cb
changeset: 1435:1cf93b5069cb
user:      melkor <melkor at sitadelle.com>
date:      Fri Jan 09 08:19:37 2015 +0100
description:
rewritting regex

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/e23c4b2ec775
changeset: 1436:e23c4b2ec775
user:      melkor <melkor at sitadelle.com>
date:      Fri Jan 09 08:20:02 2015 +0100
description:
delete useless feature

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/e07431ad206c
changeset: 1437:e07431ad206c
user:      melkor <melkor at sitadelle.com>
date:      Fri Jan 09 08:28:03 2015 +0100
description:
merge

diffstat:

 .hgtags                                                                |    1 +
 debian/changelog                                                       |    6 +-
 doc/hostfile-links-sample                                              |   80 ++-
 doc/hostfile-syntax                                                    |   24 +-
 doc/network-interface.sample                                           |   46 ++
 doc/networkfile-syntax                                                 |   18 +-
 doc/networkfile.sample                                                 |  199 ++++++---
 lib/PFTools/Conf/Host.pm                                               |    1 -
 lib/PFTools/Utils.pm                                                   |   41 +-
 t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn |    1 +
 t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy    |    1 -
 t/13.conf.t                                                            |    7 +-
 t/20.files.t                                                           |  121 +++---
 t/21.interfaces.tpl.t                                                  |    8 +-
 templates/interfaces.tpl                                               |    6 +-
 15 files changed, 365 insertions(+), 195 deletions(-)

diffs (864 lines):

diff -r 60907fe0b548 -r e07431ad206c .hgtags
--- a/.hgtags	Wed Dec 31 15:35:28 2014 +0100
+++ b/.hgtags	Fri Jan 09 08:28:03 2015 +0100
@@ -74,3 +74,4 @@
 fb1995fde292064a8b6e7c8a92d8bc44ece8f605 next-gen
 fe2fae3e6494f1648b3395cb206d90691e1ea5f2 pf-tools-0.32.17-1
 3add457e9eb007ba7d3f49d314c4d8942a6c12c5 1.0.1-1
+280e77529c5ec59222350688024ec8f36e942b93 1.1.0-1
diff -r 60907fe0b548 -r e07431ad206c debian/changelog
--- a/debian/changelog	Wed Dec 31 15:35:28 2014 +0100
+++ b/debian/changelog	Fri Jan 09 08:28:03 2015 +0100
@@ -1,9 +1,11 @@
-pf-tools (1.1.0-1) UNRELEASED; urgency=medium
+pf-tools (1.1.0-1) unstable; urgency=medium
 
   * update templates, default conf
   * pull repository first in case of rspawn
+  * resolve gateway when using named @route
+  * reverse order in sitezone to prevent problems with tcp-wrapper and PARANOID
 
- -- Stéphane Pontier <shad at sitadelle.com>  Wed, 31 Dec 2014 13:10:06 +0100
+ -- Stéphane Pontier <shad at sitadelle.com>  Thu, 08 Jan 2015 16:13:12 +0100
 
 pf-tools (1.0.1-1) unstable; urgency=low
 
diff -r 60907fe0b548 -r e07431ad206c doc/hostfile-links-sample
--- a/doc/hostfile-links-sample	Wed Dec 31 15:35:28 2014 +0100
+++ b/doc/hostfile-links-sample	Fri Jan 09 08:28:03 2015 +0100
@@ -1,40 +1,68 @@
-[link::vlan-systeme]
-	type.default	= ether
-	dev.default	= eth0
-	mac.0		= 00:00:00:00:00:00
-	vlan.default	= vlan-systeme
-	ipv4.default	= 3.0
-	ipv4.1		= 3.12
+[link::net-system]
+	dev     = eth0
+	mac.0	= 00:00:00:00:00:00
+	ip		= 3.0
+	ip.1    = 3.12
 
-[link::vlan-admindsi]
-	type.default	= ether
-	dev.default	= eth0.TAG1
-	ipv4.default	= 12
+[link::net-admindsi]
+	dev	= eth0
+	ip	= 12
+	tag	= vlan-admindsi
 
-[link::vlan-pfds-ext]
-	type.default	= bond
-	dev.default	= bond0
-	slaves.default	= eth2,eth3
-	options.default	= mode=active-backup,miimon=100
-	options.1	= mode=802.3ad,xmit_hash_policy=layer3+4,miimon=100
-	ipv4.default	= 92
+[link::net-pfds-ext]
+	dev			= bond0
+	ip			= 92
 	@route		= 224.0.0.0/4
 	@route		= default via GATEWAY
+	@option		= slaves eth0 eth1
+	@option		= bond_mode active-backup
+	@option		= bond_miimon 100
+
+[link::net-pfds-ext::1]
+	dev			= bond0
+	comment		= another IP on the same VLAN
+	ip			= link::mirrors
 	
+[link::net-pfds-ext::2]
+	dev			= eth2:1
+	comment		= IP aliasing on the same VLAN
+	ip			= 98
+	
+[link::net-pfds-ext-v6]
+	dev			= bond0
+	ip			= 1077:af68:1c24:7806
+	@route		= default via GATEWAY
+
+[link::net-serpe]
+	dev			= lo
+	ip		 	= link::vip-serpe
+
+[link::net-dhcp]
+	dev		= br0
+	method	= dhcp
+	@option	= bridge_ports eth3 eth4
+
+[zelda::net-hyrule]
+	dev			= princess0
+	method		= captive
+
 [deployment]
-	mode.default	= debian
-	arch.default	= amd64
-	distrib.default	= lenny
+	mode	= debian
+	arch	= amd64
+	distrib	= wheezy
+	preseed = standard-wheezy-preseed.tpl
 
 [hostgroup]
 	number		= 2
 	order		= 1
 
 [boot]
-	pxefilename.default	= pxelinux.0
-	kernel.default		= vmlinuz-2.6.26.5-universal-grm2.1.12
-	console.default		= default
+	pxefilename = pxelinux.0
+	pxetemplate = standard-wheezy-installer
+	initrd  = initrd.img-3.2.0-4-amd64
+	kernel  = vmlinuz-3.2.0-4-amd64
+	console = default
 
 [dns]
-	resolver.default	= vip-spawn.private,nscache.private
-	shortname.default	= vlan-systeme
+	resolver	= vip-spawn.private,nscache.private
+	shortname	= vlan-systeme
diff -r 60907fe0b548 -r e07431ad206c doc/hostfile-syntax
--- a/doc/hostfile-syntax	Wed Dec 31 15:35:28 2014 +0100
+++ b/doc/hostfile-syntax	Fri Jan 09 08:28:03 2015 +0100
@@ -1,15 +1,19 @@
-[link::<NETWORK_NAME>]
-	! type[.%HOSTNUM%]		::= ether|bond|bridge|tun|tap
+[link::<VLAN_NAME>::<NETWORK_NAME>[::LINK_NUM]]
 	! dev[.%HOSTNUM%]		::= <IFACE_NAME> || NONE if link doesn't exist for the specified %HOSTNUM%
 	! mac.%HOSTNUM%			::= <MAC_ADDR> WARNING this directive MUST BE defined for interface which is used for deployment
-	? slaves[.%HOSTNUM%]		::= comma separated list of <IFACE>, WARNING this directive is mandatory if type[.%HOSTNUM%] is defined
-					    as a bonding interface will be ignored if type[.%HOSTNUM%] is not
-	? options[.%HOSTNUM%]		::= see interfaces docs for misc options
-	! ipv4[.%HOSTNUM%]		::= <IPV4_ADDR> or offset. If default is used then act as old ipstart directive
-	? ipv6[.%HOSTNUM%]		::= <IPV6_ADDR> or offset. If default is used then act as old ipstart directive
-	? iface_opt[%HOSTNUM%]		::= <IFACE_OPT> define here iface options (ip link syntax)
+	! ip[.%HOSTNUM%]		::= <IPV4_ADDR> or offset. If default is used then act as old ipstart directive
 	? @route[.default|%HOSTNUM%]	::= <SUBNET>/<NETMASK> [via <GATEWAY>] (ip route syntax)
-	? @route6[.default|%HOSTNUM%]	::= <SUBNET>/<NETMASK> [via <GATEWAY>] (ip route syntax)
+        ? method                        ::= <STR> like dhcp, static, manual ... (default static)
+        ? allow                         ::= <STR> like auto, hotplug ... (default auto)
+        ? @mapping_rules                ::= <STR> all mapping rules as desctibes for /etc/network/interfaces
+        ? version                       ::= <STR> inet, inet6, ipx (default inet or inet6)
+        ? @pre-up                       ::= <STR> command run before bringing the interface up
+        ? @up                           ::= <STR> command run when interface is up
+        ? @postup                       ::= <STR> command after bringing the interface up
+        ? @down                         ::= <STR> command run when interface is down
+        ? @pre-down                     ::= <STR> command before taking the interface down
+        ? @post-down                    ::= <STR> command after  taking  the  interface  down
+        ? @option                       ::= <STR> command or option adding in iface section
 
 [deployment]
 	? os_type				::= redhat|debian|centos ...
@@ -29,6 +33,8 @@
 	? order		::= <INT>
 	! hostname	::= <STR>[%%__]? if the string <STR> is ended by one or more % then each percent is a digit for indexing hosts _ indicates the nodes (clustering)
 	? hosttype	::= <STR> if defined this key is used for %HOSTTYPE% instead of the derived one from hostfile name
+        ? @source[.%HOSTNUM%]           ::= <FILE_NAME> include stanzas from other files for /etc/network/interfaces
+        ? @source-directory[.%HOSTNUM%] ::= <PATH_NAME> source multiple files at once for /etc/network/interfaces
 
 [boot]
 	? pxefilename[.%HOSTNUM%]	::= <FILENAME> pxelinux.0 is used by default (generic legacy PXE boot) need to change if UEFI is used
diff -r 60907fe0b548 -r e07431ad206c doc/network-interface.sample
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/network-interface.sample	Fri Jan 09 08:28:03 2015 +0100
@@ -0,0 +1,46 @@
+auto lo
+iface lo inet loopback
+
+iface lo inet static
+    address 82.0.0.1
+    netmask 255.255.255.255
+
+iface eth3 inet dhcp
+
+auto eth0
+iface eth0 inet static
+    address 10.128.3.6
+    netmask 255.255.0.0
+    network 10.128.0.0
+    dns-nameservers 10.1.1.254 10.1.167.0 10.1.167.1
+    dns-search private
+
+auto bond0
+iface bond0 inet static
+    address 93.25.78.12
+    netmask 255.255.255.0
+    network 93.25.78.0
+    gateway 93.25.78.1
+    slaves  eth2 eth3
+    bond-mode active-backup
+    bond-miimon 100
+    bond-downdelay 200
+    bond-updelay 200
+
+auto bond0
+iface bond0 inet6 static
+    address 2a02:8400:4:cb:10e7:9a22:f666:9daf
+    netmask 64
+    gateway 2a02:8400:4:cb::1
+
+auto eth0.124
+iface eth0.124 inet static
+    address 10.111.12.14
+    netmask 255.255.255.0
+    network 10.111.12.0
+    up ip r a 10.111.37.0/24 via 10.111.12.1 dev eth0.124
+    down ip r a 10.111.37.0/24 via 10.111.12.1 dev eth0.124
+
+# Bridge setup
+iface br0 inet dhcp
+    bridge_ports eth0 eth1
diff -r 60907fe0b548 -r e07431ad206c doc/networkfile-syntax
--- a/doc/networkfile-syntax	Wed Dec 31 15:35:28 2014 +0100
+++ b/doc/networkfile-syntax	Fri Jan 09 08:28:03 2015 +0100
@@ -24,17 +24,19 @@
 	! dhcpvlan	::= <NETWORK_NAME>
 	! console	::= (default|ttyS0,115200n8)
 
+[<VLAN_NAME>]
+        ! type          ::= vlan
+        ! tag           ::= <INT> 802.1q tag 
+	? comment	::= <STR>
+        ? site          ::= <STR> FIXME
+
 [<NETWORK_NAME>]
 	! type		::= network
 	? comment	::= <STR>
-	! site		::= <STR>
-	? tag		::= <INT> 802.1q tag
-	! network	::= <NETWORK> define here the network in IPv4 format in CIDR format
-	? network6	::= <NETWORK> define here the prefix in IPv6 format in CIDR format
-	! scope		::= private|public, if private is defined this network will be ONLY added on zone private for site
-	? gateway	::= <IPV4_ADDR> or offset
-# TODO
-#	? gateway6	::= <IPV6_ADDR> or offset
+	! network	::= <NETWORK> define here the network format in CIDR format
+	! scope		::= global|local, if private is defined this network will be ONLY added on zone private for site
+	? gateway	::= <IP_ADDR> or offset
+        ? network_type  ::= anycast, multicast, unicast => allow to use one IP several times
 
 [<SERVER_NAME>]
 	! type							::= server
diff -r 60907fe0b548 -r e07431ad206c doc/networkfile.sample
--- a/doc/networkfile.sample	Wed Dec 31 15:35:28 2014 +0100
+++ b/doc/networkfile.sample	Fri Jan 09 08:28:03 2015 +0100
@@ -1,88 +1,145 @@
 [cbv4-pfds]
-	type		= site
-	coment		= Root site PFDS
-	location	= Courbevoie
-	room		= 010D (ex Tele 2)
-	state		= ROOT
-	dhcpvlan	= vlan-systeme
-	console		= default
-	zone		= private
+    type		= site
+    coment		= Root site PFDS
+    location	= Courbevoie
+    room		= 010D (ex Tele 2)
+    state		= ROOT
+    dhcpvlan	= vlan-systeme
+    console		= default
+    zone		= private
 
 [cbv4]
-	type		= site
-	coment		= POP Courbevoie (CBV4)
-	location	= Courbevoie
-	room		= 010D (ex Tele 2)
-	state		= EDGE
-	console		= default
-	zone		= private
-	dhcpvlan	= vlan-systeme
+    type		= site
+    coment		= POP Courbevoie (CBV4)
+    location	= Courbevoie
+    room		= 010D (ex Tele 2)
+    state		= EDGE
+    console		= default
+    zone		= private
+    dhcpvlan	= vlan-systeme
 
 [private]
-	type		= zone
-	comment 	= Zone de gestion interne plateforme
-	serial		= AUTO
-	soa			= Deploy00.private.
-	mail		= dnsmaster at private
-	refresh		= 6H      ; Refresh (6 hours)
-	retry		= 1H      ; Retry (1 hour)
-	expire		= 7D      ; Expire (7 days)
-	negttl		= 1H      ; Negative TTL (1 hours)
-	ttl			= 1D      ; TTL (1 day)
-	@ns			= deploy00.vlan-systeme.private.
-	@ns			= deploy01.vlan-systeme.private.
-	@mx			= 1       mf.private.
-	@mx			= 2       mf00.private.
-	@mx			= 2       mf01.private.
-	console		= ttyS0,115200n8
+    type		= zone
+    comment 	= Zone de gestion interne plateforme
+    serial		= AUTO
+    soa			= Deploy00.private.
+    mail		= dnsmaster at private
+    refresh		= 6H      ; Refresh (6 hours)
+    retry		= 1H      ; Retry (1 hour)
+    expire		= 7D      ; Expire (7 days)
+    negttl		= 1H      ; Negative TTL (1 hours)
+    ttl			= 1D      ; TTL (1 day)
+    @ns			= deploy00.vlan-systeme.private.
+    @ns			= deploy01.vlan-systeme.private.
+    @mx			= 1       mf.private.
+    @mx			= 2       mf00.private.
+    @mx			= 2       mf01.private.
+    console		= ttyS0,115200n8
 
 [vip-spawn]
-	type				= server
-	site				= cbv4-pfds
-	comment				= VIP for accessing to spawn functionnality
-	order				= 2
-	number				= 1
-	ipv4.vlan-systeme	= 167.254
-	ipv4.vlan-pfds-ext	= 99
-	shortname			= vlan-systeme
-	alias.mirrors		= vlan-systeme
-	alias.cvs			= vlan-systeme
-	alias.nsprivate		= vlan-systeme
-	alias.nscache		= vlan-systeme
-	alias.mf			= vlan-systeme
-	alias.vip-deploy	= vlan-systeme
+    type				= server
+    site				= cbv4-pfds
+    comment				= VIP for accessing to spawn functionnality
+    order				= 2
+    number				= 1
+    ip.net-systeme		= 167.254
+    ip.net-pfds-ext		= 99
+    shortname			= net-systeme
+    alias.mirrors		= net-systeme
+    alias.cvs			= net-systeme
+    alias.nsprivate		= net-systeme
+    alias.nscache		= net-systeme
+    alias.mf			= net-systeme
+    alias.vip-deploy	= net-systeme
+
+[vip-serpe]
+	type			= server
+	comment			= IP Anycast pour serpe
+	site			= ALL
+	order			= 2
+	number			= 1
+	shortname		= net-serpe
+	ip.net-serpe	= 217
 
 [network-common]
-	type	= include
+    type	= include
 
+[vlan-systeme]
+    type    = vlan
+    tag     = 13
+    site    = ALL
+    
 [vlan-pfds-ext]
-	type	= network
-	site	= cbv4-pfds
-	network	= 93.20.126.0/24
-	tag		= 40
-	netmask	= 255.255.255.0
-	scope	= public
-	gateway	= 254
+    type    = vlan
+    tag	    = 40
+    site    = cbv4-pfds
+
+[vlan-serpe]
+    type    = vlan
+    tag	    = 48
+    site    = ALL
 
 [vlan-admindsi]
-	type	= network
-	site	= cbv4-pfds
-	network	= 10.111.204.0/24
-	tag		= 302
-	scope	= private
-	gateway	= 254
+    type    = vlan
+    tag	    = 302
+    site    = cbv4-pfds
 
 [vlan-middledsi]
-	type	= network
-	site	= cbv4-pfds
-	network	= 10.111.220.0/24
-	tag		= 372
-#	netmask	= /24
-	scope	= private
-	gateway = 254
+    type    = vlan
+    tag	    = 372
+    site    = cbv4-pfds
+
+[net-pfds-ext]
+    type	= network
+	comment	= IP unique
+    network	= 93.20.126.0/24
+    scope	= global
+    gateway	= 254
+
+[net-pfds-ext-v6]
+    type	= network
+	comment	= IP unique
+    network	= 2a02:8400:4:cb/64
+    scope	= global
+    gateway	= 1
+
+[net-systeme]
+    type	= network
+	comment	= IP unique sur un site donné
+    network	= 10.128.0.0/16
+    scope	= local
+    gateway	= 1
+
+[net-serpe]
+    type	= network
+	comment	= réseau anycast
+    network	= 93.21.12.216/30
+    scope	= global
+    gateway	= 217
+	routing	= anycast
+
+[net-multicast]
+    type	= network
+	comment	= réseau multicast
+    network	= 224.0.0.0/4
+    scope	= global
+    routing	= multicast
+
+[net-admindsi]
+    type	= network
+    network	= 10.111.204.0/24
+    scope	= local
+    gateway	= 254
+
+[net-middledsi]
+    type	= network
+    network	= 10.111.220.0/24
+    tag		= 372
+    scope	= private
+    gateway = 254
 
 [admins]
-	type	= service
-	comment	= Administration hosts
-	site	= cbv4-pfds
-	@host	= hostfile-cbv4-spawn
+    type	= service
+    comment	= Administration hosts
+    site	= cbv4-pfds
+    @host	= hostfile-cbv4-spawn
diff -r 60907fe0b548 -r e07431ad206c lib/PFTools/Conf/Host.pm
--- a/lib/PFTools/Conf/Host.pm	Wed Dec 31 15:35:28 2014 +0100
+++ b/lib/PFTools/Conf/Host.pm	Fri Jan 09 08:28:03 2015 +0100
@@ -230,7 +230,6 @@
                 }
 
                 foreach my $ip_type ( 'ipv4', 'ipv6' ) {
-                    next if not $pf_config->{'features'}->{$ip_type};
                     next if not $new_iface_ref->{$ip_type};
 
                     my $ip_type_suffix = get_suffix_from_ip_type($ip_type);
diff -r 60907fe0b548 -r e07431ad206c lib/PFTools/Utils.pm
--- a/lib/PFTools/Utils.pm	Wed Dec 31 15:35:28 2014 +0100
+++ b/lib/PFTools/Utils.pm	Fri Jan 09 08:28:03 2015 +0100
@@ -1399,13 +1399,15 @@
     my $routes     = {};
     foreach my $iface ( 'lo', sort keys %{ $host_ref->{'interfaces'} } ) {
         push @{ $interfaces->{'__order'} }, $iface;
-        $interfaces->{$iface}
-            = __build_interface_lines_ref( $iface, $routes, $host_ref,
-            $pf_config, $domain, @nameservers );
+        $interfaces->{$iface} = __build_interface_lines_ref(
+            $hostname,  $site_name, $global_config,
+            $iface,     $routes,    $host_ref,
+            $pf_config, $domain,    @nameservers
+        );
     }
 
 DESTINATION:
-    foreach my $dest ( keys %{$routes} ) {
+    foreach my $dest ( sort keys %{$routes} ) {
 
         # Multiple routes
         if ( scalar @{ $routes->{$dest} } > 1 ) {
@@ -1463,7 +1465,10 @@
 =cut
 
 sub __build_interface_lines_ref {
-    my ( $iface, $routes, $host_ref, $pf_config, $domain, @nameservers ) = @_;
+    my ($hostname,  $site_name, $global_config,
+        $iface,     $routes,    $host_ref,
+        $pf_config, $domain,    @nameservers
+    ) = @_;
 
     my @iface_lines;
 
@@ -1490,6 +1495,10 @@
         push @iface_lines, qq{\tslaves\t\t} . $if_part->{'slaves'};
     }
 
+    my $hosttype
+        = get_hosttype_from_hostname( $hostname, $global_config, $site_name );
+    my $subst_ref = init_subst( $hostname, $hosttype, $pf_config );
+    my $site_ref = get_site_config( $site_name, $global_config );
     foreach my $ip_type ( 'ipv4', 'ipv6' ) {
         next if not $pf_config->{'features'}->{$ip_type};
         next if not $if_part->{$ip_type};
@@ -1497,7 +1506,7 @@
         my $ip = NetAddr::IP->new( $if_part->{$ip_type} );
         if ( $ip->{isv6} ) {
             my $cidr = $ip->cidr();
-            $cidr =~ s/\/(.*)$/$1/;
+            $cidr =~ s{^.*/(.*)$}{$1}xmsge;
             push @iface_lines,
                 qq{\taddress\t\t} . $ip->addr(),
                 qq{\tnetmask\t\t} . $ip->cidr(),
@@ -1512,13 +1521,24 @@
         }
 
         # Routes
-        # FIXME add test cases in t/* for non-default routes
         my $suffix = get_suffix_from_ip_type($ip_type);
         foreach my $route ( @{ $if_part->{ '@route' . $suffix } } )
         {    ## no critic(RequireInterpolationOfMetachars);
             if ($route =~ m{ \A \s* (\S+) \s* (?: via \s* \S+ )? \s* \z }xms )
             {
                 my $destination = $1;
+                my @resroute    = __search_and_replace_ip(
+                    {   line          => $route,
+                        hostname      => $hostname,
+                        ip_type       => $ip_type,
+                        site_name     => $site_name,
+                        subst_ref     => $subst_ref,
+                        host_ref      => $host_ref,
+                        site_ref      => $site_ref,
+                        global_config => $global_config,
+                    }
+                );
+                $route = $resroute[0];
                 push @{ $routes->{$destination} }, qq{$iface $route};
             }
         }
@@ -1750,8 +1770,13 @@
             number  => $merged_zone_ref->{$server}->{'number'},
         };
 
+        # need to put myserver%% before myserver otherwise, mkrdns only list
+        # myserver for differents ip and then tcp-wrapper blocks connections
+        # when we are trying to connect to a specific myserver%%
         my @records = ();
-        foreach my $field ( sort keys %{ $merged_zone_ref->{$server} } ) {
+        foreach my $field ( sort { $b cmp $a }
+            keys %{ $merged_zone_ref->{$server} } )
+        {
             next if $field eq 'comment';
             next if $field eq 'number';
 
diff -r 60907fe0b548 -r e07431ad206c t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn
--- a/t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn	Wed Dec 31 15:35:28 2014 +0100
+++ b/t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn	Fri Jan 09 08:28:03 2015 +0100
@@ -59,3 +59,4 @@
 #	slaves = eth1,eth2
 #	@route = default via GATEWAY
 #	vlan = vlan-pfds-ext
+	@route = 1.2.3.4 via cbv4-rdeploy00.vlan-public2.private
diff -r 60907fe0b548 -r e07431ad206c t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy
--- a/t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy	Wed Dec 31 15:35:28 2014 +0100
+++ b/t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy	Fri Jan 09 08:28:03 2015 +0100
@@ -28,4 +28,3 @@
 	dev.0   = eth2
 	dev.1   = NONE
 	ipv4    = 44
-
diff -r 60907fe0b548 -r e07431ad206c t/13.conf.t
--- a/t/13.conf.t	Wed Dec 31 15:35:28 2014 +0100
+++ b/t/13.conf.t	Fri Jan 09 08:28:03 2015 +0100
@@ -751,6 +751,7 @@
         'type'  => 'bond',
         '@route' => [
             'default via GATEWAY',
+            '1.2.3.4 via cbv4-rdeploy00.vlan-public2.private',
         ],
         'dev'     => 'bond0',
         'ipv4'    => '97',
@@ -991,7 +992,8 @@
                                         'options' => 'miimon=100,mode=active-backup',
                                         'slaves'  => 'eth2 eth3',
                                         '@route'  => [
-                                            'default via 192.168.1.254'
+                                            'default via 192.168.1.254',
+                                            '1.2.3.4/32 via cbv4-rdeploy00.vlan-public2.private',
                                         ],
                                         'vlan' => 'vlan-pfds-ext'
                                     },
@@ -1042,7 +1044,8 @@
                                         'options' => 'miimon=100,mode=active-backup',
                                         'slaves'  => 'eth2 eth3',
                                         '@route'  => [
-                                            'default via 192.168.1.254'
+                                            'default via 192.168.1.254',
+                                            '1.2.3.4/32 via cbv4-rdeploy00.vlan-public2.private',
                                         ],
                                         'vlan' => 'vlan-pfds-ext'
                                     },
diff -r 60907fe0b548 -r e07431ad206c t/20.files.t
--- a/t/20.files.t	Wed Dec 31 15:35:28 2014 +0100
+++ b/t/20.files.t	Fri Jan 09 08:28:03 2015 +0100
@@ -182,102 +182,102 @@
     q{; vip-spawn: VIP for spawn services},
     q{; number: 1},
     q{;----------------------------------------------------------------------------},
+    qq{vip-spawn.vlan-systeme\tIN A\t10.1.1.254},
+    qq{vip-spawn.vlan-pfds-ext\tIN A\t192.168.1.99},
+    qq{vip-spawn\tIN CNAME\tvip-spawn.vlan-systeme},
+    qq{vip-deploy\tIN CNAME\tvip-spawn.vlan-systeme},
+    qq{nsprivate\tIN CNAME\tvip-spawn.vlan-systeme},
+    qq{nscache\tIN CNAME\tvip-spawn.vlan-systeme},
+    qq{mirrors\tIN CNAME\tvip-spawn.vlan-systeme},
+    qq{mf\tIN CNAME\tvip-spawn.vlan-systeme},
     qq{cvs\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{mf\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{mirrors\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{nscache\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{nsprivate\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{vip-deploy\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{vip-spawn\tIN CNAME\tvip-spawn.vlan-systeme},
-    qq{vip-spawn.vlan-pfds-ext\tIN A\t192.168.1.99},
-    qq{vip-spawn.vlan-systeme\tIN A\t10.1.1.254},
     q{},
     q{; cbv4-pfds-filer: NAS for CBV4-PFDS site},
     q{; number: 2},
     q{;----------------------------------------------------------------------------},
-    qq{cbv4-pfds-filer\tIN CNAME\tcbv4-pfds-filer.vlan-systeme},
+    qq{cbv4-pfds-filer01.vlan-systeme\tIN A\t10.1.2.1},
+    qq{cbv4-pfds-filer01\tIN CNAME\tcbv4-pfds-filer01.vlan-systeme},
+    qq{cbv4-pfds-filer00.vlan-systeme\tIN A\t10.1.2.0},
+    qq{cbv4-pfds-filer00\tIN CNAME\tcbv4-pfds-filer00.vlan-systeme},
     qq{cbv4-pfds-filer.vlan-systeme\tIN A\t10.1.2.0},
     qq{cbv4-pfds-filer.vlan-systeme\tIN A\t10.1.2.1},
-    qq{cbv4-pfds-filer00\tIN CNAME\tcbv4-pfds-filer00.vlan-systeme},
-    qq{cbv4-pfds-filer00.vlan-systeme\tIN A\t10.1.2.0},
-    qq{cbv4-pfds-filer01\tIN CNAME\tcbv4-pfds-filer01.vlan-systeme},
-    qq{cbv4-pfds-filer01.vlan-systeme\tIN A\t10.1.2.1},
+    qq{cbv4-pfds-filer\tIN CNAME\tcbv4-pfds-filer.vlan-systeme},
     q{},
     q{; filer-all: filer with ip common on all site},
     q{; number: 2},
     q{;----------------------------------------------------------------------------},
-    qq{filer-all\tIN CNAME\tfiler-all.vlan-systeme},
+    qq{filer-all01.vlan-systeme\tIN A\t10.1.2.11},
+    qq{filer-all01\tIN CNAME\tfiler-all01.vlan-systeme},
+    qq{filer-all00.vlan-systeme\tIN A\t10.1.2.10},
+    qq{filer-all00\tIN CNAME\tfiler-all00.vlan-systeme},
     qq{filer-all.vlan-systeme\tIN A\t10.1.2.10},
     qq{filer-all.vlan-systeme\tIN A\t10.1.2.11},
-    qq{filer-all00\tIN CNAME\tfiler-all00.vlan-systeme},
-    qq{filer-all00.vlan-systeme\tIN A\t10.1.2.10},
-    qq{filer-all01\tIN CNAME\tfiler-all01.vlan-systeme},
-    qq{filer-all01.vlan-systeme\tIN A\t10.1.2.11},
+    qq{filer-all\tIN CNAME\tfiler-all.vlan-systeme},
     q{},
     q{; filer-several: filer with ip common on several site},
     q{; number: 2},
     q{;----------------------------------------------------------------------------},
-    qq{filer-several\tIN CNAME\tfiler-several.vlan-systeme},
+    qq{filer-several01.vlan-systeme\tIN A\t10.1.2.21},
+    qq{filer-several01\tIN CNAME\tfiler-several01.vlan-systeme},
+    qq{filer-several00.vlan-systeme\tIN A\t10.1.2.20},
+    qq{filer-several00\tIN CNAME\tfiler-several00.vlan-systeme},
     qq{filer-several.vlan-systeme\tIN A\t10.1.2.20},
     qq{filer-several.vlan-systeme\tIN A\t10.1.2.21},
-    qq{filer-several00\tIN CNAME\tfiler-several00.vlan-systeme},
-    qq{filer-several00.vlan-systeme\tIN A\t10.1.2.20},
-    qq{filer-several01\tIN CNAME\tfiler-several01.vlan-systeme},
-    qq{filer-several01.vlan-systeme\tIN A\t10.1.2.21},
+    qq{filer-several\tIN CNAME\tfiler-several.vlan-systeme},
     q{},
     q{; cbv4-spawn: Spawning server},
     q{; number: 2},
     q{;----------------------------------------------------------------------------},
-    qq{cbv4-spawn\tIN CNAME\tcbv4-spawn.vlan-systeme},
+    qq{spawn01\tIN CNAME\tcbv4-spawn01.vlan-systeme},
+    qq{spawn00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
+    qq{spawn\tIN CNAME\tcbv4-spawn.vlan-systeme},
+    qq{ntp01\tIN CNAME\tcbv4-spawn01.vlan-systeme},
+    qq{ntp00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
+    qq{ntp\tIN CNAME\tcbv4-spawn.vlan-systeme},
+    qq{cbv4-spawn01.vlan-systeme\tIN A\t10.1.167.1},
+    qq{cbv4-spawn01.vlan-pfds-int\tIN A\t10.2.167.1},
+    qq{cbv4-spawn01.vlan-pfds-ext\tIN A\t192.168.1.98},
+    qq{cbv4-spawn01.vlan-middledsi\tIN A\t10.3.2.42},
+    qq{cbv4-spawn01.vlan-admindsi\tIN A\t10.3.1.1},
+    qq{cbv4-spawn01\tIN CNAME\tcbv4-spawn01.vlan-systeme},
+    qq{cbv4-spawn00.vlan-systeme\tIN A\t10.1.167.0},
+    qq{cbv4-spawn00.vlan-pfds-int\tIN A\t10.2.167.0},
+    qq{cbv4-spawn00.vlan-pfds-ext\tIN A\t192.168.1.97},
+    qq{cbv4-spawn00.vlan-middledsi\tIN A\t10.3.2.41},
+    qq{cbv4-spawn00.vlan-admindsi\tIN A\t10.3.1.0},
+    qq{cbv4-spawn00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
+    qq{cbv4-spawn.vlan-systeme\tIN A\t10.1.167.0},
+    qq{cbv4-spawn.vlan-systeme\tIN A\t10.1.167.1},
+    qq{cbv4-spawn.vlan-pfds-int\tIN A\t10.2.167.0},
+    qq{cbv4-spawn.vlan-pfds-int\tIN A\t10.2.167.1},
+    qq{cbv4-spawn.vlan-pfds-ext\tIN A\t192.168.1.97},
+    qq{cbv4-spawn.vlan-pfds-ext\tIN A\t192.168.1.98},
+    qq{cbv4-spawn.vlan-middledsi\tIN A\t10.3.2.41},
+    qq{cbv4-spawn.vlan-middledsi\tIN A\t10.3.2.42},
     qq{cbv4-spawn.vlan-admindsi\tIN A\t10.3.1.0},
     qq{cbv4-spawn.vlan-admindsi\tIN A\t10.3.1.1},
-    qq{cbv4-spawn.vlan-middledsi\tIN A\t10.3.2.41},
-    qq{cbv4-spawn.vlan-middledsi\tIN A\t10.3.2.42},
-    qq{cbv4-spawn.vlan-pfds-ext\tIN A\t192.168.1.97},
-    qq{cbv4-spawn.vlan-pfds-ext\tIN A\t192.168.1.98},
-    qq{cbv4-spawn.vlan-pfds-int\tIN A\t10.2.167.0},
-    qq{cbv4-spawn.vlan-pfds-int\tIN A\t10.2.167.1},
-    qq{cbv4-spawn.vlan-systeme\tIN A\t10.1.167.0},
-    qq{cbv4-spawn.vlan-systeme\tIN A\t10.1.167.1},
-    qq{cbv4-spawn00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
-    qq{cbv4-spawn00.vlan-admindsi\tIN A\t10.3.1.0},
-    qq{cbv4-spawn00.vlan-middledsi\tIN A\t10.3.2.41},
-    qq{cbv4-spawn00.vlan-pfds-ext\tIN A\t192.168.1.97},
-    qq{cbv4-spawn00.vlan-pfds-int\tIN A\t10.2.167.0},
-    qq{cbv4-spawn00.vlan-systeme\tIN A\t10.1.167.0},
-    qq{cbv4-spawn01\tIN CNAME\tcbv4-spawn01.vlan-systeme},
-    qq{cbv4-spawn01.vlan-admindsi\tIN A\t10.3.1.1},
-    qq{cbv4-spawn01.vlan-middledsi\tIN A\t10.3.2.42},
-    qq{cbv4-spawn01.vlan-pfds-ext\tIN A\t192.168.1.98},
-    qq{cbv4-spawn01.vlan-pfds-int\tIN A\t10.2.167.1},
-    qq{cbv4-spawn01.vlan-systeme\tIN A\t10.1.167.1},
-    qq{ntp\tIN CNAME\tcbv4-spawn.vlan-systeme},
-    qq{ntp00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
-    qq{ntp01\tIN CNAME\tcbv4-spawn01.vlan-systeme},
-    qq{spawn\tIN CNAME\tcbv4-spawn.vlan-systeme},
-    qq{spawn00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
-    qq{spawn01\tIN CNAME\tcbv4-spawn01.vlan-systeme},
+    qq{cbv4-spawn\tIN CNAME\tcbv4-spawn.vlan-systeme},
     q{},
     q{; filer-other: filer with ip public on other site},
     q{; number: 2},
     q{;----------------------------------------------------------------------------},
-    qq{filer-other\tIN CNAME\tfiler-other.vlan-public2},
+    qq{filer-other01.vlan-public2\tIN A\t80.125.164.31},
+    qq{filer-other01\tIN CNAME\tfiler-other01.vlan-public2},
+    qq{filer-other00.vlan-public2\tIN A\t80.125.164.30},
+    qq{filer-other00\tIN CNAME\tfiler-other00.vlan-public2},
     qq{filer-other.vlan-public2\tIN A\t80.125.164.30},
     qq{filer-other.vlan-public2\tIN A\t80.125.164.31},
-    qq{filer-other00\tIN CNAME\tfiler-other00.vlan-public2},
-    qq{filer-other00.vlan-public2\tIN A\t80.125.164.30},
-    qq{filer-other01\tIN CNAME\tfiler-other01.vlan-public2},
-    qq{filer-other01.vlan-public2\tIN A\t80.125.164.31},
+    qq{filer-other\tIN CNAME\tfiler-other.vlan-public2},
     q{},
     q{; cbv4-rdeploy: Rdeploy server},
     q{; number: 2},
     q{;----------------------------------------------------------------------------},
+    qq{cbv4-rdeploy01.vlan-public\tIN A\t80.125.163.43},
+    qq{cbv4-rdeploy00.vlan-public2\tIN A\t80.125.164.44},
+    qq{cbv4-rdeploy00.vlan-public\tIN A\t80.125.163.42},
+    qq{cbv4-rdeploy.vlan-public2\tIN A\t80.125.164.44},
     qq{cbv4-rdeploy.vlan-public\tIN A\t80.125.163.42},
     qq{cbv4-rdeploy.vlan-public\tIN A\t80.125.163.43},
-    qq{cbv4-rdeploy.vlan-public2\tIN A\t80.125.164.44},
-    qq{cbv4-rdeploy00.vlan-public\tIN A\t80.125.163.42},
-    qq{cbv4-rdeploy00.vlan-public2\tIN A\t80.125.164.44},
-    qq{cbv4-rdeploy01.vlan-public\tIN A\t80.125.163.43},
     q{},
     q{},
 ];
@@ -530,6 +530,7 @@
     qq{\tbroadcast\t192.168.1.255},
     qq{\tup\t\t/sbin/ip link set bond0 miimon=100},
     qq{\tup\t\t/sbin/ip link set bond0 mode=active-backup},
+    qq{\tup\t\t/sbin/ip route add 1.2.3.4/32 via 80.125.164.44 dev bond0},
     qq{\tgateway\t\t192.168.1.254},
     qq{},
     qq{auto eth0},
@@ -963,7 +964,7 @@
 
 LABEL linux
 \tkernel amd64/vmlinuz-2.6.26.5-universal-grm2.1.12
-\tappend vga=normal root=/dev/sda2 -- default pci=bfsort
+\tappend root=/dev/sda2 -- default pci=bfsort
 
 PROMPT 1
 TIMEOUT 100
diff -r 60907fe0b548 -r e07431ad206c t/21.interfaces.tpl.t
--- a/t/21.interfaces.tpl.t	Wed Dec 31 15:35:28 2014 +0100
+++ b/t/21.interfaces.tpl.t	Fri Jan 09 08:28:03 2015 +0100
@@ -30,7 +30,7 @@
 ##            ],
 #            ip => [
 #                {
-#                    type    => q{loopback},
+#                    method    => q{loopback},
 #                },
 #            ],
 #        },
@@ -81,7 +81,7 @@
 #            name    => q{eth3},
 #            ip  => [
 #                {
-#                    type    => q{static},
+#                    method    => q{static},
 #                },
 #            ],
 #        },
@@ -89,7 +89,7 @@
 #            name    => q{eth4},
 #            ip  => [
 #                {
-#                    type    => q{static},
+#                    method    => q{static},
 #                },
 #            ],
 #        },
@@ -141,7 +141,7 @@
             auto    => 1,
             ip => [
                 {
-                    type    => q{loopback},
+                    method    => q{loopback},
                 },
             ],
         },
diff -r 60907fe0b548 -r e07431ad206c templates/interfaces.tpl
--- a/templates/interfaces.tpl	Wed Dec 31 15:35:28 2014 +0100
+++ b/templates/interfaces.tpl	Fri Jan 09 08:28:03 2015 +0100
@@ -32,9 +32,9 @@
 [% END -%]
 [% FOREACH ip IN interface.ip -%]
 [% DEFAULT ip.version = 'inet' -%]
-[% DEFAULT ip.type = 'static' -%]
+[% DEFAULT ip.method = 'static' -%]
 [% DEFAULT ip.name = interface.name -%]
-iface [% ip.name %] [% ip.version %] [% ip.type %]
+iface [% ip.name %] [% ip.version %] [% ip.method %]
 [% IF ip.address -%]
     address [% ip.address %]
 [% END -%]
@@ -68,7 +68,7 @@
 [% FOREACH down IN ip.down -%]
     down [% down %]
 [% END -%]
-[% FOREACH rule IN ip.custom_rules -%]
+[% FOREACH rule IN ip.option -%]
     [% rule %]
 [% END -%]
 [% END -%]



More information about the pf-tools-commits mailing list