diff options
author | Stig Thormodsrud <stig@io.vyatta.com> | 2009-03-01 09:09:42 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@io.vyatta.com> | 2009-03-01 09:09:42 -0800 |
commit | 9bc0c4ebe663c8b2bdeeb206d403a64ccdd176b3 (patch) | |
tree | da69c85e941af382c7f907d53a1cce5a28aac939 /lib/Vyatta | |
parent | d643df002304ac2b0d85430e910ff58675c38262 (diff) | |
download | vyatta-cfg-9bc0c4ebe663c8b2bdeeb206d403a64ccdd176b3.tar.gz vyatta-cfg-9bc0c4ebe663c8b2bdeeb206d403a64ccdd176b3.zip |
Fix bareword error for missing constants.
Fix $mask usagage in getInterfacesIPadresses().
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/Misc.pm | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm index 83cc36e..9140d4c 100755 --- a/lib/Vyatta/Misc.pm +++ b/lib/Vyatta/Misc.pm @@ -122,10 +122,32 @@ sub getIP { return @addresses; } +use constant { + IFF_UP => 0x1, # interface is up + IFF_BROADCAST => 0x2, # broadcast address valid + IFF_DEBUG => 0x4, # turn on debugging + IFF_LOOPBACK => 0x8, # is a loopback net + IFF_POINTOPOINT => 0x10, # interface is has p-p link + IFF_NOTRAILERS => 0x20, # avoid use of trailers + IFF_RUNNING => 0x40, # interface RFC2863 OPER_UP + IFF_NOARP => 0x80, # no ARP protocol + IFF_PROMISC => 0x100, # receive all packets + IFF_ALLMULTI => 0x200, # receive all multicast packets + IFF_MASTER => 0x400, # master of a load balancer + IFF_SLAVE => 0x800, # slave of a load balancer + IFF_MULTICAST => 0x1000, # Supports multicast + IFF_PORTSEL => 0x2000, # can set media type + IFF_AUTOMEDIA => 0x4000, # auto media select active + IFF_DYNAMIC => 0x8000, # dialup device with changing addresses + IFF_LOWER_UP => 0x10000, # driver signals L1 up + IFF_DORMANT => 0x20000, # driver signals dormant + IFF_ECHO => 0x40000, # echo sent packets +}; + my %type_hash = ( - 'broadcast' => IFF_BROADCAST, - 'multicast' => IFF_MULTICAST, - 'pointtopoint' => IFF_POINTOPOINT, + 'broadcast' => IFF_BROADCAST, + 'multicast' => IFF_MULTICAST, + 'pointtopoint' => IFF_POINTOPOINT, ); # getInterfacesIPadresses() returns IPv4 addresses for the interface type @@ -150,6 +172,9 @@ sub getInterfacesIPadresses { my $flags = $intf->flags(); next if ($flags & IFF_LOOPBACK); + if (defined $mask) { + next unless $flags & $mask; + } my @addresses = $intf->address(4); push @ips, @addresses; |