From c512c8f72c759e80a3943468ad43903559fcf7f7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 30 Oct 2009 11:05:03 -0700 Subject: 0.15.35 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7620e86..37e5a6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg (0.15.35) unstable; urgency=low + + * Sync config file after saving + + -- Stephen Hemminger Fri, 30 Oct 2009 11:05:03 -0700 + vyatta-cfg (0.15.34) unstable; urgency=low * Add copybreak option to all ether drivers -- cgit v1.2.3 From db1b44563e05c1eb1f5d8bd475c3ed1250307aeb Mon Sep 17 00:00:00 2001 From: "David S. Madole" Date: Sun, 27 Sep 2009 15:27:54 -0400 Subject: Add VRRP capability to bonding interfaces and vifs of bonding interfaces. --- lib/Vyatta/Keepalived.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm index 96d4fe9..c34d277 100755 --- a/lib/Vyatta/Keepalived.pm +++ b/lib/Vyatta/Keepalived.pm @@ -153,10 +153,18 @@ sub vrrp_get_config { my $path; my $config = new Vyatta::Config; - if ($intf =~ m/(eth\d+)\.(\d+)/) { - $path = "interfaces ethernet $1 vif $2"; + if ($intf =~ m/bond/) { + if ($intf =~ m/(bond\d+)\.(\d+)/) { + $path = "interfaces bonding $1 vif $2"; + } else { + $path = "interfaces bonding $intf"; + } } else { - $path = "interfaces ethernet $intf"; + if ($intf =~ m/(eth\d+)\.(\d+)/) { + $path = "interfaces ethernet $1 vif $2"; + } else { + $path = "interfaces ethernet $intf"; + } } $config->setLevel($path); -- cgit v1.2.3 From 07219b06b85cf401a661075f289df5d01421b5c7 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Sun, 1 Nov 2009 09:55:20 -0800 Subject: Add method to retrieve carrier value. --- lib/Vyatta/Interface.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 97ef7f7..8107eff 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -222,6 +222,17 @@ sub flags { return hex($val); } +sub carrier { + my $self = shift; + open my $carrier, '<', "/sys/class/net/$self->{name}/carrier" + or return; + + my $val = <$carrier>; + chomp $val; + close $carrier; + return $carrier; +} + sub hw_address { my $self = shift; -- cgit v1.2.3 From b6d02c359796ac0c47a4214a2fee827ad5d61d47 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Sun, 1 Nov 2009 09:58:19 -0800 Subject: Convert keepalived to use Interface infrastructure. --- lib/Vyatta/Keepalived.pm | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm index c34d277..13966c5 100755 --- a/lib/Vyatta/Keepalived.pm +++ b/lib/Vyatta/Keepalived.pm @@ -152,21 +152,11 @@ sub vrrp_get_config { my $path; my $config = new Vyatta::Config; - - if ($intf =~ m/bond/) { - if ($intf =~ m/(bond\d+)\.(\d+)/) { - $path = "interfaces bonding $1 vif $2"; - } else { - $path = "interfaces bonding $intf"; - } - } else { - if ($intf =~ m/(eth\d+)\.(\d+)/) { - $path = "interfaces ethernet $1 vif $2"; - } else { - $path = "interfaces ethernet $intf"; - } - } + my $interface = new Vyatta::Interface($intf); + die "Unknown interface type: $intf" unless $interface; + + $path = $interface->path(); $config->setLevel($path); my $primary_addr = $config->returnOrigValue("address"); if (!defined $primary_addr) { -- cgit v1.2.3 From 664bb2cd4f4cd1a9597cfb32962a582b0f56e39a Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Sun, 1 Nov 2009 11:48:08 -0800 Subject: Fix carrier method. --- lib/Vyatta/Interface.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 8107eff..90880c7 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -230,7 +230,7 @@ sub carrier { my $val = <$carrier>; chomp $val; close $carrier; - return $carrier; + return $var; } sub hw_address { -- cgit v1.2.3 From 20512f3b1ce6fc6464b14f49b113fe010c37d375 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Sun, 1 Nov 2009 11:49:00 -0800 Subject: Add natural order sort. --- lib/Vyatta/Keepalived.pm | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm index 13966c5..6d6a153 100755 --- a/lib/Vyatta/Keepalived.pm +++ b/lib/Vyatta/Keepalived.pm @@ -125,21 +125,56 @@ sub get_master_file { return $file; } +sub alphanum_split { + my ($str) = @_; + my @list = split m/(?=(?<=\D)\d|(?<=\d)\D)/, $str; + return @list; +} + +sub natural_order { + my ($a, $b) = @_; + my @a = alphanum_split($a); + my @b = alphanum_split($b); + + while (@a && @b) { + my $a_seg = shift @a; + my $b_seg = shift @b; + my $val; + if (($a_seg =~ /\d/) && ($b_seg =~ /\d/)) { + $val = $a_seg <=> $b_seg; + } elsif (($a_seg eq '.') && ($b_seg eq '_')) { + return 1; + } else { + $val = $a_seg cmp $b_seg; + } + if ($val != 0) { + return $val; + } + } + return @a <=> @b; +} + +sub intf_sort { + my @a = @_; + my @new_a = sort { natural_order($a,$b) } @a; + return @new_a; +} + sub get_state_files { my ($intf, $group) = @_; - # todo: fix sorting for ethX > 9 my @state_files; my $LS; if ($group eq "all") { - open($LS,"ls $state_dir |grep '^vrrpd_$intf.*\.state\$' | sort |"); + open($LS,"ls $state_dir |grep '^vrrpd_$intf.*\.state\$' |"); } else { my $intf_group = $intf . "_" . $group . ".state"; open($LS, - "ls $state_dir |grep '^vrrpd_$intf_group\$' | sort |"); + "ls $state_dir |grep '^vrrpd_$intf_group\$' |"); } @state_files = <$LS>; close($LS); + @state_files = intf_sort(@state_files); foreach my $i (0 .. $#state_files) { $state_files[$i] = "$state_dir/$state_files[$i]"; } -- cgit v1.2.3 From 34d2d13c3763ae8c603195dd97d78da5f8e9a5ce Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Sun, 1 Nov 2009 12:44:17 -0800 Subject: Fix spelling error in carrier method. --- lib/Vyatta/Interface.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 90880c7..924058a 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -230,7 +230,7 @@ sub carrier { my $val = <$carrier>; chomp $val; close $carrier; - return $var; + return $val; } sub hw_address { -- cgit v1.2.3 From d1936f6f6328143199d2a2f665ca92292c00709f Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Sun, 1 Nov 2009 14:58:58 -0800 Subject: 0.15.36 --- debian/changelog | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debian/changelog b/debian/changelog index 37e5a6a..dc212c3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +vyatta-cfg (0.15.36) unstable; urgency=low + + [ David S. Madole ] + * Add VRRP capability to bonding interfaces and vifs of bonding + interfaces. + + [ Stig Thormodsrud ] + * Add method to retrieve carrier value. + * Convert keepalived to use Interface infrastructure. + * Fix carrier method. + * Add natural order sort. + * Fix spelling error in carrier method. + + -- Stig Thormodsrud Sun, 01 Nov 2009 14:58:58 -0800 + vyatta-cfg (0.15.35) unstable; urgency=low * Sync config file after saving -- cgit v1.2.3 From 89a8f27b3d905501c9097544f27dd76208303b80 Mon Sep 17 00:00:00 2001 From: slioch Date: Mon, 2 Nov 2009 17:22:05 -0800 Subject: fix for missing priority value on embedded multinode. bug behavior was more limited than this--at least tag node.def and multiple configuration on commit. tested fix with limited regression test. also slightly modified break on priority values where embedded multinodes with priority values are treated as discrete transactions (which isolates failures within the multinode and not the parent of the multinode). --- src/common/unionfs.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 45127e8..452c774 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -225,13 +225,6 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op) } //either multi or tag--shouldn't have made a difference, but arkady was confused. vn->_config._multi = (def.tag | def.multi); - if (def.def_priority == 0) { - vn->_config._priority = LOWEST_PRIORITY; - } - else { - vn->_config._priority = def.def_priority; - } - } } @@ -252,12 +245,6 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op) //Need to do two things: // 1. Come to agreement on where the behavior splits on priority multinodes // 2. Not check for tag node in the def datastructure but use the new datastructure as at some point tag and multi will be the same - if (vn_parent->_config._def.tag == TRUE) { //only for embedded multinodes - vn->_config._priority = vn_parent->_config._priority; - vn_parent->_config._priority = LOWEST_PRIORITY; - } - - //now let's patch up the def multi-nodes //move the def for the multinode from the parent to the value node struct VyattaNode* vn2 = (struct VyattaNode*)node->data; @@ -282,6 +269,25 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op) } } + + if (G_NODE_IS_ROOT(node) == FALSE) { + struct VyattaNode* vn_parent = (struct VyattaNode*)node->parent->data; + struct VyattaNode* vn = (struct VyattaNode*)node->data; + // vn->_config._priority = vn_parent->_config._def.def_priority; + if (vn->_config._def.tag && vn->_config._multi) { + vn->_config._priority = LOWEST_PRIORITY; + } + else if (vn->_config._def.def_priority == 0) { + vn->_config._priority = LOWEST_PRIORITY; + } + else { + vn->_config._priority = vn->_config._def.def_priority; + } + } + + + + if (final_node == TRUE) { //move defs to child... get_term_data_values(node); -- cgit v1.2.3 From a889b4efa38f86c2704595ad6c4e6f665bd2ce91 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Nov 2009 17:26:42 -0800 Subject: 0.15.37 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index dc212c3..9febd26 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +vyatta-cfg (0.15.37) unstable; urgency=low + + [ slioch ] + * fix for missing priority value on embedded multinode. bug behavior + was more limited than this--at least tag node.def and multiple + + -- root Mon, 02 Nov 2009 17:26:42 -0800 + vyatta-cfg (0.15.36) unstable; urgency=low [ David S. Madole ] -- cgit v1.2.3 From 70ba0c76a9c7c7699e1b2f612277d56d99828a49 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Tue, 3 Nov 2009 11:21:23 -0800 Subject: Fix uninitialized variable when reading carrier on admin down interface. --- lib/Vyatta/Interface.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 924058a..ce909f0 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -228,6 +228,7 @@ sub carrier { or return; my $val = <$carrier>; + $val = 0 if ! defined $val # proc entry not readable on down interface chomp $val; close $carrier; return $val; -- cgit v1.2.3 From d24423e69941fb54de93fa997c06463208e6a38d Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Tue, 3 Nov 2009 11:22:04 -0800 Subject: 0.15.38 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9febd26..a5c6c50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +vyatta-cfg (0.15.38) unstable; urgency=low + + * Fix uninitialized variable when reading carrier on admin down + interface. + + -- Stig Thormodsrud Tue, 03 Nov 2009 11:22:03 -0800 + vyatta-cfg (0.15.37) unstable; urgency=low [ slioch ] -- cgit v1.2.3 From 198f9a033a8d9cdb2220579cc2df1484476b2c93 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Wed, 4 Nov 2009 08:15:57 -0800 Subject: Fix missing semicolon. --- lib/Vyatta/Interface.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index ce909f0..513f686 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -228,7 +228,7 @@ sub carrier { or return; my $val = <$carrier>; - $val = 0 if ! defined $val # proc entry not readable on down interface + $val = 0 if ! defined $val; # proc entry not readable on down interface chomp $val; close $carrier; return $val; -- cgit v1.2.3 From 700befa72bca86d054853820e8eaa8c34ddd1d4a Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Wed, 4 Nov 2009 08:16:12 -0800 Subject: 0.15.39 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index a5c6c50..7d6caef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg (0.15.39) unstable; urgency=low + + * Fix missing semicolon. + + -- Stig Thormodsrud Wed, 04 Nov 2009 08:16:11 -0800 + vyatta-cfg (0.15.38) unstable; urgency=low * Fix uninitialized variable when reading carrier on admin down -- cgit v1.2.3 From 5edd540c79f349cbe5f377f5b0e8ed16dcf7cf99 Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Thu, 5 Nov 2009 16:39:30 -0800 Subject: Allow inline comments in config template fields. Also change priority.pl script to display inline comments found in "priority:" fields if they are present. --- scripts/priority.pl | 31 +++++++++++++++++++++---------- src/cli_def.l | 1 + 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/scripts/priority.pl b/scripts/priority.pl index 59239bf..39f6220 100644 --- a/scripts/priority.pl +++ b/scripts/priority.pl @@ -2,16 +2,29 @@ my %pri; - # first check if this file exists, and if so ensure this is a config file. +# Look at all node.def files in the configuration template tree my @files = `find /opt/vyatta/share/vyatta-cfg -name 'node.def'`; foreach my $f (@files) { my $result = `grep 'priority:' $f`; - if (defined $result && length($result) != 0) { - my @r = split " ", $result; - if (defined $r[1]) { - #stuff in hash here - push @{$pri{$r[1]}},$f; - } + if (defined $result && length($result) != 0) { + my @r = split " ", $result; + if (defined $r[1]) { + # Strip off trailing "/node.def\n" from file pathname + my $line = substr($f, 0, -10); + + # Strip off leading "/opt/vyatta/share/vyatta-cfg/templates/" + $line = substr($line, 39); + + # See if there is a comment in entry + my ($entry, $comment) = split /#/, $result; + if (defined $comment) { + $comment =~ s/\n//; + $line = $line . " #" . $comment; + } + + # stuff resulting line into hash + push @{$pri{$r[1]}}, $line; + } } } @@ -21,8 +34,6 @@ foreach my $f (@files) { foreach my $key ( sort { $a <=> $b } keys %pri ) { my @a = @{$pri{$key}}; foreach my $val (@a) { - my $loc = substr($val,0,-10); - my $loc = substr($loc,39); - print $key," ",$loc,"\n"; + print $key," ",$val,"\n"; } } diff --git a/src/cli_def.l b/src/cli_def.l index d73f1c4..721e5f0 100644 --- a/src/cli_def.l +++ b/src/cli_def.l @@ -271,6 +271,7 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he #[^\n]*\n { /* comment */ ++yy_cli_def_lineno; + return EOL; } \n { -- cgit v1.2.3 From bf3f4c673ff781356c38716d23c975db90b490ad Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Thu, 5 Nov 2009 16:41:13 -0800 Subject: 0.15.40 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7d6caef..3f0378e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg (0.15.40) unstable; urgency=low + + * Allow inline comments in config template fields. + + -- Bob Gilligan Thu, 05 Nov 2009 16:41:12 -0800 + vyatta-cfg (0.15.39) unstable; urgency=low * Fix missing semicolon. -- cgit v1.2.3 From 3238b588efc4bc2766edeaec9b1d0369815186f7 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Tue, 10 Nov 2009 12:04:23 -0800 Subject: preserve node.val order for term multinodes. fix for bug 5103 --- src/common/unionfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 452c774..ed40bf8 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -1023,8 +1023,9 @@ dlist_test_func(GQuark key_id,gpointer data,gpointer user_data) if (vn->_data._value == TRUE) { new_vn = copy_vyatta_node(vn); GNode *new_node = g_node_new(new_vn); - //g_node_insert(node, -1, new_node); - insert_sibling_in_order(node,new_node); + // g_node_insert(node, -1, new_node); + g_node_insert_after(node, NULL, new_node); + // insert_sibling_in_order(node,new_node); new_vn->_config._def = vn->_config._def; } else { -- cgit v1.2.3 From 472c42136c47446b3980335aa819df6bcff5caa3 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Tue, 10 Nov 2009 12:06:39 -0800 Subject: 0.15.41 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3f0378e..45f61e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg (0.15.41) unstable; urgency=low + + * preserve node.val order for term multinodes. fix for bug 5103 + + -- Michael Larson Tue, 10 Nov 2009 12:06:38 -0800 + vyatta-cfg (0.15.40) unstable; urgency=low * Allow inline comments in config template fields. -- cgit v1.2.3