summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Interface.pm
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2012-05-10 18:18:17 -0700
committerJohn Southworth <john.southworth@vyatta.com>2012-05-10 18:18:17 -0700
commitec497dc1a54c88784b380200508eba6a85f4cb97 (patch)
tree7a8c02cf54ab18f9d8e2049dd8f5057105c0d694 /lib/Vyatta/Interface.pm
parente80a38f61e2321f0cde98f996e2c97dec2f389b6 (diff)
downloadvyatta-cfg-ec497dc1a54c88784b380200508eba6a85f4cb97.tar.gz
vyatta-cfg-ec497dc1a54c88784b380200508eba6a85f4cb97.zip
Bugfix 8079: fix require sys/ioctl.ph confilcts
perl only allows a require to be done once. If it is done in two included modules the module or function in the module used second doesn't have the data in the required file in its scope. To prevent this I created a third module that contains the functions that require 'sys/ioctl.ph' so that there is no longer a conflict.
Diffstat (limited to 'lib/Vyatta/Interface.pm')
-rwxr-xr-xlib/Vyatta/Interface.pm19
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm
index 3fce824..e23f565 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
@@ -411,21 +411,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 {