diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-01-13 10:01:39 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-01-13 10:01:39 -0800 |
commit | 8ec813a09136b167c1ac93cd049c6945ec6acddb (patch) | |
tree | 5649c1fd1b4da79deee38ca9e783135b6475ff2e /lib/Vyatta/Interface.pm | |
parent | c368665647b9ac72efc161c6e291cba8c3674628 (diff) | |
download | vyatta-cfg-8ec813a09136b167c1ac93cd049c6945ec6acddb.tar.gz vyatta-cfg-8ec813a09136b167c1ac93cd049c6945ec6acddb.zip |
Ignore IPV6 addresses in getInterfacesIPadresses
This routine is used by DHCP server and needs to ignore IPV6
addresses.
NB: Does not fix bogus spellung.
Diffstat (limited to 'lib/Vyatta/Interface.pm')
-rw-r--r-- | lib/Vyatta/Interface.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index ead45fd..687ef67 100644 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -175,7 +175,7 @@ sub using_dhcp { # return array of current addresses (on system) sub address { - my $self = shift; + my ($self, $type) = @_; open my $ipcmd, "ip addr show dev $self->{name} |" or die "ip addr command failed: $!"; @@ -185,6 +185,11 @@ sub address { while (<$ipcmd>) { my ($proto, $addr) = split; next unless ($proto =~ /inet/); + if ($type) { + next if ($proto eq 'inet6' && $type != 6); + next if ($proto eq 'inet' && $type != 4); + } + push @addresses, $addr; } close $ipcmd; |