diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2008-05-05 14:46:30 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2008-05-05 14:46:30 -0700 |
commit | 2471813598d00698701b5d6798c0a03d73288488 (patch) | |
tree | c7e23a90bdbbdbede8c30d664fe933adfb1590ad | |
parent | 721439469c1146fd283ea219898f4d9b11c0db46 (diff) | |
download | vyatta-cfg-2471813598d00698701b5d6798c0a03d73288488.tar.gz vyatta-cfg-2471813598d00698701b5d6798c0a03d73288488.zip |
Fix 3233 dhcp client doesn't work on bridge interface
-rwxr-xr-x | scripts/vyatta-interfaces.pl | 41 |
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) { |