summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-05-14 13:56:28 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-05-14 13:56:28 -0700
commitc859a613509619459122f5823e1764fef392f43a (patch)
tree15eb841e4df69c3aea16ad3e2f7102ef8ec4529b /scripts/vyatta-interfaces.pl
parent53a7bece51cfb07a8e3dd581aa04580f0cd7d71e (diff)
parent6851a2b28cb7c15bfc4a884c8bd11d784389a8ed (diff)
downloadvyatta-cfg-c859a613509619459122f5823e1764fef392f43a.tar.gz
vyatta-cfg-c859a613509619459122f5823e1764fef392f43a.zip
Merge branch 'hollywood' of suva.vyatta.com:/git/vyatta-cfg into hollywood
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl45
1 files changed, 38 insertions, 7 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index de82edd..dd71d7a 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -195,6 +195,21 @@ sub dhcp_get_interfaces {
}
}
}
+
+ $config->setLevel("interfaces bridge");
+ my @brs = $config->listNodes();
+ foreach my $br (@brs) {
+ $config->setLevel("interfaces bridge $br");
+ if ($config->exists("address")) {
+ my @addrs = $config->returnValues("address");
+ foreach my $addr (@addrs) {
+ if (defined $addr && $addr eq "dhcp") {
+ push @dhcp_intfs, $br;
+ }
+ }
+ }
+ }
+
return @dhcp_intfs;
}
@@ -203,10 +218,20 @@ sub is_dhcp_enabled {
my $config = new VyattaConfig;
- if ($intf =~ m/(\w+)\.(\d)/) {
- $config->setLevel("interfaces ethernet $1 vif $2");
+ if ($intf =~ m/^eth/) {
+ if ($intf =~ m/(\w+)\.(\d+)/) {
+ $config->setLevel("interfaces ethernet $1 vif $2");
+ } else {
+ $config->setLevel("interfaces ethernet $intf");
+ }
+ } elsif ($intf =~ m/^br/) {
+ $config->setLevel("interfaces bridge $intf");
} else {
- $config->setLevel("interfaces ethernet $intf");
+ #
+ # currently we only support dhcp on ethernet
+ # and bridge interfaces.
+ #
+ return 0;
}
my @addrs = $config->returnOrigValues("address");
foreach my $addr (@addrs) {
@@ -221,11 +246,17 @@ sub is_address_enabled {
my $intf = shift;
my $config = new VyattaConfig;
-
- if ($intf =~ m/(\w+)\.(\d)/) {
- $config->setLevel("interfaces ethernet $1 vif $2");
+
+ if ($intf =~ m/^eth/) {
+ if ($intf =~ m/(\w+)\.(\d+)/) {
+ $config->setLevel("interfaces ethernet $1 vif $2");
+ } else {
+ $config->setLevel("interfaces ethernet $intf");
+ }
+ } elsif ($intf =~ m/^br/) {
+ $config->setLevel("interfaces bridge $intf");
} else {
- $config->setLevel("interfaces ethernet $intf");
+ die "unsupported dhcp interface [$intf]";
}
my @addrs = $config->returnOrigValues("address");
foreach my $addr (@addrs) {