summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-03-24 17:13:11 -0700
committerStig Thormodsrud <stig@vyatta.com>2010-03-24 17:13:11 -0700
commita4b59a1aaa10c4f78b5d854aa884decb17b8aea9 (patch)
treed556d32de2cfae95e1be161b005ce4cf89c8849a
parent7a9f88c587187ece112e47d7c4d077e44a6afe8a (diff)
parent327ea4113cea590f4d2c33bb430421158ebf51fa (diff)
downloadvyatta-cfg-a4b59a1aaa10c4f78b5d854aa884decb17b8aea9.tar.gz
vyatta-cfg-a4b59a1aaa10c4f78b5d854aa884decb17b8aea9.zip
Merge branch 'larkspur' of http://git.vyatta.com/vyatta-cfg into larkspur
-rw-r--r--debian/changelog22
-rwxr-xr-xetc/init.d/vyatta-router8
-rwxr-xr-xlib/Vyatta/ConfigLoad.pm3
-rwxr-xr-xlib/Vyatta/Interface.pm56
-rwxr-xr-xlib/Vyatta/Misc.pm10
5 files changed, 75 insertions, 24 deletions
diff --git a/debian/changelog b/debian/changelog
index 1760bd1..dc62f66 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,25 @@
+vyatta-cfg (0.16.23) unstable; urgency=low
+
+ [ An-Cheng Huang ]
+ * use template to determine leaf nodes
+
+ [ Stephen Hemminger ]
+ * Fix typo in adsl interface discovery
+
+ -- Stephen Hemminger <shemminger@debian.localdomain> Wed, 17 Mar 2010 14:11:57 -0700
+
+vyatta-cfg (0.16.22) unstable; urgency=low
+
+ * add hook for boot-time config loading environment
+
+ -- An-Cheng Huang <ancheng@vyatta.com> Mon, 15 Mar 2010 14:03:07 -0700
+
+vyatta-cfg (0.16.21) unstable; urgency=low
+
+ * Fix PPP serial QoS support
+
+ -- Stephen Hemminger <stephen.hemminger@vyatta.com> Mon, 15 Mar 2010 10:54:28 -0700
+
vyatta-cfg (0.16.20) unstable; urgency=low
* Print node name before the warning message.
diff --git a/etc/init.d/vyatta-router b/etc/init.d/vyatta-router
index 3f64b9c..c41c48a 100755
--- a/etc/init.d/vyatta-router
+++ b/etc/init.d/vyatta-router
@@ -117,7 +117,13 @@ load_bootfile ()
{
if [ -x $vyatta_sbindir/vyatta-config-loader.pl ]; then
log_progress_msg configure
- sg ${GROUP} -c "$vyatta_sbindir/vyatta-config-loader.pl $BOOTFILE"
+ (
+ if [ -f /etc/default/vyatta-load-boot ]; then
+ # build-specific environment for boot-time config loading
+ source /etc/default/vyatta-load-boot
+ fi
+ sg ${GROUP} -c "$vyatta_sbindir/vyatta-config-loader.pl $BOOTFILE"
+ )
fi
}
diff --git a/lib/Vyatta/ConfigLoad.pm b/lib/Vyatta/ConfigLoad.pm
index 44c1089..627b361 100755
--- a/lib/Vyatta/ConfigLoad.pm
+++ b/lib/Vyatta/ConfigLoad.pm
@@ -315,7 +315,8 @@ sub findSetNodes {
$active_cfg->setLevel(join ' ', @active_path);
my @active_nodes = $active_cfg->listOrigNodes();
my %active_hash = map { $_ => 1 } @active_nodes;
- if (defined($active_hash{'node.val'})) {
+ my $nref = $active_cfg->parseTmplAll(join ' ', @active_path);
+ if (defined($nref->{type}) and !defined($nref->{tag})) {
# we are at a leaf node.
findSetValues($new_ref, \@active_path);
return;
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm
index 19dff4a..b7473dc 100755
--- a/lib/Vyatta/Interface.pm
+++ b/lib/Vyatta/Interface.pm
@@ -84,25 +84,44 @@ sub interface_types {
return @types;
}
-# Read pppoe config to fine associated ethernet for ppp device
-sub find_pppoe {
+# Read ppp config to fine associated interface for ppp device
+sub _ppp_intf {
my $dev = shift;
- my $eth;
+ my $intf;
- open (my $pppoe, '<', "/etc/ppp/peers/$dev")
+ open (my $ppp, '<', "/etc/ppp/peers/$dev")
or return; # no such device
- while (<$pppoe>) {
+ while (<$ppp>) {
chomp;
# looking for line like:
# pty "/usr/sbin/pppoe -m 1412 -I eth1"
- next unless /^pty .*(eth\d+)"/;
- $eth = $1;
+ next unless /^pty\s.*-I\s*(\w+)"/;
+ $intf = $1;
last;
}
- close($pppoe);
+ close $ppp;
- return $eth;
+ return $intf;
+}
+
+# Go path hunting to find ppp device
+sub _ppp_path {
+ my ($intf, $type, $id) = @_;
+ my $config = new Vyatta::Config;
+
+ if ($type eq 'pppoe') {
+ my $path = "interfaces ethernet $intf pppoe $id";
+ return $path if $config->exists($path);
+ }
+
+ my $adsl = "interfaces adsl $intf pvc";
+ foreach my $pvc ($config->listNodes($adsl)) {
+ my $path = "$adsl $pvc $type $id";
+ return $path if $config->exists($path);
+ }
+
+ return;
}
# new interface description object
@@ -115,17 +134,20 @@ sub new {
# need argument to constructor
return unless $name;
- # Special case for pppoe devices
- if ($name =~ /^pppoe(\d+)/) {
- my $n = $1;
- my $eth = find_pppoe($name);
+ # Special case for ppp devices
+ if ($name =~ /^(pppo[ae])(\d+)/) {
+ my $type = $1;
+ my $id = $2;
+ my $intf = _ppp_intf($name);
+ return unless $intf;
- return unless $eth;
+ my $path = _ppp_path($intf, $type, $id);
+ return unless $path;
my $self = {
name => $name,
- type => 'pppoe',
- path => "interfaces ethernet $eth pppoe $n",
+ type => $type,
+ path => $path,
dev => $name,
};
bless $self, $class;
@@ -234,7 +256,7 @@ sub using_dhcp {
sub bridge_grp {
my $self = shift;
my $config = new Vyatta::Config;
-
+
$config->setLevel( $self->{path} );
return $config->returnValue("bridge-group bridge");
}
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm
index d666ea9..94c0c05 100755
--- a/lib/Vyatta/Misc.pm
+++ b/lib/Vyatta/Misc.pm
@@ -62,7 +62,7 @@ sub is_dhcp_enabled {
return 1 if ( $addr && $addr eq "dhcp" );
}
- # return undef
+ return;
}
# check if any non-dhcp addresses configured
@@ -77,7 +77,7 @@ sub is_address_enabled {
return 1 if ( $addr && $addr ne 'dhcp' );
}
- # return undefined (ie false)
+ return;
}
# return dhclient related files for interface
@@ -186,7 +186,7 @@ sub getNetAddrIP {
return $ip;
}
- # default return of undefined (ie false)
+ return;
}
sub is_ip_v4_or_v6 {
@@ -207,7 +207,7 @@ sub is_ip_v4_or_v6 {
return 6;
}
- # default return of undefined (ie false)
+ return;
}
sub isIpAddress {
@@ -269,7 +269,7 @@ sub isIPinInterfaces {
return 1 if ( is_ip_in_list( $ip_addr, getIP($name) ) );
}
- # false (undef)
+ return; # false (undef)
}
sub isClusteringEnabled {