summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-05-05 14:46:30 -0700
committerStig Thormodsrud <stig@vyatta.com>2008-05-05 14:46:30 -0700
commit2471813598d00698701b5d6798c0a03d73288488 (patch)
treec7e23a90bdbbdbede8c30d664fe933adfb1590ad /scripts/vyatta-interfaces.pl
parent721439469c1146fd283ea219898f4d9b11c0db46 (diff)
downloadvyatta-cfg-2471813598d00698701b5d6798c0a03d73288488.tar.gz
vyatta-cfg-2471813598d00698701b5d6798c0a03d73288488.zip
Fix 3233 dhcp client doesn't work on bridge interface
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl41
1 files changed, 34 insertions, 7 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index aa82b78..020fe28 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -197,6 +197,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;
}
@@ -205,10 +220,16 @@ 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");
+ die "unsupported dhcp interface [$intf]";
}
my @addrs = $config->returnOrigValues("address");
foreach my $addr (@addrs) {
@@ -223,11 +244,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) {