diff options
author | Saurabh Mohan <saurabh@vyatta.com> | 2012-05-16 12:11:54 -0700 |
---|---|---|
committer | Saurabh Mohan <saurabh@vyatta.com> | 2012-05-16 12:11:54 -0700 |
commit | b749b89dba6238c24eba2606d3c47410d5aa4e1f (patch) | |
tree | 87ee17f14a5c06093ac1761f05a3651cfd191fe9 /lib/Vyatta/Interface.pm | |
parent | 0b7d9d5131d41684d8fc59dfc712998f83659127 (diff) | |
parent | a0f15feda0d584863fa3b45bdbd61fb5146a7e14 (diff) | |
download | vyatta-cfg-b749b89dba6238c24eba2606d3c47410d5aa4e1f.tar.gz vyatta-cfg-b749b89dba6238c24eba2606d3c47410d5aa4e1f.zip |
Merge branch 'pacifica' of http://git.vyatta.com/vyatta-cfg into pacifica
Diffstat (limited to 'lib/Vyatta/Interface.pm')
-rwxr-xr-x | lib/Vyatta/Interface.pm | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index bda4d08..8449ccb 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -23,9 +23,9 @@ use strict; use warnings; use Vyatta::Config; use Vyatta::Misc; +use Vyatta::ioctl; use base 'Exporter'; use Socket; -require 'sys/ioctl.ph'; our @EXPORT = qw(IFF_UP IFF_BROADCAST IFF_DEBUG IFF_LOOPBACK IFF_POINTOPOINT IFF_RUNNING IFF_NOARP @@ -299,6 +299,9 @@ sub new { my $path = "interfaces $type $dev"; $path .= " $vifpath $vif" if $vif; + # add the vif 1 to multilink paths since they don't have vif interfaces + # denoted by <if>.<vif> and only allow 1 vif to be set + $path .= " vif 1" if ($dev =~ m/^ml[\d]+$/); $path .= " vrrp vrrp-group $vrid interface" if $vrid; $type = 'vrrp' if $vrid; @@ -409,21 +412,8 @@ sub address { # Do SIOCGIFFLAGS ioctl in perl sub flags { - my $self = shift; - - my $SIOCGIFFLAGS = &SIOCGIFFLAGS; - die "SIOCGIFFLAGS not found" - unless defined($SIOCGIFFLAGS); - - socket (my $sock, AF_INET, SOCK_DGRAM, 0) - or die "open UDP socket failed: $!"; - - my $ifreq = pack('a16', $self->{name}); - ioctl($sock, $SIOCGIFFLAGS, $ifreq) - or return; #undef - - my (undef, $flags) = unpack('a16s', $ifreq); - return $flags; + my $self = shift; + return Vyatta::ioctl::get_interface_flags($self->{name}); } sub exists { |