summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurabh Mohan <saurabh.mohan@vyatta.com>2012-08-09 13:26:49 -0700
committerSaurabh Mohan <saurabh.mohan@vyatta.com>2012-08-09 13:26:49 -0700
commit5d9e18f448e2f917b2bde62a1b79e788b6af8c7e (patch)
tree25983fd77b145559a938fe1d95ea6948a4890018
parent33b1956e7b60bc4e685bb3ec2db7c3fe63f39917 (diff)
downloadvyatta-cfg-quagga-5d9e18f448e2f917b2bde62a1b79e788b6af8c7e.tar.gz
vyatta-cfg-quagga-5d9e18f448e2f917b2bde62a1b79e788b6af8c7e.zip
Bugfix 8217: VTI: add routing cfg commands under interfaces vti
Add support for interface vti for cfg commands for routing.
-rw-r--r--debian/vyatta-cfg-quagga.install1
-rwxr-xr-xgen-interface-templates.pl25
2 files changed, 23 insertions, 3 deletions
diff --git a/debian/vyatta-cfg-quagga.install b/debian/vyatta-cfg-quagga.install
index a344ac5e..eabb7e56 100644
--- a/debian/vyatta-cfg-quagga.install
+++ b/debian/vyatta-cfg-quagga.install
@@ -11,5 +11,6 @@ opt/vyatta/share/vyatta-cfg/templates/interfaces/loopback
opt/vyatta/share/vyatta-cfg/templates/interfaces/openvpn
opt/vyatta/share/vyatta-cfg/templates/interfaces/pseudo-ethernet
opt/vyatta/share/vyatta-cfg/templates/interfaces/tunnel
+opt/vyatta/share/vyatta-cfg/templates/interfaces/vti
opt/vyatta/share/vyatta-cfg/templates/interfaces/wireless
opt/vyatta/share/vyatta-cfg/templates/interfaces/wirelessmodem
diff --git a/gen-interface-templates.pl b/gen-interface-templates.pl
index 8cd074ad..48220321 100755
--- a/gen-interface-templates.pl
+++ b/gen-interface-templates.pl
@@ -41,6 +41,7 @@ my %interface_hash = (
'bonding/node.tag' => '$VAR(@)',
'bonding/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)',
'tunnel/node.tag' => '$VAR(@)',
+ 'vti/node.tag' => '$VAR(@)',
'bridge/node.tag' => '$VAR(@)',
'openvpn/node.tag' => '$VAR(@)',
'wirelessmodem/node.tag' => '$VAR(@)',
@@ -59,8 +60,14 @@ my %interface_hash = (
'dataplane/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)',
);
+# Hash table to check if the priority needs to set @ root
+# of the node.def which is generated.
+my %interface_prio = (
+ 'vti/node.tag' => '901',
+);
+
sub gen_template {
- my ( $inpath, $outpath, $ifname ) = @_;
+ my ( $inpath, $outpath, $ifname, $gen_prio, $prio, $depth ) = @_;
print $outpath, "\n" if ($debug);
opendir my $d, $inpath
@@ -80,7 +87,7 @@ sub gen_template {
or mkdir($out)
or die "Can't create $out: $!";
- gen_template( $in, $out, $subif );
+ gen_template( $in, $out, $subif, $gen_prio, $prio, $depth+1);
next;
}
@@ -88,6 +95,10 @@ sub gen_template {
open my $inf, '<', $in or die "Can't open $in: $!";
open my $outf, '>', $out or die "Can't open $out: $!";
+ # For the top node.tag create the priority tag.
+ if ($name eq 'node.def' && $gen_prio == 1 && $depth <= 1) {
+ print $outf "priority: $prio\n";
+ }
while ( my $line = <$inf> ) {
$line =~ s#\$IFNAME#$ifname#;
print $outf $line;
@@ -120,5 +131,13 @@ foreach my $if_tree ( keys %interface_hash ) {
or mkdir_p($outpath)
or die "Can't create $outpath:$!";
- gen_template( $inpath, $outpath, $interface_hash{$if_tree} );
+ my $gen_prio = 0;
+ my $prio = 0;
+ $gen_prio = 1 if (exists $interface_prio{ $if_tree });
+ if ($gen_prio == 1) {
+ $prio = $interface_prio{ $if_tree };
+ }
+
+ gen_template( $inpath, $outpath, $interface_hash{$if_tree},
+ $gen_prio, $prio, 0 );
}