summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Interface.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta/Interface.pm')
-rwxr-xr-xlib/Vyatta/Interface.pm22
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 {